Final Flashcards

1
Q

used when we need to decouple an abstraction from its implementation so that the two can vary independently. This type of design pattern comes under structural pattern as this pattern decouples implementation class and abstract class by providing a bridge structure between them.

A

Bridge

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

This pattern involves an interface which acts as a connection which makes the functionality of concrete classes independent from interface implementer classes. Both types of classes can be altered structurally without affecting each other.

A

Bridge

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

behavioral software design pattern that implements a machine in an object -oriented way . is implemented by implementing each individual as a derived class of the interface , and implementing transitions by invoking methods defined by the pattern’s superclass

A

State design pattern

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

can be interpreted as a strategy pattern which is able to switch the current strategy through invocations of methods defined in the pattern’s interface.

A

state pattern

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

This pattern is used in computer programming to encapsulate varying behavior for the same object based on its internal state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and thus improve maintainability

A

State design pattern

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

is the degree of interdependence between software modules; a measure of how closely connected two routines or modules are; the strength of the relationships between modules.

A

coupling

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

refers to the degree to which the elements of a module belong together. measures the strength of relationship between pieces of functionality within a given module.

A

Cohesion

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

All good software design will go for HIGH __________ and LOW _________

A

cohesion
coupling

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

We must have:
We want good:

A

Coupling
Coupling

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

is used to describe just how much an outside class can get into another class’s members:

is used to describe just how much access an outside class has to another class with a well designed API:

A

Tight Coupling

Loose coupling

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

is a principle of software development, aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures.

A

DRY

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

Principles of object oriented design: SOLID

A

(SRP) Single responsibility principle
(OCP) Open Close Principle
(LSP) Liskov substitution principle
(ISP) Interface Segregation principle
(DIP) Dependency Inversion principle

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

says “Every software module should have only one reason to change” Software Module Class, Function etc. Reason to change Responsibility

A

Single responsibility principle SRP

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

says, “Software modules should be closed for modifications but open for extensions.”

A

Open close principle OCP

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

says, “Subclasses should be substitutable for base classes.”

A

Liskov substitution principle LSP

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

states that if a program module is using a Base class, then the reference to the Base class can be replaced with a Derived class without affecting the functionality of the program module .

A

Likov’s Substitution Principle

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

states that 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.

A

Interface segregation principle ISP

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

says, “High level modules should not depend upon low level modules . Rather , both should depend upon abstractions .”

A

Dependency inversion principle DIP

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

Entities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions.

A

Dependency inversion principle DIP

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

Who are the Gang of Four (GOF)

A

Erich Gamma
Richard Helm
Ralph Johnson
John Vlissides

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

Elements of Reusable Object -Oriented

A

Design Patterns

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

Software Defined original how many design patterns

A

23

23
Q

Creates an instance of several families of classes:

Separates object construction from its representation:

Creates an instance of several derived classes:

Avoid expensive acquisition and release of resources by recycling objects that are no longer in use:

A fully instance to be copied or cloned:

A class of which only a single instance can exist:

A

Abstract Factory
Builder
Factory method
Object Pool (Non GOF)
Prototype
Singleton

24
Q

Design patterns are about class instantiating:

A

Abstract factory
Builder
Factory method
Object pool
Prototype
Singleton

25
Q

Match interfaces of different classes:

Separates an object’s interface from its implementation:

A tree structure of simple and composite objects:

Add responsibilities to objects dynamically:

A single class that represents an entire subsystem:

A fine-grained instance used for efficient sharing:

Restricts accessor /mutator access:

An object representing another object:

A

Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Private Class Data (Non -GOF )
Proxy

26
Q

Design pattern are all about class and object composition:

A

Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Private Class Data (Non -GOF )
Proxy

27
Q

A way of passing a request between a chain of objects:

Encapsulate a command request as an object:

A way to include language elements in a program:

Sequentially access the elements of a collection:

Defines simplified communication between classes:

Capture and restore an object’s internal state:

Designed to act as a défault value of an object:

A way of notifying change to a number of classes:

Alter an object’s behavior when its state changes:

Encapsulates an algorithm inside a class:

Defer the exact steps of an algorithm to a subclass:

Defines a new operation to a class without change:

A

Chain of responsibility
Command
Interpreter
Iterator
Mediator
Memento
Null Object (Non-GOF )
Observer
State
Strategy
Template method
Visitor

28
Q

Design pattern are all about a class’s objects communication:

A

Chain of responsibility
Command
Interpreter
Iterator
Mediator
Memento
Null Object (Non-GOF )
Observer
State
Strategy
Template method
Visitor

29
Q

abstract the instantiation process. They help make a system independent of how its objects are created, composed, and represented. uses inheritance to vary the class that’s instantiated, whereas an object pattern will delegate instantiation to another object.

A

Creational design patterns

30
Q

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

A

Abstract Factory

31
Q

Separate the construction of a complex object from its representation so that the same construction process can create different representations.

A

Builder

32
Q

Define an interface for creating an object, but let subclasses decide which class to instantiate. lets a class defer instantiation to subclasses

A

Factory method

33
Q

Specify the kinds of objects to create using a prototypical instance , and create new objects by copying .

A

Prototype

34
Q

Ensure a class only has one instance, and provide a global point of access to it.

A

Singleton

35
Q

are concerned with how classes and objects are composed to form larger structures. use inheritance to compose interfaces or implementations . As a simple example, consider how multiple inheritance mixes two or more classes into one. The result is a class that combines the properties of its parent classes. This pattern is particularly useful for making independently developed class libraries work together.

A

Structural design patterns

36
Q

lets classes work together that couldn’t otherwise because of incompatible interfaces .

A

Adapter

37
Q

Decouple an abstraction from its implementation so that the two can vary independently

A

Bridge

38
Q

Compose objects into tree structures to represent part- whole hierarchies. lets clients treat individual objects and of objects uniformly

A

Composite

39
Q

Attach additional responsibilities to an object dynamically. provide a flexible alternative to subclassing for extending functionality.

A

Decorator

40
Q

Provide a unified interface to a set of interfaces in a subsystem . defines a higher-level interface that makes the subsystem easier to use.

A

Facade

41
Q

Use sharing to support large numbers of fine-grained objects efficiently

A

Flyweight

42
Q

Provide a surrogate or placeholder for another object to control access to it.

A

Proxy

43
Q

are concerned with algorithms and the assignment of responsibilities between objects. describe not just patterns of objects or classes but also the patterns of communication between them. These patterns characterize complex control flow that’s difficult to follow at run-time. They shift your focus away from flow of control to let you concentrate just on the way objects are interconnected.

A

Behavioral design patterns

44
Q

Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.

A

Chain of responsibility

45
Q

Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.

A

Command

46
Q

Given a language, define a representation for its grammar along that uses the representation to interpret sentences in the language

A

interpreter

47
Q

Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

A

Iterator

48
Q

Define an object that encapsulates how a set of objects interact . promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently

A

Mediator

49
Q

Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.

A

Memento

50
Q

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

A

Observer

51
Q

Allow an object to alter its behavior when it’s internal state changes. The object will appear to change its class.

A

State

52
Q

Define a family of algorithms, encapsulate each one, and make them interchangeable. lets the algorithm vary independently from clients that use it.

A

Strategy

53
Q

Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.

A

Template Method

54
Q

Represent an operation to be performed on the elements of an object structure. lets you define a new operation without changing the classes of the elements on which it operates.

A

Visitor