Final Flashcards

1
Q

This pattern allows an object to alter its behavior when its internal state changes, causing the object to appear as if it alter its class membership, i.e., changed subclasses.

A

State

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

This pattern addresses situations where there are multiple ways of doing the same kind of thing, but with different kinds of input, output, or runtime characteristics and the choice of which way to do it has to be made at runtime

A

Strategy

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

This pattern should not be used an excuse to violate the “no global variables” rule.

A

Singleton

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

An application of this pattern defines a high-level interface that can make a subsystem easier to use.

A

Façade

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

The solution for this pattern creates a multicast-style of communication (which may be method calls), where a sender object does not need to know about the specific receivers and there can be multiple receivers.

A

Observer

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

This pattern is also called View-Model-Binder

A

MVVM

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

This pattern is often used in conjuction with the Strategies pattern to leverage reuse amoung concrete strategies

A

Template Method

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

Select a creational pattern with class scope, i.e. a pattern who primary purpose is to create objects and whose solution relies primarily on inheritance.

A

Factory Method. If you ignore the inheritence part, then also Factory Idiom.

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

The pattern can address the problem of accessing remote object as if they were local and hide the true location of an object

A

Proxy

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

This pattern is useful when an extension can result in an exponential explosion of subclasses.

A

Decorator

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

This pattern has the negative consequence that adding new kinds of product (i.e., classes) may be difficult, i.e., result in lots of changes to existing code

A

Abstract Factory

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

Select a compound pattern

A

MVC, MVP, MVVM

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

With this pattern, it is easy to add new behaviors to a class of objects

A

State, Visitor, Decorator

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

With this pattern, it is easy to extend a system with a new family of products that parallel existing families of product from a functional perspective.

A

Abstract Factory

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

This pattern allows for the attachment of any combination of additional responsibilities to an object at run time.

A

Decorator

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

By itself, the pattern does not enforce encapsulation of components in a subsystem, but makes it easier to work with them.

A

Façade

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

The solution of this pattern has the developer define the skeleton of an algorithm in a method and defer the specifics of some steps of that algorithm to subclasses.

A

Template Method

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

This pattern defines a readable and extensible way to perform operations over a collection of elements, without breaking the encapsulation of the collection or its elements.

A

Visitor, and to a lesser extent Iterator

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

Select a pattern that can be implemented with either object (delegation) or class scope (inheritance).

A

Adapter

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

This pattern ensures that a class has only one instance.

A

Singleton

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

The solution proposed by this pattern is to extract from a class (i.e., the context) certain behaviors that represent different algorithms for the same basic kind of operation and then encapsulate them in a hierarchy of classes, where each of concrete classes represents a different algorithm.

A

Strategy

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

Consider using this pattern in any system that includes a collection of objects and you need to traverse through that collection

A

Iterator

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

This pattern allows algorithms to be selected at runtime, by defining a family of algorithms, encapsulating each algorithm, and making the algorithms interchangeable within that family.

A

Strategy

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

If generics are not available, then adding a new concrete element types can be hard for the solution of this pattern

A

Visitor

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

This idea involves defining a method (typically a static method) that encapsulates the logic for constructing the right kind of object (typically from specializations of a the class that holds the static method.)

A

Simply Factory Idiom

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

With the solution of this pattern, each product family is implemented in its own hierarchy.

A

Abstract Factory

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

This pattern is sometimes called the “Action” or “Transaction” pattern.

A

Command

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

With this pattern, developers can effectively change an otherwise unchangeable interface.

A

Adapter

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

With this pattern it is easy to add new operations that operate on a complex object structure

A

Visitor

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

This pattern is also known as a Wrapper.

A

Adapter, Decorator

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

This pattern combines the use of Strategy, Composite, and Observers to create three layers of software, but still results in some cyclic dependencies

A

MVC

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

This pattern is useful in any system where one layer of software needs to perform a specific set of actions on objects in another layer of software, particularly if those actions need to be asynchronous, logged, or undone.

A

Command

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

The solution of this pattern is used in the solution for the Decorator Pattern, but addresses a more generic problem.

A

Composite

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

This pattern can be used in multiple possible contexts, but the most common is graphical user interfaces, where multiple displays need to show state information about the same object(s).

A

Observer

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

A disadvantage of this pattern is that it might make the design overly general. Specifically, it might create a bloated interface for the base component and therefore, cause uncessary complexity in concrete components.

A

Composite

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

This pattern provides a unified interface to a set of components in a subsystem that allows for easy and coordinated use of those components

A

Façade

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

Select a pattern that is often used with Visitor

A

Iterator

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

This pattern allows clients to treat aggregate objects and subpart objects uniformly.

A

Composite

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

This pattern is sometimes also called the “Policy Pattern”

A

Strategy

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

This is an architectural design pattern that prescribes three loosely coupled layers of software, connected via bindings

A

MVVM

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

The pattern provides a surrogate placeholder for another objects for the purpose of controlling access to that object in some way.

A

Proxy

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

This pattern localizes and encapsulates state-specific behavior for a class of objects

A

State

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

This idea can be used when a component needs to create an object, but doesn’t directly need to know the type of object, as long as it adhers to an interface abstraction.

A

Simply Factory Idiom

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

This pattern requires designers to separate intrinsic from extrinsic state for a class of objects.

A

Flyweight

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

This pattern is useful when developing a class library or framework and when developers of specific applications need to customize how certain kinds of objects are created

A

Factory Method

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

This pattern describes how to support a large number of objects that have common state information

A

Flyweight

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

This pattern may help designers reduce the space required to manage a large number of objects.

A

Flyweight

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

A pattern, whose solution may result in a long delegation- chain at runtime

A

Decorator, Composite

49
Q

The solution to this pattern includes a base class or interface with methods for subscribing and unsubscribing

50
Q

This pattern focuses on the formation of complex, recursive object structures

51
Q

Use this pattern when you want to create a reusable class that coorperates with unrelated or unforeseen classes, that is, classes that don’t necessarily have compatible interfaces.

52
Q

Select one of the patterns or idioms that focus on creating an object

A

Simply Factory, Factory Method, Abstract Factory

53
Q

This pattern can simplified dependencies between objects when the notification of state changes are a primary concern

54
Q

This pattern addresses the problem of how to encapsulate state-specific behavior as objects in a way that increases the cohesion and extensibility of X, without creating undue coupling

55
Q

One of the participants in this pattern is a “leaf”.

56
Q

This pattern can use defer the actual creation (or copying) of a complex object until it is needed.

57
Q

Select one of two patterns that have similar structure diagrams and rely on a recursive data structure to organize an open-ended number of objects. They have distinct but complimentary intents, and are therefore often used in concert with each other.

A

Decorator, Composite

58
Q

This pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate.

A

Factory Method

59
Q

This pattern helps developers implement “virtual constructors”.

A

Factory Method

60
Q

This pattern’s solution includes an Invoker.

61
Q

One of the negative consequences of this pattern is that clients may experience unexpectedly long delays when changing the state of a target object.

A

Observer, Proxy, and possibly the Command if an Invoker is not used

62
Q

Select a pattern whose intend is to help with the development, testing, and maintenance of user interfaces.

A

MVC, MVP, MVVM

63
Q

This pattern is also known as “surrogate”.

64
Q

This pattern has two variations, one called Supervising Controller and another called Passive View.

65
Q

Select one pattern that can make unit testing simplier.

A

Any, except perhaps the singleton which can make automated testing harder in some frameworks

66
Q

Use this pattern when you want to use an existing class, but its interface does not match the one you need.

67
Q

Select a pattern whose solution(s) rely only on inheritance.

A

Template Method, Factory Method

68
Q

This pattern lets subclasses redefine parts of an algorithm without changing the algorithm’s structure.

A

Template Method

69
Q

This pattern provides an interface for creating objects from families of parallel class hierarchies, particularly in the context of cross-platform development.

A

Abstract Factory

70
Q

This pattern encapsulates actions, e.g., method calls, in objects, creating opportunities to perform them asynchronously and to make them “undoable” and repeatable

71
Q

Select a pattern that relies on delegation via aggregation but should not, on its own, result in long chains of delegation

A

Flyweight, Adapter (Object), Proxy

72
Q

This patterns can be used to provide a global point of access to something like system-wide concrete factory.

73
Q

This pattern is useful when the system needs to be independent of how its products are created, composed, and represented and the class to instantiate has to be determined at runtime.

74
Q

Select a pattern that can help create layers or subsystems that can be easily replaced or swapped out for some other implementation

A

Proxy, Abstract Factory, Command, Adapter, and even Façade if there is no other couple to the layer or subsystem that doesn’t go through the Façade

75
Q

Select a pattern used as part of MVC

A

Strategy, Composite, Observer

76
Q

This pattern may have the negative consequence of producing a lot of small objects that all represent one real- world or problem domain object.

77
Q

This pattern provides a way to access the elements of a collection sequentially without exposing the collection’s underlying implementation

78
Q

This pattern can be used to create “smart references”

79
Q

Events in C# are an implementation of this pattern, at least at a conceptual level.

80
Q

Characterized by the statement “Every object is an unique entity in the university, distinguished by its properties”

A

Object Identity

81
Q

Grouping objects together into sets based on common properties helps manage complexity. We do this during analysis to better understand the problem and during design to help structure a solution.

A

Classification

82
Q

Identifying an individual design decision and then implementing that decision in one place.

A

Localization of Design Decisions

83
Q

The act of hiding or placing a decision decision inside appropriate software components.

A

Encapsulation

84
Q

The act of summarizing or generalizing something to focus on the ideas that are most relevant to a purpose, or view of a complex thing that leaves out unnecesary details

A

Abstraction

85
Q

The manner and degree of interdependence between software components. Less of this makes for more maintainable and reusable software.

86
Q

The degree to which the elements of a component belong together. More of this reduce complexity and increases maintainabiltiy and reusability.

87
Q

Software components should be extensible, but not modifiable.

A

Open/Closed Principle

88
Q

Abstract components should not depend on detail components.

A

Dependency Inversion

89
Q

A process by which developers break up a system into cohesive and loosely coupled components.

A

Modularization

90
Q

The degree to which a software system can be kept correct, reliable, and secure as it operating environment changes

A

Maintainability

91
Q

The degree to which the functionality of a system can be changed or expanded

A

Extensibility

92
Q

The degree to which a component, library of components, or framework can be leveraged in other software systems

93
Q

This practice is one way to achieve Localization of Design Decisions

A

Encapsulate What Varies

94
Q

This practice can help understand the problem and problem domain better, as well as help formulate a solution, create a plan for developing the solution, and communicate with all stake holders

A

Conceptual Modeling

95
Q

This practice can help developers modularize software into loosing coupled layers of abstractions

A

Organize Software into Loosely Coupled Layers, Conceptual Modeling

96
Q

Both aggregation and inheritance can be used to achieve reuse. This practice recommends one over the over, when other considerations don’t dictate one.

A

Prefer Aggregation Over Inheritance

97
Q

This practice can help developers reduce coupling by using interfaces and abstraction effectively

A

Program to an Interface or Abstraction

98
Q

The practice helps developers avoid the Uncommunitive Identifiers pitfall

A

Use Identifiers that Improve Readability and Maintainability

99
Q

This practice is critical to any software development effort and can help all stakeholders gain confidence in correctness of the software

A

Testing with Executable Unit Test Cases

100
Q

Exists in a software, where design or implementation uses identifiers that don’t accurately communicate what the component represent

A

Uncommunitive Names

101
Q

Exists when the identifiers in the design or implementation do not follow any logical naming method or standard set of terminology

A

Inconsistent Names

102
Q

This pitfall exists when there are identifiers like “firstNameString” or “ageLabel” where String and Label are data types.

A

Types Embedded in Names

103
Q

Lack of cohesion in a method is a likely consequence of this pitfall

A

Long Methods

104
Q

Developers can slip into this pitfall if they don’t localize design decisions

A

Duplicate Code

105
Q

Inappropriate use of the decorator pattern may lead to this pitfall

A

Long Message Chains

106
Q

The decorate pattern an help avoid this pitfall

A

Class Explosion

107
Q

This pitfall exists when a class tries to do too much

A

Large Classes

108
Q

Applying the decorator, strategy, template method or state pattern can often help extrication from this pitfall by reducing complex switch statement or if-then-else statement

A

Conditional Complexity

109
Q

This pitfall may exist when there is similar block of code, but the blocks are not exactly the same

A

Oddball Solution

110
Q

This pitfall reduces the readability and maintainability of the code, but does not have a direct impact on the functionality or performance

A

Redundant or Meaningless Comments, Dead Code

111
Q

This pitfall exists where there is an unused variable or a statement that is never executed

112
Q

When developers over design or implement feature that are not needed, they are succumbing to this pitfall.

A

Speculative Generality

113
Q

This pitfall exists when a field (data member) is only set and used in a specific situation or context.

A

Temporary Field

114
Q

This pitfall exists when a derived class is really not a specialization (subset) of a base class

A

Refused Bequest

115
Q

This pitfall exists when certain bad forms of coupling are present, namely when one class uses the internal fields or methods of another

A

Inappropriate Intimacy

116
Q

This pitfall exists when most of the logic of a method uses methods of another class.

A

Feature Envy

117
Q

Ensure the system is in a known state, or at least the component you are testing is in a known state, e.g. create a triangle object with specific sides

118
Q

Execute the thing you are testing, e.g., the ComputeArea() method

119
Q

Compare actual the results with the expected results. The results may be the return value of a method, or more generally, the system’s new state