Grokking Design Patterns for Engineers and Managers
Ask Author
Back to course home

0% completed

Vote For New Content
Summary
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

For quick reference, the following table offers a thorough analysis of the distinctive characteristics, applicability, examples, benefits, and drawbacks of each structural design pattern.

Pattern NameDistinctive FeatureApplicabilityAn ExampleProsCons
AdapterBridges incompatibilities between interfacesWhen you want to use an existing class whose interface is not compatible with the rest of the codePower adapter for different plug typesEnables interoperability of interfaces; reusableIncreases overall complexity of the code
CompositeRepresents part-whole hierarchies of objectsWhen you want to treat individual objects and compositions of objects uniformlyGraphic drawing editor handling shapes and groups of shapesSimplifies client code; easier management of objectsDesign can become overly generalized
ProxyProvides a placeholder for another object to control access to itLazy loading, logging, access control, smart referenceInternet proxy server controlling access to web contentControl object access; reduce cost of expensive operationsCan introduce a level of indirection; may impact performance
FlyweightMinimizes memory usage by sharing as much data as possible with similar objectsWhen dealing with large numbers of similar objects with little variation in stateCharacters in a word processorReduces memory usage; efficient data sharingComplexity; managing shared state
BridgeSeparates an object’s abstraction from its implementationWhen you want to avoid a permanent binding between an abstraction and its implementationDifferent UI platforms with different backend renderersAbstraction and implementation can vary independently; scalabilityIncreased complexity; conceptual overhead
DecoratorAdds responsibilities to objects dynamicallyWhen extending capabilities of a class in runtimeAdding scrolling to a text view dynamicallyMore flexible than subclassing; avoid feature-loaded classesCan lead to complex code structure; hard to debug
FacadeProvides a simplified interface to a complex subsystemWhen there's a complex system and you want to provide a simple interface to itHome theater control systemSimplifies interface; reduces dependencies on outside codeCan become a single point of failure; may limit flexibility

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible