This collection of notes on OOP was never meant to stand alone. It also represents a view of OO circa early to mid 1990s. Some people still find them useful, so here they are, caveat emptor. Special thanks to Gilbert Benabou for taking to time to compile the first printable version of this document and inspiring us to provide it.
[ PDF ] Printable Version
Table of Contents
- Motivation for OO
- The OO Paradigm
- Visualizing Program Execution
- OO Naming Conventions
- The Object Model
- Abstraction and Identity
- Object-Oriented Messaging
- Encapsulation & Modularity
- Object-Oriented Hierarchy
- Object-Oriented Typing
- OO Concurrency & Persistence
- The OO Development Process
- OO Analysis Techniques
- Pitfalls in OO Analysis
- UML Notation
- CRC Cards
- OO Class Relationships
- Object Oriented Aggregation
- Object Oriented Interitance
- Other Object Oriented Class Relationships
- Object Oriented Instantiation
- Object Oriented Polymorphism
- Review of OO Programming
- The Quality of Classes and OO Design
A standard naming scheme for classes, objects, instance variables, and methods is important. Here are two alternatives.
Naming Scheme 1
Class names: concatenated words each starting with upper case.
- Account, BankAccount, CashDispenser, SortedIntegerQueue
Objects, ivars, methods: concatenated words, first word all lower case, subsequent words starting with upper case.
- balance, shareBalance, count, quantityOfFives
- list, nodeList, account, newAcct
- deposit, balance, objectAt, dispenseMoney
Naming Scheme 2
Class names: concatenated words each starting with upper case.
- Account, BankAccount, CashDispenser, SortedIntegerQueue
Objects: lower case separated by underscores.
- list, node_list, account, new_acct
Ivars: lower case separated by underscores.
- balance, share_balance, count, quantity_of_fives
Methods: concatenated words, first word all lower case, subsequent words starting with upper case,
- deposit, balance, objectAt, dispenseMoney
Hungarian Notation
Everything has a tag that identifies it. This tag is appended to the name, so, for example, an ivar named height of type float might be called height_i_f. Similarly, every class ends in the capital letter "C".
This scheme forces you into the solution space (programming language) and distracts you from the problem space.
Names are vitally important, for the same reason they are important in non-OO languages, but also because of the anthropomorphic nature of OO programming.
It is common in OO languages to name things with the name of the class and a definite or indefinite article ( Control, aController; View, theView). These names are fine when something more appropriate can't be found (List, employees).