Skip to content

ChowChunLeong/go_practice

Repository files navigation

Go-practice

Singleton

My Remote Image

Use Case:

When you want to ensure that a class has only one instance and provide a global point of access to that instance.

Related api

api/designPattern/getSingleton api/designPattern/updateSingleton

Benefit:

Resource Sharing

Example:

Database Connection

Signal

When you need to ensure that a class has only one instance and provide a global point of access to it.

Factory pattern

Use Case:

When you want to delegate the responsibility of instantiating objects to a factory class, providing an interface for creating instances of a class.

Related api

api/designPattern/drawShape

Benefit:

The Factory Pattern allows you to introduce new types of objects or classes without changing the client code. Clients only interact with the factory interface, making it easy to extend or modify the system with minimal impact.

Example:

cryptoFactory that creates different types of crypto(TRX,BSC)

Personal Tips

File name with Factory use to declare object based on client code's input Folder name with FactoryBlueprint use to store the object blueprint

Signal

When you want to delegate the responsibility of object instantiation to a factory class, providing an interface for creating instances of a class.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages