Download presentation
Presentation is loading. Please wait.
Published byJerome Foster Modified over 8 years ago
1
Presented By P.SRIVIDYA 085D1A0552 Programming Language
2
I NTRODUCTION Pure Object Oriented language Highly portable, works on Linux, UNIX, DOS, Windows 95/98/NT/2K, Mac, etc. Freely available and open-source. More popular than Python in Japan, probably b/c it handles multibyte character sets so easily. Syntax is readable and easy to learn.
3
T HE H ISTORY OF R UBY Ruby was written by Yukihiro Matsumoto A Japanese computer scientist and software programmer, whose hobbies include computer programming and compilier design.
4
R UBY : THE L ANGUAGE No multiple inheritance, but modules allow the importing of methods. Has garbage collection. Exception handling, like Java. Any class or instance can be extended anytime (even during runtime) Allows operator overloading.
5
R UBY : THE L ANGUAGE Can be extended with Ruby or low-level C. No type declaration. Has iterators, methods which accept blocks for user-defined control structures (like loops) Emacs, TextPad, and Vim all have support available for Ruby.
6
W HY IS R UBY SPECIAL Easy to use scripting language with a lot of scope for deeper programming paradigms. For example Ruby can be used procedurally. #!/usr/bin/ruby print “Hello World\n” Or in an object oriented manner. Even full stack web applications development environment, Rails.
7
W HAT IS R AILS Rails is a web application development framework, written entirely in ruby. Rails is packaged as a ruby gem package “rails-1.1.6.gem” Once “ruby” and “rubygems” are installed rails can be installed using a single command, gem will get all of rails dependancies.
8
R UBYS P EDIGREE Ruby is a child of Python, Smalltalk, Eiffel and Perl. Ruby was introduced in year 1993. It became Ruby 0.95 in year 1995. It became Ruby 1.1 alpha 0 in year 1997. It became Ruby 1.3.2 in year 1999. It became Ruby 1.6.1 in year 2000, and has not changed much since that time.
9
R UBY AND HER A NCESTORS
10
O THER M EMBERS OF THE R UBY FAMILY Several other tools exists within the ruby/bin directory ri – ruby information on classes, methods rake – A make tool for ruby gem - A Package management tool irb - Interactive Ruby Shell erb - Embedded Ruby scripts for Ruby active server type pages.
11
R UBYGEMS Ruby packages are generally distributed as gem files, i.e “activerecord-1.14.4.gem” except for “rubygems” which is the package management tool.
12
R UBY I NFORMATION RI AND RD OC “ri” provides information on ruby classes RDoc generates HTML and ruby information. “ri” displays information about classes A browser can also be used to view generated HTML class documentation.
13
R UBY V S J AVA / C++ Ruby “Ruby”.length -5.0.abs C++ / Java strlen(“Ruby”); s.length(); abs(-5.0); number = Math.abs(numbe r);
14
A DVANTAGES USING R UBY AGAINST J AVA AND C++ Allow pass by code block Support Regular Expression Cleaner code No need to declare variables Simple syntax (semi-colon is optional) Every thing is an object, even a number. No need to call separate function. Simple object get/set methods declaration
15
A DVANTAGES ( CONTINUE ) Classes and modules are never closed. Better Access Control Dynamic access control Private methods never accessible directly by another object Portable and extensible with third-party library Interactive environment
16
D ISADVANTAGES USING R UBY AGAINST J AVA AND C++ No multiple inheritance However, Ruby offers multiple- inheritance-like capabilities Ruby is a scripting language However, Ruby can access to OS features, do same thing as Perl and Python
17
D ISADVANTAGES ( CONTINUE ) Different syntax and method definition style Return statement is optional Use of expression interpretation Braces not needed in control statements (if, while) Instance variable must preceded by “@” Potential thread starvation in multi- threading Use in-process thread [non-native] However, it is lightweight and efficient
18
R EFERENCES “Programming Ruby” “The Pickaxe book”, Dave Thomas Ruby online tutorial, via your web browser http://tryruby.hobix.com/ Also O’Reilly’s “Ruby Cookbook”, good for getting ideas. Ruby’s home http://www2.ruby-lang.org/en/ Ruby on Rails’ home http://www.rubyonrails.org/
19
C ONCLUSION Free download for Unix/Windows Applications includes: X11 window manager, GUIs, managing server machines and databases. Want to know more: Visit http://www.ruby-lang.org
20
THANK YOU!!!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.