[ Go back to normal view ]

BW2 :: the bitwise supplement :: http://www.bitwisemag.com/2

Encapsulation, OOP and Sapphire
Modularity and Objects

22 July 2008

by Huw Collingbourne

I’ve just posted an article about some of the mysteries of encapsulation and why this means different things to different people.



In object oriented programming, the word ‘encapsulation’ is used a great deal. But not everybody uses it to mean the same thing. In my article, I try to clarify what I mean by encapsulation. You’ll find the article on the blog I write on my software company’s web site:

- What is Encapsulation? (and does it matter?)

The central theme of this article is a discussion of the idea that encapsulation implies not only the hiding of data hidden but also of behaviour - that is, there should be no way in which the implementation details of an object’s methods have any effect upon code that uses that object. While this was one of the fundamental ideas of OOP in the ‘old days’, encapsulation of this type is now extremely rare…

There is a good reason why I am so obsessive about encapsulation at the moment. I happen to be involved in the design and implementation of a new programming language named Sapphire, which will run on Microsoft’s Dynamic language Runtime. Rigorous ‘black box’ encapsulation is one of the core design principles of Sapphire.