Design Patterns

Design Patterns

Team 302 Design Patterns Design Patterns Solutions to software design problems you find again and again in real-world application development Patterns are about reusable designs and interactions of objects. Contains “Best Practices” Gang of Four (GoF) released the first ones Team302 – Design Patterns Design Patterns Gang of Four . Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides . 23 Design Patterns released in 1994 Book o Program for interface vs. implementation o Composition vs. Inheritance . More flexible . “Has a” is better than “Is a” . Three categories of Patterns o Creational o Structural o Behavioral Team302 – Design Patterns Design Patterns - References http://gameprogrammingpatterns.com/contents.html http://www.dofactory.com/net/design-patterns http://www.oodesign.com/ https://sourcemaking.com/design_patterns Team302 – Design Patterns Design Patterns - Creational Creates objects while hiding the creation logic Patterns: ○ Abstract Factory ○ Builder ○ Factory ○ Prototype ○ Singleton Team302 – Design Patterns Factory Pattern Interface for creating object Factory calls creator Interaction with the interface of created object Example Team302 – Design Patterns Singleton Pattern One instance of the class Careful not to abuse (limits multithreading capability) Example Team302 – Design Patterns Design Patterns - Structural Related to class and object composition Inheritance is to compose interface Define ways to compose objects into new functionality Patterns: ○ Adapter ○ Bridge ○ Composite ○ Decorator ○ Facade ○ Flyweight ○ Proxy Team302 – Design Patterns Flyweight Pattern Use Sharing to support large number of objects efficiently Example Team302 – Design Patterns Design Patterns – Behavioral Communication between objects Patterns: ○ Chain of Responsibility ○ Command ○ Interpreter ○ Iterator ○ Mediator ○ Momento ○ Observer ○ State ○ Strategy ○ Template ○ Visitor Team302 – Design Patterns Command Pattern FRC JAVA/C++ WPILIB uses Encapsulate a request as an object Clients can handle different requests generically Easier to customize gamepad buttons Supports undo type processing Example Team302 – Design Patterns State Pattern Behavior changes based on state Each State is a Class Example Team302 – Design Patterns Strategy Pattern Family of algorithms Encapsulate each one Interchangeable Example Team302 – Design Patterns.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us