Image for post
Image for post
A Reflection on Coletiv’s Culture and What Keeps Me Here

Throughout my career, I have worked in several companies. From consultancy based businesses to product companies, from small and medium-sized companies to big corporations. In each of them, I only stayed for a maximum of 2 years, and after this time, I always felt I needed a change. But not now! So, I started thinking: what is keeping me here?

Let’s first start analyzing what led to my discomfort in previous companies I have worked for and later down the road to the switch.

Biggest reasons that led me to leave my previous companies

Salary

Many people say: “Money isn’t everything in life” and they are right. But although money isn’t everything, it plays a very important role in our current society. Everyone has bills to pay (e.g.: mortgage, rent, food, transportation) and objectives to fulfill (e.g.: buy a house, have a comfortable retirement time, travel), good luck doing all this without money…
Another related point that made me change was not the fact that I felt I should be earning more, but the fact that I always had to beg about salary raises. I think that salary raises should be given as an acknowledgment of your good work and contribution to the company and not a fight you need to put up.


Currently, if you need to use Enum.sort on your Elixir project and want to sort lists by date, you may experience problems depending on the Elixir version you are using.

Image for post
Image for post
Elixir — Sort Lists by Date

Recently, while working on a project at Coletiv, I needed to sort a list containing structs by their creation date.

iex(2)> items
[
%{id: 2, inserted_at: ~D[2019-01-01]},
%{id: 1, inserted_at: ~D[2018-01-31]},
%{id: 3, inserted_at: ~D[2020-03-01]}
]

First Try

My first approach was to use the Enum.sort function and compare the struct’s inserted date property:

[…]|> Enum.sort(&(&1.inserted_at > &2.inserted_at))

After some tests, I found that the sorting was not working. …


Image for post
Image for post
How to use AWS Cloud​Formation to setup the infrastructure for a static website

Being a software engineer by heart I am a big fan of automating any recurring manual task.
Every time we would develop a static website I would need to manually setup the whole infrastructure for it to work properly. This was a very repetitive and tedious task that we wanted to automatize.
In this article, you will find our approach using
AWS CloudFormation.

Our usual infrastructure architecture is as follows:

Image for post
Image for post
Static website hosting with S3 and CloudFront

S3Bucket — Hosts the deployed code

ReadPolicy & CloudFrontOriginAccessIdentity— Grants read rights to requests to the S3Bucket requests coming from Cloudfront

CloudFrontDistribution — Handles requests to the website and retrieves the requested page from the…


Image for post
Image for post

One of the abstractions Elixir provides around processes is the GenServer module. A GenServer is a process like any other Elixir process and it can be used to keep state, execute code asynchronously and so on.

Recently, while using Elixir processes (specifically GenServer), I found myself facing an issue that often occurs in other programming languages: the dreaded memory leaks.

Use Case/Problem

Basically, I have an application that when started initializes multiple GenServers in parallel that makes multiple calls to externals API’s. The processes execute work every 5 minutes and have short-lived data.

Initially, I did not found problems but with the increase in the number of processes, I’ve checked that each process has unnecessarily data stored in the memory after the first run. …


Image for post
Image for post
Source: https://ferd.ca/the-zen-of-erlang.html

I started my software development career as a Java developer and it had been my language of choice until December of 2016, which was the time when I decided to join Coletiv and started coding in Elixir 😀.

With Java it’s possible to use processes and parallelize them but it isn’t common and it’s always a struggle. One of the use cases I used processes for was when I had to process a big amount of data in a reduced timeframe, but as a rule of thumb, I avoided them as much as I could.

With Elixir I found another world that, citing Bruce Williams, doesn’t treat concurrency and process management like afterthoughts or advanced features. …


Image for post
Image for post
Elixir with Ecto

A University of College London study discovered something we all knew: humans are lazy. Meaning that most of the times, when we have a problem we take the easiest way to solve it. But it doesn’t mean we are solving the problem right away.

You might ask yourself, what does this have to do with Elixir and Ecto? Well, at Coletiv we have been working on a project where a user can manage multiple projects and a project can be managed by multiple users, this is a trivial case known as many to many.

In terms of database diagram/structure, I created both user and project tables, plus the so-called Many to Many table (user_project), as the diagram below illustrates. …


Image for post
Image for post

This is the first article of a 2-part series, where we explain in full how to automate your Elixir project’s deployment. The technologies used are AWS, to host your project, and CircleCI, to automate the testing and deployment of the application.

Part II — How to automate the deployment of your Elixir project with CircleCI

AWS Configuration

A basic AWS configuration for your application should consist of various interconnected services, of which EC2 is the most important, as it will host your project and you will be interacting with it quite a lot.

Additionally, we use RDS for the database and Route 53 for the domain management, along with some other minor useful tools. This tutorial is divided into various sequential steps that explain how to fully configure these services, so that you can have a fully working infrastructure you can deploy your code to. …

Nuno Marinho

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