From Ruby To Erlang. Beginner's mistakes

I’ve been programming full-time using Erlang for a while already (about eight months or so). Before Erlang, I was doing some hardcore Ruby. Obviously, these are very different languages: OOP vs functional, mutable vs immutable and so on. Also, there are things you won’t find in Ruby (the opposite is also true).

In this post I want to show you the mistakes that I’ve made and the lessons that I’ve learned during the transition.

»

Разрабатываем ruby gem в docker контейнере

Контейнеры захватывают вселенную, и ничего с этим не поделаешь. Несмотря на то, что я являюсь старым приверженцем Vagrant’а, на днях мне все же захотелось попробовать docker для одного из своих проектов - Valle. Не без препонов, но все же удалось встроить docker в процесс. Далее последует руководство по разработке Ruby гема с использованием docker’а.

»

Shamrock

Бывают случаи, когда WebMock’а недостаточно, или же вы просто не любите stub’ы и хотите, чтобы тест делал реальный http запрос. В таких случаях вы можете написать свой простенький http сервер или выбрать один из существующих, и стартовать его на время тестов(а). А можно взять готовую библиотеку - Shamrock.

»

Don't do this at home on Rails #3

  • Languages: Ruby
  • Difficulty: Easy

A lot of time has passed since my last post, so I decided to fix this little drawback. Next, we will discuss three small pieces of code, which smells not very good. Let’s see what we can do about it.

»

Null migration, or What to do when there are too many migrations

Migrations are probably one of the most killer features of ActiveRecord. They allow you to design the architecture of the database along with the growth of your project. If you change your data model (Domain Model), you reflect that change in code and write a migration (or several migrations), which will make the necessary actions on your database schema. This may be creating a new table, deleting a column or adding an unique index.

»

Don't do this at home on Rails #2

  • Languages: Ruby
  • Difficulty: Easy

Intro

Now is the time to break down the next three examples of code that look slightly chapped, and just beg to be retouched. Despite the apparent complexity, by running a series of easy refactorings, we can significantly improve the code: reduce the size, improve the readability and even increase its speed. Who knows?

»