Skip to Main Content
Hands-On Software Architecture with Golang
book

Hands-On Software Architecture with Golang

by Jyotiswarup Raiturkar
December 2018
Intermediate to advanced content levelIntermediate to advanced
500 pages
12h 19m
English
Packt Publishing
Content preview from Hands-On Software Architecture with Golang

Object oriented in Go – the interface

As we saw in Chapter 1, Building Big with Go, the interface construct is key to polymorphism in Go—abstracting out details from a set of related objects so that we can simplify code. The interface defines a contract that can be assumed by clients, without knowledge (and thus coupling) of the actual class that implements the interface. Interfaces are types that declare sets of methods. Similar to interfaces in other languages, they have no implementation. Interfaces are at the core of Go's object-oriented support.

Many object-oriented languages define explicit implementations of an interface; however, Go is different. Here, the implementation is implicit through duck typing (as we saw in Chapter 1,

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

Event-Driven Architecture in Golang

Event-Driven Architecture in Golang

Michael Stack

Publisher Resources

ISBN: 9781788622592Supplemental Content