Image for post
Image for post

There are many software design principles that you, as a developer, can learn and study. In this article, we are going to take a look at 5 key principles that make up the acronym SOLID.

These principles are meant to make the architecture of an application more flexible, scalable and maintainable. Implementing them in your work can also increase the overall complexity of the project.

Alright, the SOLID principles are the following:

  • Single Responsibility Principle
  • Open/Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

Single Responsibility Principle

This principle establishes that a class should only handle one specific part of the…


Learn how to leverage the power of interfaces

Image for post
Image for post

Interfaces are tools to define sets of actions and behaviors. They help objects to rely on abstractions and not on concrete implementations of other objects. We can compose different behaviors by grouping multiple interfaces.

In this article we are going to talk about interfaces in Golang and how to use them.

What Is an Interface?

An interface is a set of methods that represent common behavior for different data types.

With interfaces, we can organize different groups of methods that apply to different types of objects. …


Image for post
Image for post
Photo by mali maeder from Pexels

Ruby as many programming languages can create objects that we can use to store properties, methods and perform operations on them. In Ruby, everything is an object, strings, integers, boolean, hashes, arrays and instances of a class.

Each object has a bunch of public methods that we can use. In this article, we will focus mainly on one method — Object Id.

For every object, Ruby offers a method called object_id. You guessed it, this represents a random id for the specific object. This value is a reference of the address in memory where the object is store.

Every object…


Examples with Ruby programming language

Image for post
Image for post
Photo by Garrett Morrow from Pexels

Inversion of control is a principle in Software Development that sometimes could lead to some confusion.

In this article, I’ll explain what Inversion Of Control means, the power of this principle, the benefits of it, and the close relation with Dependency Injection.

This principle states that you should invert the flow of control within your modules, by using another concept that is Dependency Injection. That way we can invert the control by injecting dependencies into your classes and making them work with different types of objects.

This in turn allows your superclasses and subclasses to depend on abstractions and not…


Start writing dynamic code

Woman typing on laptop
Woman typing on laptop
Photo by Vlada Karpovich from Pexels.

Writing dynamic code can be difficult sometimes. Fortunately, Ruby supports metaprogramming, which allows you to write code that will write more code for you on the fly.

Metaprogramming is a powerful technique when it comes to creating classes or methods and calling them dynamically, which also makes your code DRY. The downside of using metaprogramming is that it is much more expensive than writing normal code, and in my opinion, you should only use metaprogramming when there is no other way to solve the problem or accomplish what you want.

In this article, we are going to talk about how…


Encapsulate complex queries using the power of views.

Image for post
Image for post

Postgres offers two types of views, normal views and materialized views. Both can solve similar problems that are related to encapsulation, abstraction, and speeding up performance.

It is worth mentioning that views and materialized views are not only available when using Postgres as a database, almost all relational databases have support for using views and materialized views.

Let’s defined first what is a view in Postgres.

Views

A view is a set of SQL queries, that can be treated as a table. …


Image for post
Image for post

In this article, I’ll cover a gRPC call using a Bi-Directional Streaming — implementing a client that will send a stream request, and a server that will respond with streaming messages.

This is the last article of the series, if you haven’t checked them out, here is the list:

  1. How to Make Effective Unary Calls
  2. How to Make Client Streaming Calls
  3. How to Make Server Streaming Calls
  4. How to Make Bi-directional Streaming Calls

In a bi-directional streaming rpc call, both the client and the server sends multiple messages to each other. Using this type of rpc call, can be a…


Image for post
Image for post

In this article, I’ll cover a gRPC call using Server Streaming response— implementing a client and server Go applications.

This is the third article of the series:

  1. How to Make Effective Unary Calls
  2. How to Make Client Streaming Calls
  3. How to Make Server Streaming Calls
  4. How to Make Bi-directional Streaming Calls

In a server streaming rpc call, the client sends a single request, and the server responds with a stream of messages. …


Image for post
Image for post

In this article, I’ll cover Client Streaming gRPC calls — implementing a client and server Go applications.

This is the second article of the series:

  1. How to Make Effective Unary Calls
  2. How to Make Client Streaming Calls
  3. How to Make Server Streaming Calls
  4. How to Make Bi-directional Streaming Calls

In a client streaming rpc call, the client sends a bunch of requests and once it is done streaming, the server will return a single message.


Image for post
Image for post

In this article, I’ll explain how to make a Unary gRPC call — implementing a client and server Go applications.

This is the first article of the series:

  1. How to Make Effective Unary Calls
  2. How to Make Client Streaming Calls
  3. How to Make Server Streaming Calls
  4. How to Make Bi-directional Streaming Calls

First of all, let’s define some core concepts before starting with the implementations.

gRPC

Stands for Remote Procedure Calls, and it’s an open source framework that was developed by Google with the intend of creating a faster and more effective protocol for sending and receiving data over the wire.

Yair Fernando

Passionate and motivated software developer. RoR | Go | JavaScript | React

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store