Again depends. Let's say you want to validate the data or format the data in the form the function accepts before processing it, you can move that logic to a function.
Thank you for stopping by! I am a full-stack developer that combines the power of entrepreneurship and programming to make the lives of programmers easier.
No. It does not need to. I just gave preprocessing as a example.
Let's just assume that the function accepts a parameter. Based on certain condition, it either needs to insert a record or update the existing one.
You can split up the logic of insert and update as two separate function. Here the main function almost acts as a wrapper. The main business logic resides in two different function, which can be reused elsewhere as required.
Thank you for stopping by! I am a full-stack developer that combines the power of entrepreneurship and programming to make the lives of programmers easier.
Again depends. Let's say you want to validate the data or format the data in the form the function accepts before processing it, you can move that logic to a function.
Interesting. A concern I have is how do you deal with all the parameters? Does the preprocessing function modifies all its parameters?
No. It does not need to. I just gave preprocessing as a example.
Let's just assume that the function accepts a parameter. Based on certain condition, it either needs to insert a record or update the existing one.
You can split up the logic of insert and update as two separate function. Here the main function almost acts as a wrapper. The main business logic resides in two different function, which can be reused elsewhere as required.
Hope that helps.
Thank you, that makes much more sense now.