Is there something wrong with this template? It is only a matter of personal choice, if the state of the class is stored in fields and properties or passed between static methods using arguments?
Speaking from my own personal experience, I worked on 100 KLOC applications that have very deep object chiids, inherit everything and redefine everything else, everything implements half a dozen interfaces, even interfaces inherit half a dozen interfaces, the system implements each design template in a book, etc.
The end result: real OOP-tastic architecture with so many directions that it takes many hours to debug something. I recently started working with a system where the learning curve was described to me as a “brick wall and then a mountain”.
Sometimes an overly complicated OOP leads to such granular classes that it is actually pure harm.
In contrast, many functional programming languages, even OOs like F # and OCaml (and C #!), Contribute to a flat and shallow attack. Libraries in these languages have the following properties:
- Most objects are POCOs or have no more than one or two levels of inheritance, where objects are not much larger than containers for logically related data.
- Instead of calling classes into each other, you have modules (equivalent to static classes) that control interactions between objects.
- Modules tend to act on a very limited number of data types and therefore have a narrow scope. For example, the OCaml list module represents operations on lists; client modules facilitate operations with clients. Although modules have more or less the same functionality as instance methods in a class, the key difference from library modules is that the modules are much more self-contained, much less granular and, as a rule, have little if there are dependencies on other modules .
- As a rule, there is no need to redefine methods of subclass objects, since you can pass functions as first-class objects for specialization.
- Although C # does not support this functionality, functors provide facilities for subclassing specialized modules.
Most large libraries tend to be wider than deep ones, such as the Win32 API, PHP libraries, Erlang BIF, OCaml and Haskell libraries, stored procedures in a database, etc. Thus, this programming style is testing for battle; they work well in the real world.
In my opinion, the best developed module-based APIs are generally easier to work than the best developed OOP APIs. However, the coding style is just as important in the design of the API, so if all the other members of your team use OOP and someone leaves and implements something in a completely different style, then you should probably be asked to rewrite to more closely match the encoding teams standards.
Juliet Mar 18 '10 at 15:50 2010-03-18 15:50
source share