Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Single responsibility

The single responsibility principle (SRP) was described by Robert Martin [23], a seasoned software engineer who offers, under the nickname of Uncle Bob, advice about best practices for software development. The SRP states the following:

"In any well-designed system, objects should only have a single responsibility."

In a nutshell, object implementations should focus on doing one thing well, and in an efficient way. To understand how this principle works, let's examine a piece of code that violates it. In the following imaginary scenario, we are working for the ACME drone company where we are using Go to build a drone-based goods delivery system.

The following code excerpt illustrates one of our initial attempts at ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content