Trying out Ruby [‘and’, ’on’] Rails

September 5, 2016    ruby rails

Ruby

I joined Altizon Systems in August and we have our backend primarily in Ruby on Rails. In the first week, I setup the environment and before directly going to rails framework I started looking for “Getting started with Ruby” guides.
Soon I realised the popularity of ruby is not overrated. Ruby is a beautiful language indeed, also one other thing I liked is that, it has much similarity with python. Since my first two task of GSoC were in Python, I have had a pretty good hands on it. 
These includes features like dynamic typing, exception handling, and object oriented nature. Ruby specifically enhances object orientated nature by allowing builtin method overriding and having syntax like 

3.times

where ‘3’ is an instance of Numeric class with value 3. 
Although everything I liked, one thing that bothered me is the optional functional brackets. So in ruby, consider a function brr with two integer arguments a and b. I can call the function as 

value = brr 2 4       

This is fine but if brr has no arguments and defined somewhere else then

value = brr

Seems to make me confuse and look for brr as a variable inside my file. I know this is not a very serious problem, but as a beginner it took me sometime to figure out these new things which I have not seen before.

Rails

I could only spend a little time on core ruby and turned to what actually we use; the popular Ruby on Rails framework. I have tried my hands at MVC frameworks before, in Golang to be specific and I really enjoyed it.   At that time I always wondered people saying that, ruby on rails has a very short development time and no doubt I experienced it very soon. The various command line utilities that rails comes with are awesome. This really shortens the building of Models and Controllers. Basically gives you a head start by generating simple code, which you can make complex by adding your specific requirements. Nice! 
But mind that autogenerated code always comes with some hidden logics that are very hard to find inside the code. Especially when you are a beginner like me, you come from other language backgrounds and codebase is large — there are 10+ models and even more controllers. Simple things such as a has many rule in rails which is used to associate a relationship among two models will automatically insert a ParentModelName_id field inside child model. This is perfectly right but I didn’t know these things and it took some time for me to figure this out.   Now it’s been a month and I am happy with ruby and/on rails experience. All these opinions are personal and no language wars intended. 

This journey has just started and let me know if have any suggestions for me.

That’s all folks.


blog comments powered by Disqus