3

I'm going to have to learn about patterns in programming.

Structural and behavioural ones.

I know of several, but I'd love to hear some real-life use cases from y'all, if y'all don't mind.

Comments
  • 2
    https://refactoring.guru/design-pat...

    this sums it up rather nicely. I used to use it as a cheatsheet before I learned them well enough.

    struct: adapter, composite, decorator, facade, proxy

    behav.: CoR (filters), command (Actor), iterator (duh), observer, strategy, visitor

    these are the ones I use mostly (from the two categories you mentioned)

    Struct - are basically wrappers of some sort. The "sort" part defines which pattern it is. Looka t the class/fn name, if it mentions a pattern name - you already know what and how it does and where to look further.

    Behav. - it's how you organize your work units, state, how you will be accessing them in your code

    Examples? Oh boi... I'd let you sneak a peek into my projects if I legally could :) These patterns are... everywhere. Makes maintenance and adoption of the codebase quite easy (think: tens of milions+ LoC kind of projects)
  • 1
    I only use Factory / Singleton / Lazy Loading. Besides that, meh.
  • 1
    @retoor these are creational patterns though ;)
  • 1
    @netikras they're just as cool as any other pattern :) No reason to box them in certain category. I'm just a creator :)
Add Comment