Wednesday, May 15, 2013

Component-Oriented Programming


Over at the Kongregate forums, a guy named Drakim wrote a series of posts on a relatively new programming paradigm that has come to be called Component-Based Development or Component-Oriented Programming. Basically, this new paradigm does away with inheritance to create classes and builds software entities by assembling components instead. Using this paradigm doesn’t require new languages for component-based development. You can still use your favorite Object-Oriented Programming language as long as you avoid the temptation to use inheritance to build classes. In truth, there’s nothing to stop you from mixing and matching the two paradigms if you wish, but inheritance forces child classes to inherit all the properties and methods of its parent, whereas classes assembled with components will have only the functionalities that their components provide, no more and no less.

What I like about this new paradigm is that it solves an issue that I’ve been wondering about for some time – multiple inheritance. Most OOP languages don’t implement multiple inheritance and with good reason. Things can get messy pretty fast if the multiple parents of a class have their own way of implementing common properties or methods. With a component-based architecture, however, all you need to do is to build and slap on the components that each class needs, and you’re good to go.

All this is fairly new to me, so I’m in no position to talk about it at length. Instead, I’m posting the links to Drakim’s series of articles for future reference.

No comments:

Post a Comment