CodeBlock1
ProcessCode1
CodeBlock2
ProcessCode1 // same method as above
CodeBlock3
ProcessCode1 // same method as above
CodeBlock4
Now you are talking about:
CodeBlock1
ProcessCode1
CodeBlock2
ProcessCode2 // adifferent method as above
CodeBlock3
ProcessCode3 // a different method as the two above
CodeBlock4
No wonder we were giving you strange sounding advice…
Elegance can be often called sobriety. When I read in another thread that a guy wants to create 300 properties, my mind says “why 300 properties instead of one method and 300 calling values ?”.
If your subroutines (or what you wanted to do in them) are similar enough, then one method and different parameters is desirable. If the processes are so inherently different complexity increases when you try to make it a method, then don’t do it.
OOP should be here to help your code. Not make it more complex.
In the examples of code Microsoft offers for VB Windows Store applications, the process of printing one page is so intricate with calls to methods that call methods and call methods ad nauseam (makes you sick), I was never able to figure the exact process. I believe the guy who wrote that piece of sht confused intelligence and complexity.
Code is only as efficient as it is easy to understand and facilitates debugging. When understanding a program is rendered impossible by undue crowding, it is no longer OOP, it is oops!
Besides, you always have to keep in mind that a program has to be maintained. What you find legible today may become utterly abstruse tomorrow. Better keep it compatible with human eyes.
CodeBlock1
ProcessCode1
CodeBlock2
ProcessCode1 // same method as above
CodeBlock3
ProcessCode1 // same method as above
CodeBlock4
Now you are talking about:
CodeBlock1
ProcessCode1
CodeBlock2
ProcessCode2 // adifferent method as above
CodeBlock3
ProcessCode3 // a different method as the two above
CodeBlock4
No wonder we were giving you strange sounding advice…[/quote]
What I really have is 2-3 calls to Process1, and 2-3 calls to Process2. Somewhere else I may have 2-3 calls to Process3, 4, etc. I think my situation sits right in the gray area between recommending method calls and repeated code.