default Flashcards

1
Q

Single Responsablity (Separation of concerns)

A

“There should never be more than one reason for a class to change”

Applies to a class, an interface, trait and method/function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Open Closed Principle

A

Open for extension, closed for modification

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

liskov substitution principle

A

if we have an interface that accept a base class we should be able to stick a derived class also

” the subtype S implements its own class attribute phi of type string instead of list. This violates Liskov’s theory. You can no longer replace T with objects of type S.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Interface Segregation Principle (ISP)

A

states that clients should not be forced to depend upon interface members they do not use.

ISP proposes that the interfaces be broken down into multiple, small cohesive interfaces so that no class is forced to implement any interface, and therefore methods, that it does not need.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Suggestions for Object Oriented Design

A

Separate out parts of code that vary or change from those that remain the same.

Always code to an interface and not against a concrete implementation.

Encapsulate behaviors as much as possible.

Favor composition over inheritance. Inheritance can result in explosion of classes and also sometimes the base class is fitted with new functionality that isn’t applicable to some of its derived classes.

Interacting components within a system should be as loosely coupled as possible.

Ideally, class design should inhibit modification and encourage extension.

Using patterns in your day to day work, allows exchanging entire implementation concepts with other developers via shared pattern vocabulary.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Creational design patterns relate to

A

how objects are constructed from classes. New-ing up objects may sound trivial but unthoughtfully littering code with object instance creations can lead to headaches down the road.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Creational design patterns types

A

Builder Pattern
Prototype Pattern
Singleton Pattern
Abstract Factory Pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Structural design patterns are concerned with the

A

composition of classes i.e. how the classes are made up or constructed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Structural patterns types

A

Adapter Pattern
Bridge Pattern
Composite Pattern
Decorator Pattern
Facade Pattern
Flyweight Pattern
Proxy Pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Behavioral design patterns dictate the

A

interaction of classes and objects amongst eachother and the delegation of responsibility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Behavioral design patterns

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly