bubbles bubbles bubbles
cornerhomegamesabouthelpcontactcorner corner
logo

Koonsolo Blog

logo

Koonsolo helps you create your own games! Follow this blog for insightfull articles. For the latest game developer news and trends, follow me on twitter. And don't forget that we offer the best tool for making RPG's! And while we're at it, why not try out our super innovative indie game 'Mystic Mine'.

Archive

Archive for April, 2010

Object Oriented Programming doesn't need Encapsulation

April 10th, 2010 Koen Witters 5 comments

Note: I use the term ‘Encapsulation’ as a language mechanism for restricting access to some of the object’s components. Others might call this ‘information hiding’.

Traditional Object Oriented Programming

In every object orientend programming course or book that I know, you get introduced to a concept called encapsulation. Encapsulation is a technique that allows you to protect implementation details while exposing only the interface. The advantage is that the rest of the code can only use the interface, and therefore is not dependent on the hidden implementation.

The thought behind the whole idea of encapsulation is that when implementing a class, you protect it against misuse. You make sure that the user can’t break it. You have total control over your class, and the user can only use that what you allow him to use. Another advantage is that providing a stable interface will protect implementation details that are likely to change, and therefore limiting interdependencies between software components. That is, it forces the users to do so.

Most Object Oriented programmers totally agree with all of the above, and I used to too. But that was until I met python. Read more…

Categories: General Tags:

Copyright ©2006-2007 Koonsolo - All rights reserved.