Tag: programming languages
Questions Related to programming languages
-
Publisher pattern
-
Flyweight pattern
-
Observer pattern
-
Chain of Responsibility pattern
-
Subscribe pattern
-
Proxy pattern.
-
When you need to have objects notified of events but you don't know which objects would have such needs, or if you will need to add more objects to receive such notification, at a later date.
-
You want one object to monitor when the state of another object but you don't want the object being monitored to need to send any messages regarding its state.
-
When the instances of your class can be use interchangeable and you want to reduce the number of instances created in order to improve performance.
-
When you need to co-ordinate state changes between other objects by using one object.
-
You are building an online auction site to sell rare and collectable toys. You want customers to be notified of bids on items they are bidding for in as close to real time as possible. You would use the Observer pattern to notify the customer objects of c
-
Abstract Factory
-
Factory Method
-
Builder
-
Composite
-
Recursive Builder
-
When you need classes to be notified of events but you don't know which classes or if you will need to add more at a later date.
-
When the instances of your class can be used interchangeably and you want to reduce the number of instances created in order to improve performance.
-
When the instances of your class cannot be used interchangeable and you need to convert them so that they are interchangeable
-
When the instances of your class can be use interchangeable and you want to reduce the number of instances created in order to improve performance
-
When you need to co-ordinate state changes between other objects by using one object.
-
When you need to add functionality to a class without changing its interface.
-
When you need create a separation between abstractions and classes that implement those abstractions.
-
You need a class that will be used in lots of different applications where the logic will only change slightly.
-
It is used primary by Servlets to locate other services such as JMS. A good example of this pattern would be a web based login facility. If a client enters an incorrect password their need to be redirected to a different but their session needs to be main
-
Multiple clients can reuse the same Service Locator pattern.
-
The Service Locator pattern can improve performance by introducing a caching facility.
-
There is a slight loss of performance when using the Service Locator pattern but this is out weighed by the improved maintainability of the code.
-
None of the definitions of the Service Locator pattern are accurate.
-
The Service Locator pattern is used to hide the complexities of initial object creation, EJB lookups and object re-creation.
-
Composite
-
Facade
-
Decorator
-
Adapter
-
Mediator
-
The factory method makes objects that should be used together. This is not the case for the abstract factory.
-
The abstract factory pattern provides an interface for creating a family of objects whereas factory method provides an interface for creating one object.
-
In the abstract factory pattern the objects that the factory makes are to be used together. This is not necessarily true in the factory method pattern.
-
The factory method pattern is used when the class does not know the class of the object it must create. But in the abstract factory this is known in advance.
-
The factory method and abstract factory are essentially the same pattern but two different names are used to describe them depending on the circumstances when they are implemented.
-
Command
-
Chain of Responsibility
-
Adapter
-
Interpreter
-
Strategy
-
Factory Method
-
Prototype
-
Builder
-
Abstract Factory
-
Singleton