Posts Tagged ‘Encapsulation’

Over my Head, Part I: Encapsulation

January 30, 2010
encapsulation

'encapsulation' by Flickr user Swiv

Of course I fully expect that over the course of reading Part two of Beginning Ruby there will be frequent “Huh?” moments.

I just had one in Chapter 6 “Classes, Objects , and Modules.

Encapuslation.

Encapsulation is the ability for an object to have certain methods and attributes available for use publicly (from any section of code), but for others to be visible only within the class itself or by other objects of the same class.

Ok, I think maybe typing that out helped me understand the concept but the code examples that followed did not make much sense to me.

I could stick around and try and get it or I could move on. I’ll move on for now. If it’s that important I’m sure I’llĀ encounterĀ it again and its meaning will become clearer.

N.B. The Flickr pic above is one of the first Creative Commons images I found doing a search for ‘encapsulation’. It’s of St. Andrew’s Cathedral, which is near where I’m from. Hurrah!