Image for post
Image for post

The idea of using service objects came into my mind when I first read about the DCI architecture in Clean Ruby.

The paradigm separates the domain model (data) from use cases (context) and Roles that objects play (interaction). DCI is complementary to model–view–controller (MVC). MVC as a pattern language is still used to separate the data and its processing from presentation.

As the book and the quote from Wikipedia suggest, using this architecture in our code makes our models only contain data (we will even migrate data validations to service objects) and controller actions just call one of these interactions and render the result. …


Image for post
Image for post

One of the things I always pay attention to in the dev teams I worked in, is how much they care about code formatting. For me, it’s important to have a codebase that follows a predefined guideline for code formatting. For example, I don’t like if someone uses two space for indention and another one uses four spaces or even tabs.

There are already some guidelines that you can follow to have a more consistent codebase. For example, Airbnb ruby style guide or Rubocop community-driven style guide. …


Image for post
Image for post

Here at twopluszero, we’re happy with using Next.js as our front-end application framework. Next solved our largest problem in developing SPAs easily: Server Side Rendering!

But as we go further, we should solve other problems to make our applications work fast and smooth. One problem is requiring images in JavaScript files. This is a most have feature specially in static pages like landing pages.

Here are some of our expectations when requiring images in js files:

  1. Add link to the image automatically when requiring the image. Consider the following example:
<img src={require("./test.png")} />

It should replace the require statement with the link to the image. …


Image for post
Image for post

After almost 2 years, 4k commits, over 50 pre-releases, and a lot of help we are excited to announce the release of Babel 7. It’s been almost 3 years since the release of Babel 6! There’s a lot of moving parts so please bear with us in the first weeks of release. Babel 7 is a huge release: we’ve made it faster, created an upgrade tool, JS configs, config “overrides”, more options for size/minification, JSX Fragments, TypeScript, new proposals, and more!

JavaScript is great. It can handle IO intensive tasks easily. It has a nice and friendly syntax and whatever you use it more, you’ll love it more. Each release brings new features to the table. But it takes time for runtime environments like NodeJS to implement those features. Luckily Babel is here to the resque! Here we want to help you create a basic project and configure Node to use Babel to transpile new features to already supported syntax. …

About

Aref Aslani

Senior RoR and JavaScript developer

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