Design principles

There are two key aspects to be taken care of in low-level design:

  • Responsibility assignment: What is the responsibility of each class?
  • Dependency management: What other classes should this class depend on, and what is the contract between these classes?

Robert C Martin (Uncle Bob) has very nicely laid out five principles of good class design to guide us when doing low-level object-oriented design in his book Agile Software Development, Principles, Patterns, and Practices. Though the book and the languages used there are old, the principles are still true and extensible to Go. A mnemonic to remember these principles has been called SOLID (each letter corresponding to a specific principle), as shown here:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset