Ask HN: Module Oriented Programming
2 comments
Erlang? http://www.erlang.org/doc/reference_manual/modules.html
The lack of insane hierarchy is one reason erlang is great. When people see hierarchy, they inevitably want to put each section in its own directory. I scream when I have to traverse 8 levels deep (each directory is usually empty except the last one, obviously) just to get to one file.
The lack of insane hierarchy is one reason erlang is great. When people see hierarchy, they inevitably want to put each section in its own directory. I scream when I have to traverse 8 levels deep (each directory is usually empty except the last one, obviously) just to get to one file.
It seems like your suggestion wouldn't allow for subtyping: http://en.wikipedia.org/wiki/Liskov_substitution_principle
* Classes do not exist; Code is organised into modules. * Modules have private fields, functions and parameters. * There is no concept of inheritance; You build up a module using composition. For example: Module "Warp-Drive" Has-A sub-module "Fuel Chamber". * Modules interact with each other via message passing. * There is no concept of abstract modules, instantiating modules, etc. Each module exists as a concrete entity which can contain sub-modules and can be contained within other modules. * There is no concept of Static fields; If you want to have a "Static" like data member, you would create a separate module with that data which passes this information to whichever modules are interested in consuming it.
What is your opinion on such a system? This musing was brought about my personal frustration in learning OOP and wrapping my mind around some of the more abstract concepts. What if things could be simpler, as indicated above?
The closest I found regarding this topic is this Wikipedia article: http://en.wikipedia.org/wiki/Modular_programming