liveBook · Manning

Multiparadigm language

As explained in Go in Practice, Second Edition

A multiparadigm language supports programming techniques from multiple programming paradigms rather than prescribing one paradigm.

A multiparadigm language supports several programming styles instead of prescribing one. Go occupies this practical middle ground: it supports imperative and declarative programming without requiring a functional or object-oriented approach. section 3.2

Go adapts object-oriented techniques through structs, interfaces, and methods rather than explicit inheritance. An interface defines required behavior; independent types satisfy it by implementing the required methods. This preserves object-like abstraction while using Go’s own type model. section 3.2

Modeling animals without inheritance

Define an Animal interface with speak(), then implement that method on Cat, Dog, and Llama. Assign each value to an Animal variable and invoke speak(); the Llama assignment initially fails until Llama implements the interface.

How Go in Practice, Second Edition covers it

How deep it goes
Explains paradigm positioning and demonstrates interface satisfaction, stopping short of broader paradigm implementation.
Examples
Uses Java inheritance and a Go Animal interface implemented by Cat, Dog, and Llama.
What it assumes
Assumes familiarity with object-oriented programming while clarifying how Go expresses similar ideas.
What you can do after
Apply it via structs, interfaces, and methods to reproduce object-like abstractions without explicit inheritance.
How it connects
Connects imperative programming, declarative programming, functional programming, object-oriented programming, structs, interfaces, methods, and inheritance.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Practice, Second Edition. The section links point to the parts of the book it draws on.