Your current filters are…
by Aman King
Asked to design an object-oriented solution to a problem, most of us would come up with a list of classes and an idea of how they'd interface with each other. Some might even figure out the class hierarchies and the methods involved, not to mention the methods' arguments. Those who desire further details would begin thinking of the data fields to be placed in the classes. This class-driven technique for coming up with OO solutions is a well-known one, and almost all OO languages support this by providing constructs to represent classes, methods, attributes, inheritance, and so on.
A language like Ruby, however, goes a step beyond to provide certain features that pertain not to classes but to "objects", independent of their class hierarchy. And yes, unlike conventional languages like Java, there is a clear distinction of whether the concept applies at a class-level or an instance-level. Take for example access modifiers:in Java, when a method is made private, its privacy is tied to theclass; two objects can call each other's private methods as long as the calling and called codes reside within the same class definition. In Ruby, if a method is made private, the method cannot be invoked by any other object, even from code that originates within the same class. Similarly, Ruby allows a method to be defined at an object-level, making it available only via that particular instance and not any other object, even of the same class. And, of course, there is "duck typing" which says that for a method to be invoked on an object, what matters is not what class the object belongs to but whether such a method exists for the object or not.
Such features are shifting focus back to the "object", and are gradually leading programmers to think more about objects and their interactions, rather than class-related concerns. This makes for a more lax and open playing field that retains the cleanliness and maintainability of a class-based approach while encouraging newer ideas that tend towards a truly "object"-oriented solution. My session will expound on this thought, providing examples to delve deeper into the OOP mindshift that is coming about and the benefits thereof.
20th–21st March 2010