Skip to content
Aprius edited this page Jan 17, 2025 · 1 revision

docs

Notes

As mentioned about Scriptable Object, they should only be used to store their read-only data, although sometimes I still use scriptable to communicate events between objects, it is still very useful in this case.

Scriptable Object is not a pattern, if you don't know, patterns are a double-edged sword, so when using them, you always need to ask yourself whether you should use them or not? and whether there is a better way to solve the problem you are facing.

Singletons are not inherently bad, but the way people use them makes them an anti-pattern, instead of everything being a singleton, only a few classes with specific responsibilities need to be singletons.

Service Locator is an upgrade of singleton when there will be a class that manages the entire service (can be considered a singleton here).

DI looks like black magic, in essence it is like singleton but unlike singleton or service locator where the bindings are expressed explicitly, with DI they are done implicitly below. Honestly it's still a perfect dependency decoupling technique

Simplicity and clarity are always the focus of design so be careful when using it

Clone this wiki locally