You are previewing The Go Programming Language Phrasebook.

The Go Programming Language Phrasebook

Cover of The Go Programming Language Phrasebook by David Chisnall Published by Addison-Wesley Professional
O'Reilly logo

4. Common Go Patterns

The first step to fluent use of any programming language is understanding the design patterns and idioms that are commonly used. Learning the syntax is only the first step to learning how to think in the language, akin to learning vocabulary and basic grammar in a natural language. People speaking a second language often make very amusing mistakes by literally translating idioms from their first language.

Programming languages are no different. If you’ve read C++ code written by Java programmers, or vice versa, then you’ve probably encountered this. Just translating an approach that you would use in one language into another will work (as long as both languages are equally expressive), but it will usually give horrible code. ...

The best content for your career. Discover unlimited learning on demand for around $1/day.