Learn Ruby for Newbie

Jika ada yang ingin mempelajari ruby tapi tidak tau mulai darimana, bisa coba 2 link berikut ini:

http://tryruby.hobix.com/

http://poignantguide.net/

Link yang pertama merupakan bentuk interactive ruby shell (irb), dengan mencoba nya kita bisa mendapatkan sedikit gambaran bagaimana membuat program dalam ruby. Sedangkan yang kedua, merupakan book nya. Book tersebut luar biasa, penyampaian nya mudah di cerna dan mampu menunjukan bagaimana ruby itu sebenar nya.

Bahasa yang dibuat oleh orang jepang di tahun 1994 ini sekarang semakin menanjak kepopuleran nya, banyak digunakan oleh banyak programmer untuk menyelesaikan project nya. Terlebih lagi dengan ada nya ruby on rails yang di klaim mampu meng-handle banyak hal dalam web programming yang sebelum nya sulit ditangani oleh bahasa pemrograman seperti php. Di dunia security sendiri ruby banyak digunakan oleh banyak project, salah satu nya adalah metasploit framework. Exploit wordpress oleh LMH baru-baru ini juga menggunakan ruby, dan exploit nya David Maynor untuk exploitasi airport wireless milik mesin apple juga menggunakan ruby.

Ruby dapat mempermudah kita untuk mencurahkan isi pikiran kita dalam bentuk bit-bit komputer, mempermudah kita berbicara dengan sistem komputer untuk menghasilkan apa yang kita inginkan.

Read the following aloud to yourself.

5.times { print "Odelay!" }

In English sentences, punctuation (such as periods, exclamations, parentheses) are silent. Punctuation adds meaning to words, helps give cues as to what the author intended by a sentence. So let’s read the above as: Five times print “Odelay!”.

Which is exactly what this small Ruby program does. Beck’s mutated Spanish exclamation will print five times on the computer screen.

Read the following aloud to yourself.

exit unless "restaurant".include? "aura"

Here we’re doing a basic reality check. Our program will exit (the program will end) unless the word restaurant contains (or includes) the word aura. Again, in English: Exit unless the word restaurant includes the word aura.

Ever seen a programming language use question marks so effectively? Ruby uses some punctuation, such as exclamations and question marks, to enhance readability of the code. We’re asking a question in the above code, so why not make that apparent?

Read the following aloud to yourself.

['toast', 'cheese', 'wine'].each { |food| print food.capitalize }

While this bit of code is less readable and sentence-like than the previous examples, I’d still encourage you to read it aloud. While Ruby may sometimes read like English, it sometimes reads as a shorter English. Fully translated into English, you might read the above as: With the words ‘toast’, ‘cheese’, and ‘wine’: take each food and print it capitalized.

The computer then courteously responds: Toast, Cheese and Wine.

At this point, you’re probably wondering how these words actually fit together. Smotchkkiss is wondering what the dots and brackets mean. I’m going to discuss the various parts of speech next.

All you need to know thus far is that Ruby is basically built from sentences. They aren’t exactly English sentences. They are short collections of words and punctuation which encompass a single thought. These sentences can form books. They can form pages. They can form entire novels, when strung together. Novels that can be read by humans, but also by computers.

See?!I like how the author describe about ruby ;). And it’s worth to try on your weekend.

Advertisements

One thought on “Learn Ruby for Newbie

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s