Rather than client knowing what parameters to pass to constructor to

Rather than client knowing what parameters to pass to

This preview shows page 3 - 4 out of 9 pages.

Client requests type of object instance needed. Rather than client knowing what parameters to pass to constructor to instantiate the correct object (high coupling), we add the factory layer. Client passes parameters to factory and factory makes the correct object type. Client is only aware of how to request object, not how to make it. BUILDER DESIGN PATTERN – Separate the construction of a complex object from its presentation. The same construction process can be used to create different representations. An object could be used with chars/ints/strings etc based on the object’s representation. SINGLETON DESIGN PATTERN – Class in which only single instance is possible. Single object may represent system configuration or universal set of attributes and methods that all other objects should use the same value (java.lang.Runtime). PROTOTYPE DESIGN PATTERN – Provide a prototype of an object (initial setup) that can be copied and cloned (initial state of a chessboard). This removes the need of object initialization process over and over. Useful when object creation is expensive in terms of memory requirements or file reading. ABSTRACT FACTORY PATTERN: Provide an interface to create a group of individual factories w/ common them without specifying their concrete classes. One level above factory pattern. OBJECT POOL DESIGN PATTERN – has a collection of object instances where clients can request them. Once an object instance is assigned it is no longer available until it is returned. Used when creating the class is expensive so there is a limited number of instances (web browser pool for web crawling). STRUCTURAL SOFTWARE DESIGN PATTERNS: Focus on organizing different classes and objects to form larger structures and provide new functionality. How objects are related to each other structurally, such as one object has another, on object builds the output of another, one object inherits from another, etc. Improve cohesion and in most cases reduce coupling. DECORATOR DESIGN PATTERN – Provides a way to build objects from other object instances. It’s like adding a declaration on an existing object. This is a replacement to inheritance if there are many objects in the inheritance hierarchies. Too much inheritance decreases software quality. (Ordering a cheese pizza and adding toppings). FAÇADE DESIGN PATTERN – A single object representing a complex subsystem. Customer service involves multiple things, but it’s a single call from the user. Particularly useful in web/distributed development. ADAPTOR DESIGN PATTERN – Matches interfaces between classes. Useful in interfacing with different implementations that use technologies that are not compatible. FLYWEIGHT DESIGN PATTERN – Object sharing among users by setting different values at different usage. Similar to object pool, BUT flyweight objects are singleton, and it can be used simultaneously by multiple clients. Synchronizes data to ensure integrity. Common set of elements or values used by multiple clients but only one instance is possible. PROXY DESIGN PATTERN – An object representing another object. Java RMI stub and skeleton. Web service proxy in the program for remote web service access. Can create a proxy of the web server so the client can talk to proxy first and then proxy can
Image of page 3
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture