Gem #40: Safe and Secure Software : Chapter 5, Safe Object Oriented Programming
by John Barnes
Let's get started…
OOP took programming by storm about twenty years ago. Its supreme merit is said to be its flexibility. But flexibility is somewhat like freedom discussed in the Introduction – the wrong kind of flexibility can be an opportunity that permits dangerous errors to intrude.
The key idea of OOP is that the objects dominate the programming and subprograms (methods) that manipulate objects are properties of objects. The other, older, view sometimes called Function-Oriented (or structured) programming, is that programming is primarily about functional decomposition and that it is the subprograms that dominate program organization, and that objects are merely passive things being manipulated by them.
Both views have their place and fanatical devotion to just a strict object view is often inappropriate.
Ada strikes an excellent balance and enables either approach to be taken according to the needs of the application. Indeed Ada has incorporated the idea of objects right from its inception in 1980 through the concept of packages which encapsulate types and the operations upon them, and tasks that encapsulate independent activities.
Read Chapter 5 in full
Note: All chapters of this booklet will, in time, be available on the Ada 2005 home page.Ch.5 - Safe Object Oriented Programming