I saw (and searched) a lot of questions about StackOverflow about premature optimization - a word on the street is the root of all evil .: P I confess that I am often to blame for this; I do not optimize speed due to the clarity of the code, but I will rewrite my code in logical ways using data types and methods that seem more suitable for the task (for example, in ActionScript 3, using a typed Vector instead of an untyped array for iteration), and if I can make my code more elegant, I will do it. This generally helps me understand my code, and I generally know why I am making these changes.
In any case, I thought today - in OOP we are promoting encapsulation, trying to hide the implementation and promote the interface so that the classes are loosely coupled. The idea is to do something that works without knowing what is going on inside - the idea of a black box.
As such, my question here is whether it is wise to try to do deep code optimization at the class level, since OOP promotes modularity? Or does this fall into the category of premature optimization? I think that if you use a language that easily supports unit testing, you can test, test, and optimize the class, because it is itself a module that accepts input and generates output. But, as one guy writing code, I don’t know, it would be wiser to wait until the project is fully completed to begin optimization.
For reference: I have never worked in a team before, so something obvious for developers who have this experience may be foreign to me.
Hope this question is suitable for StackOverflow - I have not found another that directly answered my request.
Thank!
Edit: reflecting on the question, I understand that “profiling” might be the right term instead of “unit test”; unit-testing verifies that the module is working as it should, while profiling verifies its effectiveness. In addition, part of the question that I should have asked before is the profiling of individual modules after their creation does not reduce the profiling time after the application is completed?
, - , , ( , : D). , , , , .