From Java to Ruby

A quick dive into Ruby on Rails

With main focus on Java and Python since my Bachelor's it was very exciting when there was an opportunity for me to learn something new, something I hadn't remotely worked on.

You could say I have a special space for Java, having written so many APIs for so long now but Ruby felt like a breath of fresh air. It was so refreshing to see how so little could do so much.

Although they're both based on object oriented principles Ruby seems like a laid back person while Java seems more tightly wound. But of course, they have their own advantages over each other.

  • Ruby can clearly do what Java can with fewer lines of code. This is something that could make developers work easier increasing the speed of development and debugging as well!
ruby-meme
  • Ruby comes with an interpreter and won't need to be complied.
  • Having said that, Java will execute the code faster because of the Java Virtual Machine which converts java bytecode into machine code making the execution faster.
  • Java and Ruby can be used together and they complement each other.

Now, coming to Ruby on Rails which is a server-side web application framework written in Ruby. Learning Ruby on Rails has been so much fun. Ruby on Rails works on MVC architecture, Model-View-Controller.

  • The model is responsible for maintaining the state of the application.
  • The view is responsible for generating a user interface, normally based on data in the model.
  • Controllers handle the user interface and application

The main thing that stands out about Ruby on Rails development is that it chooses convention over configuration- knitting of MVC (Model - View - Controller) is done by intelligent defaults and no need of external configuration. This makes sure the developers don’t have to spend a lot of time configuring files in order to set up instead Rails comes with a set of conventions which helps to speed up the development process. With just a few commands I had a somewhat working webpage ready!

Looking back, I can't help but wonder what it would be like to have the power of Java and the simplicity of Ruby on Rails. Say hello to JRuby!

jruby-logo

This has the ease of programming with ruby and the performance of the JVM.

JRuby allows Ruby applications to be run within a Java Virtual Machine and interface with libraries written in either Java or Ruby.

JRuby can integrate with Java code. If you have Java class libraries (.jar's), you can reference and use them from within Ruby code with JRuby.

java-meme

JRuby does look interesting to me, this is something I would probably look into later on. But here's a link below if you'd want to know more. http://rubylearning.com/satishtalim/jruby_tutorial.html

All in all, this learning experience has been so pleasant. In my opinion if you are a Web Dev beginner, Ruby on Rails would be a good place to start :)

Cover Photo by Ludwig Wallendorff on Unsplash (https://unsplash.com/photos/XiylT38u5mQ)

View all posts tagged as