Tuesday, April 10, 2007

C++ != OO

When debating programming philosophies, many associate specific C++ features, such as data encapsulation with OO. Because of these bla bla, they argued, OO philosophy is superior to functional programming.
Well, there are certain features from C++ are not OO. For example, template and generic programming are not OO. What I think about OO is that this thinking assumes that everything should be repsented with classses and objects.
In the early days in the OO theory, advocates borrowed heavily from data analysis in the databasae theory. The thinking went like that you should treat everything as objects, with their private data as properties, and actions performed as methods. This sounds very well, however, there are at least two problems: a class can virtually have unlimited number of members and methods. Human beings have limits on learning things. When a class grows so big it is difficult to expand and maintain. Another problem is more fundamental. Our programming is to solve real problems, not to model the world. We only need a small part of data and concern on how the data is processed into another digital form. We realy do not care about how many objects we need to have in the analysis.