🏑 | ⬅️ Notes | 2023_12_03_Lighting_Pattern.md

#sony #lighting #zero #go

You dont use all 9 Lighting Patterns in your creative work!

img Source: The 9 types of portrait lighting photographers need to know-whether they're on location or in studio https://www.youtube.com/watch?v=c7gpFQwtF68

Most lighting patterns are for fancy flash photographers ;) or not?

You don't use all OOP design patterns in Golang either ...

https://github.com/DovAmir/awesome-design-patterns

img

img

Popular design patterns in Go include:

  1. Singleton: Ensures a class has only one instance and provides a global point of access to it. In Go, this can be implemented using package-level variables and sync package for thread safety.

  2. Factory Method: Defines an interface for creating an object but lets subclasses decide which class to instantiate. In Go, this can be done using interfaces and struct types.

  3. Builder: Separates the construction of a complex object from its representation, allowing the same construction process to create different representations. In Go, this can be implemented with a struct and a series of methods that progressively build up the final object.

  4. Prototype: Creates new objects by copying an existing object, known as the prototype. In Go, this can be implemented using member wise cloning.

  5. Adapter: Allows incompatible interfaces to work together. It involves a wrapper that converts one interface to another. In Go, this can be achieved by defining an interface and creating a struct that implements this interface.

  6. Decorator: Adds new functionality to an object dynamically without altering its structure. This can be achieved in Go through embedding and method overriding.

  7. Observer: Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. Go's channels and goroutines make this pattern easier to implement.

  8. Strategy: Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. In Go, this can be implemented using interfaces.

  9. Command: Encapsulates a request as an object, thereby allowing for parameterization of clients with different requests, queue or log requests, and support undoable operations. This is often implemented in Go using interface and struct types.

  10. State: Allows an object to alter its behavior when its internal state changes. The object will appear to change its class. This is typically implemented in Go using interfaces and struct types.

These patterns are not unique to Go and can be found in various programming languages, but their implementation in Go is often influenced by the language's features like interfaces, goroutines, channels, and the lack of inheritance.

Noted attempts to brings OOP thinking in Go

And yee ... dont forget SOLID in Golang context Golang https://dave.cheney.net/2016/08/20/solid-go-design

Ilya Elias S
Ilya Elias S @reactima
React/TS/Node/Python/Golang Coder
πŸ‡―πŸ‡΅ Japan Permanent Resident
Used to live in πŸ‡ΊπŸ‡¦πŸ‡ΊπŸ‡ΈπŸ‡ΈπŸ‡¬πŸ‡­πŸ‡°πŸ‡¬πŸ‡ͺπŸ‡³πŸ‡±
Interested to discuss the above or looking for a partner to work on Data Mining, Recruitment, B2B Lead Generation and/or Outbound SaaS related projects?
Feel free to ping me to exchange ideas or request a consultation!