110 likes | 126 Vues
Learn the basics of Ruby-on-Rails language from our experienced RoR developer.
E N D
Ruby Language Session 1
Websites built on Rails • Twitter • Basecamp • Hulu • SlideShare • GitHub • Shopify • Groupon • AirBnb
What is Ruby ? A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. - https://www.ruby-lang.org It was developed by Yukihiro Matsumoto (also known as Matz in the Ruby community) in the mid 1990’s in Japan. It is a pure Object-Oriented and an interpreted scripting language.
Say WHAAAAT ? OOP vs FP According to Wikipedia, OOP “is a programming paradigm is based on the concept of “objects”, which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. Functional programming is the form of programming that attempts to avoid changing state and mutable data.
Interpreted vs Compiled Ruby is an interpreted scripting language and is run directly without first compiling and generating the byte code. With a compiled language, code you enter is reduced to a set of machine-specific instructions before being saved as an executable file. Interpreted programs can modify themselves by adding or changing functions at runtime. It is also usually easier to develop applications in an interpreted environment because you don't have to recompile your application each time you want to test a small section.
Colour me curious. Installation • Windows : RubyInstaller • Ubuntu : Package manager • Mac : Pre Installed !!!
Let’s compare shall we Imagine you want to get the time one month from this very second. Here is how you would do that in Python and Ruby languages • Python from datetime import datetime from dateutil.relativedelta import relativedelta new_time = datetime.now() + relativedelta(months=1)
And in Ruby... • Ruby require 'active_support/all' new_time = 1.month.from_now
Let the magic begin Ruby files have .rb as extension Hello World Classes and Object Global variable Instance variable Class variable
Ruby basics Array Hash Range If..ElseCase Loops Methods
Thank You, Keep Learning. Space-O Technologies