Separating static methods into several classes can have a negative impact?


In organization, it is important to separate the methods into different classes.

If we organize the methods into different classes in order to create a better organization, can we have a negative impact on program performance?

For example, I have an application where multiple methods are in a class only, if I create new classes to house specific categories of methods, can I have a negative impact?     

asked by anonymous 20.01.2017 / 01:35

2 answers


No performance impact just because you did it. There could be something bad if it did, but it would be indirect.

Even if it had some loss, it would be insignificant. And the organization must come first. Worry about performance only if there is a reason.

In general, classes should have sole responsibility, so separating if it makes sense is what you should do.

20.01.2017 / 01:41

Just as a complement, there is a negative (but really light) difference in the process memory of the application, which, at least for me, is worth the price of organizing the code.

The difference in performance exists but is not even noticeable, at least not in today's computers, I believe it may be noticeable in devices with less capacity, but only theoretically.

In conclusion, it is worth organizing your code, but remember that organizing is not just dividing into several classes, doing something compact and beautiful rather than splitting more than it should, even if it has a little relevant difference, if you can do something the best way, why not?

20.01.2017 / 21:53