gRPC: what is it? An introduction...

The first time I heard about RPC, I was in a distributed systems class while completing my bachelor’s in computer science. I like it but didn’t fully understand why I should use it instead of REST. Time passed, and I started working at a company where the legacy services use SOAP. I remember thinking: “hm, that’s cool! It is like RPC but using XML instead! Years later, I heard for the first time about gRPC, but I’ve never fully understood it until now!

[Read More]

The importance of tech docs

When I chose to pursue a career in computer science when I was 15 years old, it was basically on liking math and physics. I want to distance myself from writing posts, essays, etc. Time goes by, and now, one of the things that I value at a mature company or team is the existence of technical documentation.

Docs help us to gain historical knowledge of our company, reevaluate decisions, and comprehend the trade-offs between all the decisions. It is also beneficial for the newcomers because it tells them a story. The richer in detail it is, the better it is.

[Read More]

Circuit Breaker in Go apps

Today it is common for our applications to have a couple of dependencies, especially when working in a microservice environment. It isn’t rare when our app reports errors, we find out that one dependency is down.

One good practice for improving our resilience is to shut down the communication with those apps that are not behaving well. Looking into other fields, we learned the concept of circuit breakers from electrical engineering, where a switch turns off when a failure happens. In Brazil, all houses have these switches that automatically shut down if our electric network becomes unstable.

[Read More]

Building a Sliding Puzzle with Go

Building a game is an excellent way of starting programming. Tons of people have started programming because they wanted to create computer games. Even me, back in 2010, had one of my first projects to write a small game when I was still in my Technician course.

In this course, we used Python to develop a slide puzzle. It was very challenging because I had to learn about the game mechanics and GUI, but I could handle the project. When I started to work with Ruby, I also built one to compare with what I did with Python.

[Read More]

First steps with Go linters

Linter is a static code analysis tool used to find programming errors, bugs, leaks of code standards, and even security flaws. These tools help developers because they save time by identifying issues before they happen in the production environment. It also keeps developers from unnecessarily checking if your colleague used the team standards.

Each programming language has their own tools: Ruby has Rubocop , JS has Eslint , and Go can’t be different. Searching at Awesome Go , a curated list of Go software, many tools can lint your code, but my favorite is golangci-lint . It is an aggregator of linting tools, meaning you only need one tool for multiple linters in your project.

[Read More]

Introduction to templating with Go

Computer and programming languages were born to make our lives easier, as they automatize day-to-day tasks. Programmers and software engineers usually have to build files that are almost the same as others, where the only change is one field or another. For example, there are configuration files, invoices, XMLs, HTMLs or any file which we can use to build other files. There is a simple solution for this problem: we can create a template and change the parts that I need manually! That works, but it is not the best way to deal with the problem because it is scalable. We can use technology to help.

[Read More]

Writing Kong plugins with Go

The Kong, quoting its own documentation , is an open-source API gateway, cloud-native, platform-agnostic, scalable API Gateway distinguished for its high performance and extensibility via plugins. Kong has a lot of official plugins that allow us to customize what we need, and when there aren’t any available, you can build your own.

The default language for building plugins its Lua, but other languages are supported, including Go. I don’t have much experience writing code with Lua, so using Go allows me a higher development speed and quality on my plugins.

[Read More]

Introduction to Concurrency in Go

One of the best Go features is how easy we can use concurrency. The language gives us goroutines, which are like lightweight threads managed by the Go runtime. It help us to run several functions at the same instant and is very helpful if you wish to improve the performance of your application.

Using this feature is easy as adding the go keyword before any function call. This will make the function run concurrently. To make it simpler, let’s show you the code. Here I’ve written the SleepSort algorithm, which uses the sleep method to sort each element in its place.

[Read More]

RSA in Ruby for beginners

Introdução

RSA is a public/private encryption algorithm and it is based on the difficulty of the factorization of the product of two large prime numbers. It was named after its creators Rivest, Shamir, and Adleman.

It is an expensive algorithm, computationally speaking, and because of this, it is not common to use it directly, but it is still widely used in the market and is one of the most important encryption algorithms. As an example, OpenSSL implements this algorithm for generating keys and it is commonly used for encrypting SSL certificates or SSH keys.

[Read More]

Implementing the Caesar Cipher in Ruby

Caesar cipher is the simplest and most widely known encryption technique. It is also known as Caesar’s cipher, shift cipher, Caesar’s code, Caesar shift, or ROT N (ROT13 is the most famous one, shifting letters by 13).

It is very simple because it just works for letters between A and Z, ignoring all special characters, such as dots, whitespaces, question marks, and special letters, like Ç or Á.

Starting our implementation, we need to create a class that will know what we want to cipher and how many rotations we will do.

[Read More]