Saturday, February 25, 2012

Data access by creating functions

A number of time I have come accross developers using functions like

GetProduct()
GetProductTitle()
GetProductCategory()

to get the value of the data instead of just using queries / stored procedures

Not UDFs but functions in VB and in DLLs

I have not understood why

can you please point to some good forum messages / blogposts / articles on this ?

Whats your take on this ?The main reason for this is to separate your code into layers. When you create this function, then you could have different database implementations inside of the function, like data from SQL Server or Oracle, but to outside world, that uses this function, it is still the same value. This design simplifies switching between databases and does not affect the code that calls these functions

No comments:

Post a Comment