Go for Java Programmers

Tweet about this on Twitter15Share on Facebook7Share on Google+120Share on LinkedIn1Share on Reddit0Email this to someone

Go, also known as Golang, is a programming language invented by three prominent engineers currently working for Google.  Go is a fairly new language, reaching its initial 1.0 release in 2012.  Go for Java ProgrammersBorn out of a belief that C++ has grown too complex and feature-bloated, Go was originally intended to appeal to systems-level programmers.  However, Go has been most enthusiastically embraced by Python developers, and other dynamic language communities. Go can be described as a best of both worlds.  It offers a light and expressive syntax, comparable to high-level languages.  However, it adds static typing, powerful concurrency support, and raw performance comparable to a low-level language.

Java is a fantastic language for large-scale, large-team enterprise projects.  Duke Java logoHowever, Java requires a fair amount of overhead to spin-up and deploy a new application, and its verbose nature can make it a poor fit for small projects or one-off utility tasks.  Therefore, many Java developers keep one or more secondary languages in their back pocket, to easily tackle side tasks.  Experience with other languages broadens a developer’s horizons, and can improve their abilities when working with Java as well.  Go is is a fantastic candidate to serve such twin roles in the Java programmer’s toolbox.

Because Go was conceived as a systems-level language, and has been so deeply embraced by dynamic language communities, much of the resources available for learning Go are aimed at either C/C++ or Python developers.  Go is relatively easy to learn (check out some resources), but there is not a lot of material specifically oriented for newcomers accustomed to thinking in Java.

This series of articles is intended to help fill that gap.  Each topic focuses on one area of Go syntax, or the wider Go ecosystem, and explains it from the perspective of a Java developer.  Thanks for reading, and enjoy your experience with Go!

Topics in the Go for Java Programmers Series

  • Introduction – A more detailed background on Go, and how it can it can benefit you as a Java programmer.
  • Packages, Functions, and Variables – Comparing the differences in basic syntax between Java and Go, starting with these three elements.
  • Control Structures – Presenting Go’s version of if, for, and switch… how they differ from their Java counterparts, and give Go programs all the flexibility they need.
  • Formatting Rules – Go has some strong opinions about well-formatted code and other best practices, and some of these opinions are enforced at the compiler level.

Future Topics

These are some of the topics planned for this series in the weeks ahead.  If there are any additional subjects you would like to see included, please don’t hesitate to let me know!

  • Types – Understanding structured data in Go, and how Go’s typing system differs from object orientation in Java.
  • Collections – Exploring Go’s core collection types (arrays, slices, maps) alongside the familiar Java Collections framework.
  • All You Need to Know About Pointers – SPOILER… not very much!  This can be an intimidating topic for Java developers, reading Go books that are aimed at C/C++ programmers.  However, Go’s garbage collection and static type-checking eliminate the pitfalls that make this such a hairy subject in low-level languages.  Pointers in Go are surprisingly similar to the way that Java uses them under the covers, even if we as Java developers aren’t used to talking about it.
  • Exception Handling – Examining good practices for dealing with error conditions in Go programs, and how to easily adapt from the familiar try-catch Java model.
  • Builds and Dependency Management – The similarities and differences between the “go” utility and Java build systems such as Maven.
  • Concurrency – Multithreading (and beyond), without the pain.
  • IDE’s and Tools – A look at the ecosystem of tools available for working with Go code… on its own, or alongside your Java tools.
  • Documentation, and Idiomatic Best Practices – Comparing godoc with javadoc, and general best practices for structuring Go code.
  • More to come?…
  • Pingback: Go for Java Programmers: Introduction | StevePerkins.net

  • Pingback: Go for Java Programmers: Fundamentals, part 1 | StevePerkins.net

  • Pingback: Go for Java Programmers: Formatting Rules and Surpises | StevePerkins.net

  • http://akhyar.net/ Akhyar

    Great series of article. Looking forward for more chapters!

    • http://steveperkins.net/ Steve Perkins

      Thanks! I’ve received a handful of emails asking when the next part is coming out, and it’s really exciting to hear that people are reading.

      There are still many more to come! These days I’m pretty busy working for a technology start-up, and recently became a new father at home, so my blog output comes in spurts. I’m able to crank out a handful of articles back-to-back, and then get busy with other things for a few months.

      However, I’m still very much a fan of Go, and plan to tackle at least the articles listed above if not more. I also registered the “goforjavaprogrammers.com” domain, so that I might bundle all this material up in one single e-book when it’s more complete.