Object-orientated programming
Object-orientated languages support to a greater or lesser extent the following concepts
- Encapsulation (including in an object everything it needs, hiding elements that other objects needn't know about). This keeps data and related routines together and unclutters the large-scale organisation of the program. Each object has a 'public' set of routines that can be called, and these routines are all that other objects need to know.
- Inheritance (creating new types of objects from existing ones). Rather than having many seemingly unrelated objects, objects can be organised hierarchically, inheriting behaviour. Again, this simplifies the large-scale organisation.
- Polymorphism (different objects responding to the same message in different ways). Rather than having a different routine to do the same thing to each of many different types of objects, a single routine does the job. An example of this is how the + operator can be overloaded in C++ so that it can be used with new classes.
- program entities can more closely model real-world entities. As Stroustrup wrote, ``For small to medium projects there often is no distinction made between analysis and design: These two phases have been merged into one. Similarly, in small projects there often is no distinction made between design and programming.''
- complexity is more localised
- code re-use is easier