advanced java midterm
state
Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.
observer
Allows objects to be notified when state changes
decorator
Attach additional responsibilities to an object dynamically._____ provide a flexible alternative to subclassing for extending functionality.
Chain of Responsibility
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.
composite
Compose objects into tree structures to represent part-whole hierarchies.Clients treat collections of objects and individual objects uniformly.
adapter
Convert the interface of a class into another interface clients expect.
class scope
Deals with class relationships that can be changed at compile time
object scope
Deals with object relationships that can be changed at runtime
bridge
Decouple an abstraction from its implementation so that the two can vary independently.
strategy
Define a family of algorithms, encapsulate each one, and make them interchangeable._____ lets the algorithm vary independently from clients that use it.
observer
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
factory method
Define an interface for creating an object, but let subclasses decide which class to instantiate.____ lets a class defer instantiation to subclasses.
template method
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.
observer
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
strategy
Encapsulates inter-changeable behavior and uses delegation to decide which to use
singleton
Ensure a class only has one instance, and provide a global point of access to it.
singleton
Ensures one and only one instance of an object is created
What is Gang of Four (GOF)?
Four authors of Book 'Design Patterns - Elements of Reusable Object-Oriented Software' are known as Gang of Four (GOF).
Interpreter
Given a language, define a represention for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
another example would be like a public speaker for an event of some sort. anyone that is interested and wants an update can come and be updated. otherwise the rest who are not interested will not recieve the update
One example of the Observer pattern from outside of software is a radio station: It broadcasts its signal; anyone who is interested can tune in and listen when they want to. What is another example from "real-life"?
proxy
Provide a surrogate or placeholder for another object to control access to it.
facade
Provide a unified interface to a set of interfaces in a subsystem._____ defines a higher-level interface that makes the subsystem easier to use.
iterator
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
composite
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
visitor
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.
builder
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
Prototype
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
behavorial design patterns
These design patterns are specifically concerned with communication between objects.
Which of the following is correct about Creational design patterns.
These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new opreator.
fly weight
Use sharing to support large numbers of fine-grained objects efficiently.
Creational Patterns
Used to construct objects such that they can be decoupled from their implementing system.
Structural Patterns
Used to form large object structures between many disparate objects.
behavorial patterns
Used to manage algorithms, relationships, and responsibilities between objects.
Creational, Structural and Behavioral patterns.
Which of the following is correct list of classifications of design patterns.
memeto
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.
Which of the following is true about design patterns?
a. Design patterns are obtained by trial and error by numerous software developers over quite a substantial period of time. b. Design patterns are solutions to general problems that software developers faced during software development. c. Design patterns represent the best practices used by experienced object-oriented software developers.