Monday, October 12, 2009

On BA Chapter 14 (Reading the classics)

I guess the main idea of the chapter is more like a conclusion of the all BA book. Read the classics, get inspired from the good old beautiful architectures, but try to stay practical. This is because the difficult thing about theoretical ideas that also have some power is that they also need to be practical.

Underlying the complexity of beautiful architectures, one can usually discover some simple and elegant principles of functional organization and functional order. Discovering these principles takes intellectual engagement, crucial part of the experience and pleasure of architecture. Interestingly enough some of these principles may contradict each other in different contexts; however this should not diminish their importance to one’s baggage of experience.

An interesting example given by the author is how different classics look at inheritance. Formally, OOP principles would advocate making commonality explicit by using inheritance (“is-a”) whereas the GoF favors object composition (“has”) over class inheritance. One can still remember what a great impact had frameworks as MFC on Windows programming. Being able to just subclass classes supplied by the framework and avoid all the complexity of Win32 programming was a great achievement. At the same by carefully analyzing the “is-a” inheritance pattern, one can notice that it is really hard to come up with class hierarchies that really fit this pattern. Very often we notice methods in base classes that do not necessarily make sense in the derived class. This goes beyond the scope of public inheritance and it is usually a sign of bad design.

Smalltalk, with its innovative interface (when programming was done in a monochrome text terminal), has become a classic in itself: a pure object oriented language. Today’s popular object oriented languages, with their primitive types, are not purely object oriented. In Smalltalk, it is possible to create, modify or delete classes during runtime. This is basically the concept of metaprogramming and it is mainly possible because everything is an object. In Smalltalk we also have the notion of latent typing, which is the only typing mechanism available. In fact, latent typing is at the basis of generic programming via templates in C++. With latent typing, types are defined implicitly by what they do and by their interfaces. This offers another alternative to polymorphism because any type can be used anywhere it offers methods fitting the context. One can easily see the relationship to templates.

As classic famous buildings influence young architects, Smalltalk has left his mark on the computer science community. Adamant but beautiful, innovative in its programming model but not compromising, rich in programming concepts that were later embraced by many of the modern programming languages, Smalltalk is a classic that set examples in many ways and has been imitated by more practical approaches. As with building architecture, software architecture is a chaotic adventure at the end of which, beauty and usefulness should balance in harmony. And the recipe for this is reading the classic and practicing and experiencing on your own. Christopher Alexander, the architect father of design patterns, wisely noticed that “people who study design methods without also practicing design are almost always frustrated designers who have no sap in them, who have lost, or never had, the urge to shape things”.

No comments:

Post a Comment