Writing Domain Specific Langauge(DSL) in Ruby – Day 1

Domain Specific Language In Ruby

After Object Oriented Programming leveraged the power of coders and programmers to do more ; a bunch of programmers started wondering about exploring the boundaries more where they can define their own language on top a language which does the same stuff with much higher flexibility which is when the term –   domain-specific languages (abbreviated DSL) came up.

Assume you are writing a  Coffee Placing Order Machine in Ruby and lets see how you would have liked to express it.

CoffeeMachine.orders do |place_order|
  place_order.mega.coffee
  place_order.strong.expresso
  place_order.extraLarge.cappuccino.sugarless.halfCup
end

Wow, I bet if you could express that way to write a program you would have realized how powerful it would be! Why DSLs?

  • Expressive (True Nature of High Level Language)
  • DRY (Don’t Repeat Yourself)
  • Lesser Code More Flexibility
  • Scalability in terms of Functionality
  • Highly Modular

Continue reading

Creating Social Network on Ruby on Rails – Day 1 – System Setup

Getting started

If you have come here then I am assuming you have some basic knowledge of Ruby,and Linux Commands if not I suggest you to follow some basic tutorials on Ruby Programming Language before proceeding forward. A lot of tutorials and official documentations and screen casts are available on the net for learning Ruby.As for Linux commands it comes with little read up easily :)

Moving on, this is DAY 1 in learning to build a full fledged Social Network on Ruby on Rails platform. As with DAY lesson you would slowly build up a running version of your Social Network, at end of each episode I would provide the incremental source code at the bottom, so that you can relate to it. Lets get started! Shall we?
In Day 1 we would set up our  Environment for Development

( I am using Ubuntu 11.10 Oneric )

Let us begin!

Continue reading