A central tenet is to make code work first and have the means to optimize it up to a certain maximum that is beneficial to long-term maintenance and faster revision cycles that leads to high-speed code that is reliable. A few insights follow from a review of the Go language that originated from Google.
Source Document. Go at Google: Language Design in the Service of Software Engineering
- Large scale code you can revise and compile in cycles that take only seconds to do can lead to getting code to a correct form earlier than perhaps the pure application of reuse.
- A pragmatic approach that the design of Go encodes may be more operationally effective than a methodologically pure approach in managing large-scale critical code.
- An intense focus on reuse to eliminate all duplication may be a premature optimization that impedes the production of correct code.
- Stronger constraints in language specification reduces error in large-scale coding efforts and the resultant code.
- A single pass over dependencies for inclusion speeds up compilation. An obvious point sometimes difficult to achieve in reality.
- Productive ability to cull dependencies can lead to more efficient programs that sustain lower compile time.
Notable Features of Go
- The language seems to have stronger constraints.
- Dependency lists are kept precise by design.
- The concepts of API and ABI are merged into one.
- An object file has all dependency info eliminating the need for header files.
- Syntax knowledge requirements are far less than the C language. It is fast to learn or refresh knowledge.
- Taking the address of a stack variable is acceptable as scopes are local.
- You can implicitly control automatic recovery of unused memory based on how you code.
- The way interfaces are defined creates an opportunity for natural polymorphic function invocation.
Many of the features of object-oriented design exist but adapted to procedural programming. A few I have noticed are as follows:
- Information hiding exists and occurs naturally based on if a function starts with a lower or upper case letter.
- Polymorphic transformation exists in the form of interfaces where you can converge package function definitions.
- Inheritance is by composition of functions.
- Both polymorphic transform and inheritance are dynamic yet statically compiled eliminating run time virtual dispatch.
- Changing interface implementation does not require mass copy and replace. Just change the receiver used.
More Thoughts on Go
A few leading experts involved in the design of programming languages have shared their preference on how languages should appear in form. Most would like a simpler language that can address most of the requirements for the broadest classes of software that languages are used to create. The challenge is taking an existing language and simplifying it. Especially when the concern is to avoid breaking too much code that used an earlier version of the language. Leading minds at Google decided to just start over. I think Go is much closer to the ideal.
As of today, using other languages that have existed for a decade or more may be more relevant than using Go in production. However, the huge scale of Google’s operations and the use of Go in certain areas within their operation means Go has an advantage other languages may not have at their inception. Go will evolve faster towards full production readiness that is broadly applicable to many who write software. As a result, Go can be confidently put to use today across platforms.
What I think is useful about Go in those cases where you have decided to use another language is that Go provides a real-world example of universal language subset. Studying Go and applying its prescriptive advice both in its implicit design outcomes and explicit specifications and conventions can equip you with a good blueprint for how to write code more effectively in other imperative languages. Definitely those descended from C that, like Go, includes C#, C++, Java, Python, and PHP among others. That just means that Go has good advice built within its design for writing code that is useful when applying other programming languages.