OODI PRINCIPLES Flashcards
Does D’Janae like you?
yes,yes she does!
Aside from code reuse, explain using an example, ONE benefit of inheritance.
it reduces redundances
makes code more simple
Discuss two ways in which information hiding can be implemented in an object-oriented programming language?
- By using access modifiers
2. Through encapsulation
Explain why it is problematic to utilize inheritance in cases where the inheritance litmus test has not been passed
If an entity fails the litmus test then it is not an appropriate type of a particular entity, there might be certain methods in the superclass that will not coincide with the entity and this may cause unpredictable behavior.
example: assigned a plant to an animal superclass, a method might exist called oral sound and a plant is not able to produce oral sounds
a)If you are using a language which does not permit attributes in the public
interface, how can you achieve the same effects using messages to access the
data?
b)How can you achieve the same effects even in a language that does permit attributes in interfaces?
c)Are there any disadvantages to this approach
a)creating getters and setters
b)
c)
Explain the litmus test for inheritance and aggregation
The litmus test finds the purest form of inheritance and aggregation by asking the “is a” and “has a” questions, respectfully.
Give an example of a situation where a programmer may erroneously utilize
inheritance rather than aggregation to achieve code reuse.
sometimes people in an effort to benefit from reuse attempt to utilize inheritance to inherit code they would like to include in a new class. An example is where a scheduler is required to create a schedule and might make the class a subclass of a calendar. A schedule is not a calendar however you could use parts of the calendar in your code through aggregation.
What is the purpose of an interaction diagram?
Visualize the order of messages being passed among runtime participants (objects, servers databases), providing context for lifelines
in a system.
Describe the parts of a sequence diagram
https://creately.com/blog/diagrams/sequence-diagram-tutorial/#:~:text=A%20sequence%20diagram%20is%20structured,them%20are%20represented%20by%20arrows.
How is a communication diagram different from a sequence diagram?
A communication diagram offers the same information as a sequence diagram, but a sequence diagram emphasizes the time and order of events, a communication diagram emphasizes the messages exchanged between objects in an application.
SOLID?
S - Single Responsibility - one class should only have one main responsibility and there should only be one reason why you should change that code O - Open - Close Principle: Open for extension but closed for modification L - Liskov Substitution Principle: This means that every subclass or derived class should be substitutable for their base or parent class. I - Interface Segregation Principle: A client should never be forced to implement an interface that it doesn’t use, or clients shouldn’t be forced to depend on methods they do not use. D - Dependency Inversion Principle: It states that the high-level module must not depend on the low-level module, but should depend on abstractions. Program to an interface and never to an implementation
YAGNI?
You ain’t gonna need this
DRY?
Dont Repeat Yourself
GRASP?
General Responsibility Assignment Software Patterns
Why is Software Architecture Important
An architecture will inhibit or enable a system’s driving quality attributes.
• The decisions made in an architecture allow you to reason about and
manage change as the system evolves.
• The analysis of an architecture enables early prediction of a system’s
qualities.
• A documented architecture enhances communication among stakeholders.
• The architecture is a carrier of the earliest and hence most fundamental,
hardest-to-change design decisions.
• An architecture defines a set of constraints on subsequent implementation.
• The architecture influences the structure of an organization, or vice versa.