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

Interface segregation

Similar to the SRP, the interface segregation principle (ISP) was also coined by Robert Martin. According to this principle, clients should not be forced to depend upon the interfaces that they do not use.

This principle is quite important as it forms the basis for applying the other principles we've discussed so far. Going back to our previous RPG example, let's assume that we have augmented our Sword object with a few more interesting methods:

// Sharpen increases the damage dealt by this sword using a whetstone.
func (Sword) Sharpen() {
    //...
}

// MakeBlunt decreases the damage dealt by this sword due to constant use.
func (Sword) MakeBlunt(){
    //...
}

// Drop places the sword on the ground allowing others to pick ...
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