6. Powerful Reflection Tools

Go has powerful reflection tools compared to Ruby, which makes it easier to develop generic tools or basic mechanisms. In Go reflection allows inspection of structures, interfaces, fields and methods at runtime without knowing the names of the interfaces, fields, methods at the time of compilation. It also allows for instantiation of new objects and invocation of methods.

7. Go’s Error Handling is Elegant

Interpreted languages, like Ruby, are more concise because it is not required to handle exceptions at all. Swift and Java won’t compile until you force the caller to handle the exception. Go won’t compile unless the caller handles or ignores the error value.

With Ruby, you just have to know that a method might raise an exception. Rails uses a bang in the method name (e.g. model.save!) to show that some sort of exception may be raised. But otherwise, good luck trying to find when, where, or what. Therefore, it’s more common in interpreted languages to see exceptions at runtime. Go (along with Swift and Java) try to tell you about all error cases up front to limit unexpected behavior at runtime.

Go can be very powerful while relatively simple. Certainly, you can find faster languages and easier languages but the equilibrium Go gives between optimization and complexity is ideal for a lot of use cases I believe.

Explore our custom Golang development services for building fast, efficient software.