TITLE: Lessons from Unix for OO Design AUTHOR: Eugene Wallingford DATE: August 13, 2012 3:56 PM DESC: ----- BODY: Pike's and Kernighan's Program Design in the UNIX Environment includes several ideas I would like for my students to learn in my Intermediate Computing course this fall. Among them:
... providing the function in a separate program makes convenient options ... easier to invent, because it isolates the problem as well as the solution.
In OO, objects are the packages that create possibilities for us. The beauty of this lesson is the justification: because a class isolates the problem as well as the solution.
This solution affects no other programs, but can be used with all of them.
This is one of the great advantages of polymorphic objects.
The key to problem-solving on the UNIX system is to identify the right primitive operations and to put them at the right place.
Methods should live in the objects whose data they manipulate. One of the hard lessons for novice OO programmers coming from a procedural background is putting methods with the thing, not a faux actor.
UNIX programs tend to solve general problems rather than special cases.
Objects that are too specific should be rare, at least for beginning programmers. Specificity in interface often indicates that implementation detail is leaking out.
Merely adding features does not make it easier for users to do things -- it just makes the manual thicker.
Keep objects small and focused. A big interface is often evidence of an object waiting to be born. ~~~~ In many ways, The Unix Way is contrary to object-oriented programming. Or so many of Linux friends tell me. But I'm quite comfortable with the parallels found in these quotes, because they are more about good design in general than about Unix or OOP themselves. -----