Lecture 2: The Object-Oriented Model Flashcards
Model
An overview or representation of something. It overlooks all irrelevant details and focuses on the ones we are interested in.
Object-oriented model
A way of making the model of a system so that each object in real life is represented by a corresponding object in the model. It focuses on the individual objects and their interactions.
List 4 advantages of the OO model
- People tend to naturally think in terms of objects and their interactions, so it is easier to understand
- Easily map reality
- Easy to develop
- Easy to break down into smaller parts
Properties of an object
- a unique identity
- state (attributes) –> represented by variables (fields)
- well-defined behaviour (operations) –> performed by functions (interface)
Data encapsulation
Hiding the internal state and implementation of an object, and only allowing access through an interface.
Advantages of data encapsulation
Simplification: the entire object can be taken as a whole without focusing on the internal details.
Provides barrier against direct changes