design patterns

updated Sep 11, 2023

How important is studying this?

How should one study this?

2021-08-04:
I was thinking on how I would go about learning the design patterns in the GoF book. I think the angle of entry i would go ahead with is thinking, without input from the book, about each of the intents that are listed alongside the patternname:

  • Intents

    • How do you represent an operation to be performed on the elements of an object structure?
      • Case Study: Abstract Syntax Trees
      • I’ll assume object structure here also refers to C++ structs
      • So, what kind of operation is to be performed on the elements of a struct?
        • If the elements of the structs are of different types, why would we want to perform one type of operation on them? Is it even possible?
        • The operation itself, is it not just a regular function?
        • What then do you mean by representation for a function?
          • Shouldn’t that just be its code?
    • How do you allow an object to alter its behavior when its internal state changes? (The object will appear to change its class)
      • Case Study: TCPConnection
    • How do you define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and update automatically.
      • Case Study: GUI toolkits
    • How do you capture and externalize an object’s internal state so that the object can be restored to this state later?
      • Case Study: Graphical Editor
    • How do you access the elements of an aggregate object sequentially without exposing its underlying representation?
      • Case Study: Traversing a List
    • How do you encapsulate a request as an object, (thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.)
      • Case Study: user interface toolkits include objects like buttons and menus that carry out a request in response to user input
    • How do you avoid coupling the sender of a request to its receiver (by giving more than one objects a chance to handle the request?)
    • Case Study:
  • I’ve not thought well-enough about how classes/OOP impact code performance, does it? I like how a solution to this problem (invalid transactions) was cleaned-up by making use of classes.

  • Object-Oriented Design

    • Template Method vs. Strategy
    • Observer pattern
    • Push vs. pull observer pattern
    • Singletons and Flyweights
    • Adapters
    • Creational Patterns
    • Libraries and design patterns