Hi All,
I'm writing a piece of code in which there is some condition & then i'm inserting the data into a table using a function,say Func(). This is one way of doing it ..Now other way could be -- by directly calling that function Func() & writing the code inside the function directly.
My question is which is better way of doing it /Best Practise ? Also which is best as per the system performance is concerned. Waiting for your valuable inputs.
Regards,
Shankar
0
Comments
My preferred way is to call the function and do everything in there.
It is more logical: in this way you can keep the calling code more readable.
In case you would have a "monster" of a test to do and you put it in the calling code, it would be less readable.
Also you have to consider something about functions: A function must do something for you (if needed). The same happens in the real world: If you ask a person (the function!) to do something for you, you are not interested if he actually had to do something (unless you have to pay him for it) or just to control if it was necessary to do something. You are only interested that he comes back to you saying:Done!
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
It hardly matters in this case which is the best practice, as this is more to do with the logical way.
For any queries you can also visit my blog site: http://msnavarena.blogspot.com/