Category Archives: Ruby

CPMA: jQuery Mobile/Rhomobile

In the name of Allah

Ten Things I Love About Ruby

بسم الله الرحمن الرحيم

I have been using Ruby and RoR (Ruby on Rails) for the past couple of years and here are some of the things that I really appreciate about the language coming from a Java background.

Oh BTW, don’t tell Java.

1. Culture

Ruby culture is fun and quirky. What other language has a comic book complete with soundtrack as a basis for learning the language and is full of obscure cultural references.

2. Simplicity

The syntax that ruby provides is very elegant and succinct. Java is anything but simple, it is incredibly verbose and there is a lot of boilerplate code. Now when I am writing something in Java I feel like I am running extra laps. Even the simplified syntax of the processing core api seems verbose next to ruby.

3. Rails

I have used PHP and CakePHP in the past and CakePHP is a great MVC framework but is as great of an experience in my opinion as rails. Add Devise, Zurb Foundation, Sass, Compass and others and you have a very tightly integrated environment to get started. rails db:migrate is just magical.

4. Pry

I might have put IRB here but Pry really solves a lot of the problems with IRB. But really, being about to experiment and run code on the fly, amazing. Pry lets you also do autocompletion, press . and get a list of all methods available, or an easy view of the ruby docs.

5. Gem

Although I think there is some validity in knowing how to build a unix app from scratch, I don’t really want to do that all the time. Gem is an easy to use package manager that even lets you install specific versions of a package. Just gem update then gem install somegem and you are ready to go. If you can think it up, there is probally a gem for that.

6. RVC

A one line installer that does so much more. Want to run Ruby 1.9 and ruby 1.8 and switch between them. No problem, Rvc lets you do that with ease.

7. Conditionals

Its amazing how much more readable Ruby code can be and I think a great part of that is the conditional structures that are available.

do this unless that
do this if that
unless that do this
if that do this

How come Java doesn’t have these structures. if (that != true) { //do this} seems so 1992.

8. No semicolons, parens (), or blocks {}

The indentation takes some getting used to, but I can’t tell you how many times I am missing a semicolon from a Java program. It can be inferurating. Also, getting unmatched parens and braces seems to just extraneous once you get used to ruby. I think a way to think about it is like how in English we drop all the words that can be assumed in a statement. Another benefit is white space and readability.

9. erb + rails server

The way that .erb works and with rails server is a very elegant solution for development. Basically a one line solution to run your server. I have worked with .jsp and tomcat in the past and lets just say, the ruby solution is much simpler for most development solutions.

Once you learn erb slim can be an even more elegant solution. Especially coupled with Zurb Foundation or Twitter Bootstrap.

10. Community

The ruby community is one of the most extensive around. If you have an idea of something you want to do that is web related, it is likely there is a ruby gem for that. There are meetups in most major cities, podcasts, and pretty much anything else you can think of. If you are die hard Java and have never given Ruby a change, I urge you. Check it out. Use it for a small project. You won’t be sorry that you did.

Do you use ruby? What are some the parts about the language or ecosystem that you love. Let me know in the comments.

Written by James Stone 4 days ago

Ruby for Newbies

بسم الله الرحمن الرحيم

Ruby is a one of the most popular languages used on the web. We’re running a Session here on Nettuts+ that will introduce you to Ruby, as well as the great frameworks and tools that go along with Ruby development. In this episode, you’ll learn about the testing your Ruby code with Rspec, one of the best testing libraries in the business.