Skip to Content
Learning Functional Programming in Go
book

Learning Functional Programming in Go

by Lex Sheehan
November 2017
Intermediate to advanced
670 pages
17h 35m
English
Packt Publishing
Content preview from Learning Functional Programming in Go

An OOP example

Object-oriented programs (OOP) consists of stateful objects that support object-related operations, called methods, whose implementation and internal structure is hidden. This means you can evolve or replace the internals of an object without the clients of that object also having to change. It also means that changes can occur to the hidden data without your knowledge, which, as we've seen, can be a bad thing. OOP also includes the idea of inheritance, where a new object could base its state and implementation on another object higher up in its hierarchy, which can cause your program to become rigid and more difficult to change. Here is a Car object and its Add method:

type Car struct {  Model string}func (cars *Cars) Add(car ...
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

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781787281394Supplemental Content