4 ms·
Some kill-OOP rules in addition: * Rewrite your code so that you have more static functions that only deal with their arguments and possibly return something (
by mojuba 18y ago
Some kill-OOP rules in addition:
* Rewrite your code so that you have more static functions that only deal with their arguments and possibly return something (no access to global data or class data). In other words, localize and isolate parts of your code that have minimal side effects. Such parts would be easier to write, debug and maintain.
* A class that contains only ctor/dtor and one method should be rewritten to a single static function.
* A class that returns a reference to a single instance (singleton) is a sign of terrible design. Rewrite.
* If the amount of lines in your unit tests is comparable with that of the original code, it means you expose too much in your interfaces. Rewrite your classes by making their interfaces smaller and simpler. This will reduce your unit tests and make them more meaningful as well.