Object Oriented in Go
Often time you don’t know what object to create, what attributes and apis to include. Below are tips:
- attributes. Don’t rush or shy away from defining attributes in the first place. Defining Methods first, frequent parameters to Method will be the attributes.
- methods. operations that you want to perform. Do not shy away by thinking of the algorithms, and action name should be enough.
- composition is king. If there are many methods. Break it down, that’s a sign that your object has too many responsibility.