26/08/2018 SargantanaCode Hey, what's up, Ruby on Rails!?

Hey, what's up, Ruby on Rails!?

Although you may not have noticed, the website of the SargantanaCode project has changed radically. Until this weekend this website was developed with PHP, using the Symfony framework (you have access to the code in our old GitHub repository). Ok, why beat around the bush if the title already makes you a spoiler: hey, what's up Ruby on Rails!?

I had planned to improve the sourcecode of the web, because it wasn't as good as I would like… Thinking what and how to do it I also thought that it would be better to change the language for one that I liked more and take the opportunity to learn another framework. My first idea was to do it with Python and with the Django framework. I know Python and I love it: the language, its syntax, its official conventions guides, the simplicity with which complex things can be done… Caution, personal opinion: but one thing is Python, and quite another Django.

I started to learn about working with Django, transforming the ideas of my head and everything I wanted to implement to Django code and the best way to structure it. I also wanted to focus on TDD (Test Driven Development) and especially in acceptance tests, because in the previous code I had some unit tests to test the models and nothing else. I know I'm missing a lot of tests to implement, between the lowest level (unit) and the highest level (acceptance), but I'm on the way. At the moment for this project I think it's enough.

And what happened after so much research? I wanted to die slowly and painfully. Honestly, doing TDD with Django is a headache. And for the acceptance tests… Well, you had to deal directly with Selenium and this didn't seem too attractive to me. In addition, the Django-tests syntax is rather similar to the precious and readable that Python syntax pretends to be…

And by chance I discovered Rails. Searching on YouTube how to do something simple in Django without success I came across a video that explained how to do that in Rails. I could not believe it: super simple, super easy, readable and well ordered. I have to say that I like Python syntax more than Ruby's one (maybe stop using { and } to start using do and end wasn't the best idea…), but I think the work done with Ruby on Rails is better than the one done with Django. And although I think Ruby doesn't have as much magic as Python, and it's far from having official style conventions or guides like Python's PEP8, I fell in love with this framework. So I didn't think about it anymore: I forgot Django to focus on Ruby on Rails.

And after this making of about how I met Rails, I'll tell you that this adventure has given me the opportunity to learn how to work with Rails (thanks Captain Obvius!), but I think that in some points of development in a deeper way, beyond the things that are usually learned when you learn how to use a framework… It has also made me known RSpec (one of the testing tools in Ruby) and Capybara (an acceptance tests tool; a kind of Selenium abstraction layer). Surely at some point I will write here at least part of what I have learned, so all of you can learn it more easily than reading the official documentation (although this is always a great way to learn).

In the visible part, let's say the application frontend, it's almost identical. Some details have changed, the CSS has some improved parts but most is at the code level, because I tried the design was the same, I'm happy with the design as it is and I didn't want to change it at this time because I just wanted to change the backend. The biggest change in styles may be that instead of adding the -webkit or -ms prefixes that some browsers need to correctly visualize some more recent CSS features by using mixins in Sass now I write it without prefixes and that's what the autoprefixer for postcss plugin takes care of.

The experience has been great, using summer to learn something self-taught is always great and very satisfying. And you know guys, as we always say here at SargantanaCode: never stop programming!

Javi Palacios

Javi Palacios


Computer Padawan and real reader enthusiast. The first day that I code I knew that I wanted to continue programing for the rest of my life. Compiling things on Linux since 2003 and enjoying the stability of macOS since 2006. Free software and technology lover.

New comment

Enter your name and email to comment, or sign in and these fields will be filled in automatically