Abhishk Singh wrote:Although its better to write the code in separate classes with loose coupling, modular approach and encapsulation but does it make a difference performance wise.
Is it better to divide the code into separate classes, say class B, class C and class D when we already know that all the classes B,C & D will be instantiated simultaneously at runtime?
fred rosenberger wrote:The real point here is that you don't know where the slowdown is, so doing anything is premature. Find out the reality of where any bottlenecks are, and focus on that.
Teo Filimon wrote:Instantiating classes is an expensive operation...
Teo Filimon wrote:the truth is:
- if you convert class A to classes B,C,D this will not be faster (if you don't optimize in other ways) because indeed it has a cost
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton