1 / 16

Generic Interfaces and Encapsulation, Continued

Generic Interfaces and Encapsulation, Continued. Kirk Scott. Corbel From Wikipedia, the free encyclopedia. Jump to: navigation , search For other uses, see Corbel (disambiguation ) .

armand
Download Presentation

Generic Interfaces and Encapsulation, Continued

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Generic Interfaces and Encapsulation, Continued Kirk Scott

  2. CorbelFrom Wikipedia, the free encyclopedia • Jump to: navigation, searchFor other uses, see Corbel (disambiguation). • In architecture a corbel (or console) is a piece of masonry jutting out of a wall to carry any superincumbent weight. A piece of timber projecting in the same way was called a "tassel" or a "bragger".[1] The technique of corbelling, where rows of corbels deeply keyed inside a wall support a projecting wall or parapet, has been used since Neolithic times.[2] It is common in Medieval architecture and in the Scottish baronial style as well as in the Classical architectural vocabulary, such as the modillions of a Corinthian cornice and in ancient Chinese architecture.

  3. This is an introductory unit. • These are the units/chapters belonging to this section of the course: • Unit 12, Flyweight, book chapter 13 • Unit 13, Decorator, book chapter 27 • Unit 14, State, book chapter 22

  4. What will be given next is an extremely brief overview of these topics. • Although the patterns are different from each other, they can be viewed as having this broad characteristic in common: • They wrap up functionality in a desirable way • In other words, they provide models for how to divide attributes and operations among classes in an overall design

  5. Flyweight • Book definition: • The intent of the Flyweight pattern is to use sharing to support large numbers of fine-grained objects efficiently. • Comment mode on: • It might be preferable to say “large numbers of references to a smaller set of fine-grained objects”, although there may also be a large number of objects • Simple large-scale sharing is supported by making the shared object(s) immutable

  6. Decorator • Book definition: • The intent of Decorator is to let you compose new variations of an operation at runtime. • Comment mode on: • Although the term “compose” appears in the definition, the Decorator pattern is not related to the composite design pattern, which will be given later

  7. The word compose describes nested construction where the resulting object contains a composite of functionalities • In brief, nested construction refers to this idea: • Subclasses contain instance variables that are of the type of one of their superclasses • This came up in the proxy design pattern, where it proved less than ideal • It is used in earnest in this design pattern

  8. State • Book definition: • The intent of the State pattern is to distribute state-specific logic across classes that represent an object’s state • Comment mode on: • What this means is that a problem will be analyzed in terms of its states • There will be a class for in the design for each state

  9. The code for a particular state will occur only once, in a method for that state, rather than many times, in several different domain methods in a non-state design • The practical goal and consequence of distributing or dividing logic among various state classes is to avoid needless repetition of code

  10. In summary: • Flyweight encapsulates the core, immutable characteristics of a kind of entity into a class so that references to instances of that class can be shared • Decorator nests construction of objects of different classes, resulting in an object with a “concentric” set of functionalities

  11. State subdivides functionality associated with states into different classes • In one way or another, these patterns all have something to do with what belongs in a given class in a design.

  12. These are my mnemonic devices for the patterns and their characteristics: • Flyweight: Immutable core • Decorator: Nested construction, concentric function—Big fish eats little fish (stay tuned) • State: Subdivide design to support (state) transition

  13. The End

More Related