Just a quick note.

I’ve decided to set up my blog with Jekyll, and I’ll be posting there from now on: https://joaquimadraz.com.
I’ve been working on a personal project, and I want to post some articles about it that have some code in it. Medium is awful for that.

I’ve decided to start from the end and talk about the deployment process of an Elixir/Phoenix app — Guide to deploy an Elixir/Phoenix app to AWS ECS.

Moving out from Medium means losing the notification when something gets published so I’ve set up a TinyLetter account to send an email when I publish something. Here’s the link tinyletter.com/joaquimadraz.

See you one the other side.

My tip for a good team culture

T hree years ago I started working with a bunch of awesome and intelligent people. I know that now, but at the time they were strangers to me and with much more knowledge and experience. That, plus the fact that I was learning a new language (Ruby) and multiple technologies, was a motive for lots of questions.

Like every newcomer, I was trying to show that I knew how to do things and show how I manage to find answers to problems. …

Validations easy to build and read

A couple of months ago I started a new side project with Sinatra and after working with Grape to build APIs at work, there was one thing that I really wanted to bring to Sinatra, and that was Grape’s params coercion and validation.

In another article I wrote this note:

In our micro services, most of the times we have two kinds of validations: API Validations and Use Case Validations. API Validations are used to ensure that you send all the required data with right types to the endpoint, when it fails the server replies with a 400 bad request.

Why it became a good practice

After a feedback from another article, I‘ve realised that there’s more to say about validation extraction from ActiveRecord Models.

At linkedcare we’re building an EHR system and with time we realised that our Models we’re becoming huge, not only because we were putting a lot of business logic on it, but also because validations we’re growing feature by feature. With the shifting of business logic to separated classes, validations were extracted too and it couldn’t make more sense.

Let’s say we have a Blog (I know… It’s always a Blog) and there are two types of users: Writer and Admins…

Quick tip

I wanted to create an internal gem that only exposes a rake task to share with my colleagues at linkedcare. We are not using Rails for most of our projects, it’s mostly Sinatra and Grape, so I needed a wider solution than Railties.

Lets create the gem:

bundle gem internal_task

Then we will need the DSL to create the task.
This DSL that you are already familiar with, is given by Rake::DSL module.

On your lib/internal_task.rb, extend the Rake::DSL module and you will be able to create your task:

And that’s all.

Add it to your Gemfile and require it on your Rakefile.
Run the task with:

rake internal_task:hello

This example is on github, feel free to clone and test ☺

If you have any questions you can reach me via twitter @joaquimadraz or email joaquim.adraz[at]gmail.com.

The Use Case Layer

[ part 1 | part 2 ]

For a couple of years now a topic has been recurrently subject to discussion amongst myself and my colleagues, the Uncle Bob’s Clean Code Architecture.
After some iterations, I’ve managed to get a more clear and pragmatic view about this subject and now it’s time to share.

With help from Uncle Bob’s diagram let me explain the big picture behind this architecture.

Image fromUncle Bob’s Clean Code Arquitecture Blog Post — http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html

Starting from the inside. The inner circles tend to be more abstract and higher level than the rest. Inner circles do not know about outer circles and can’t communicate with the…

ho… hi!

So.. Hi there! My name is Joaquim and I’m a software developer. Currently working in Lisboa, Portugal, at the awesome engineering team of Linkedcare \m/

I’ve created this blog because there are so many things that I been learning since I join the ruby community, that I really need to keep all the stuff I’ve learned in one place and a blog like medium is the right place.

twitter — @joaquimadraz and gitbub — https://github.com/joaquimadraz

Joaquim Adráz

crafting ruby, js & elixir

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