Object Oriented Design Flashcards
(15 cards)
What are the main three categories of objects
Entity, Boundry and Control
What is an entity object
An object that cooresponds with a real world object. Example: Chair, Person, Bike
Give an example of a Boundry object
A Submit button on a page or a Service that makes a call to an api
What is CRC and what does it stand for?
Is a technique (Class, Responsibility, Collaborator) thats used to represent information about Components, their connections and responsibilities.
Can you give an example for a CRC card using a Bank User?
Bank User is the class, responsibilities would insert card and choose a task, the collaborator is the Bank Machine, Bank Card
Name the four design principles
Abstraction, Encapsulation, Decomposition, Generalization
Describe Abstraction
Idea of simplifying a concept to its essentials within some context
Describe encapsulation
Involves 3 ideas:
- Making some sort of capsule that has details on the inside which some of them you can access from the outside.
- You expose certain data and functions of that object
- You can restrict access to certain data and methods
Forms a self-contained object by bundling data and function it requires to work. Exposes an interface whereby other objects can access and use it and restricts access to certain details.
Describe decomposition
Taking something as a whole and dividing it up into different parts.
What are the three relationships in decomposition
Association, Aggregation, Composition
What does a decomposition association mean?
It is some relationship. There is a loose relationship between two objects. Objects interact with each other for some time.
What is decomposition Aggregation?
It is a has-a relationship where a whole has parts that belong to it. This is a weak relationship. Parts can belong to wholes but can also exist independently.
What is Composition?
An exclusive containment of parts. A strong “has-a” relationship. The whole cannot exist without the part.
How can a protected attribute be accessed?
- By the encapuslating class
- All Subclasses
- All classes within the same package
In what way can you implement Polymorphism in OOP?
By using interfaces