DEV Community

mohieddin
mohieddin

Posted on

Baby Steps in Golang

Workplace is a proprietary product of Supahands.
Our Business Operations Managers (BOMs) use the platform to manage our projects and SupaAgents (Supahands’ managed workforce).

One of the main highlights of Workplace is labels — a feature that allows BOMs to match SupaAgents to projects depending on their skills and qualifications.

Labels help with describing a SupaAgent’s skills and for our BOMs to identify SupaAgents with relevant skills that are required of them to join a project.

labels

Labels display the skills of a SupaAgent and requirements of a project.

For example, Project 5UP4 requires SupaAgents with annotation skills, therefore, BOMs can change the settings of the project, SupaAgents without the label tag to their account will not be able to join the project.

The problem we were trying to solve…

We experienced unexpected growth in September, where we had three times the number of SupaAgents coming on to Workplace. The platform had to load every single SupaAgent’s information, putting a strain on the system.

Besides loading issues, the server was not responding due to the large amount of data it had to cope with. We initially attempted to solve the issue by increasing the number of CPUs that run our microservice but eventually came to realize that it was costly and inefficient to do so.

We knew we had to take the next course of action ⁠ — to rewrite the microservice of Workplace.

The previous microservice was built using Java (spring-boot framework) and GraphQL (neo4j), which were not suitable choices for rapid scaling. The software architecture was built in a way that could only allow us to handle the amount of SupaAgents that we had at that time. Naturally, as the number of users on the platform grew, Workplace began breaking.

While faster load time was the priority in the reason for rewriting the microservice. Additionally, we needed to make changes to how information is displayed. The current view of labels for Projects and SupaAgents are presented separately. We needed to have them on display side by side as it allows our BOMs to match our Projects and SupaAgents faster.

We started with looking for other programming languages, we initially looked at Typescript, C# as solutions. However, after taking a look at what other at scale tech companies were using as well and comparing the available languages from the criteria of succinctness, efficiency, performance, power, reliability and community support, we arrived at using Golang.

Why Golang?

Golang

Golang is a procedural programming language developed in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson at Google. It was launched in 2009 as an open-source programming language.

Golang fulfilled all of our criteria as well as having the bonus of being open source and the community that grew around it was a vibrant, welcoming and fun group.

Roadblocks faced while learning Golang

Golang is a new programming language within the engineering team. We had to learn it from scratch, from the concepts of how the language is built on to the actual application of it.

It was only natural that we faced roadblocks along the way…

1. Syntax

Golang syntax is new for a person with a background in python, ruby on rails and javascript, in terms of defining functions, manipulating arrays and defining classes.

Syntax

2. Golang’s representation of Object-Oriented Programming

Golang’s representation of Object Oriented Programming concepts in a different way so you have structs instead of classes and you can apply inheritance by embedding the parent structure inside child structure.

For example, to define a class in Javascript, C#, Typescript, you can use the keyword Class

class1

But on Golang it’s a different class represented by a data-structure called struct

class2

Another example is an inheritance, to inherit from a class in PHP, we can use the keyword extends

class3

In C#, we can use the symbol “ : ”

class4

But in Golang, you are embedding a struct into another one, ex:

class5

All in all, Golang is a solid programming language, providing simplicity, efficiency, speed, and reliability with less code to write. As I’ve just started my Golang journey, I have received large community support, so it’s easy to find an answer to any questions you may have. You can spend three to four hours to learn the concepts of the language, then you can easily start building applications because Golang provides a large pool of packages and frameworks to make your life easier, and the good thing most of (if not all) packages are open-source, so you can easily modify them to serve your needs.

Top comments (0)