1 Getting Started with Ruby. 2 What’s Ruby? Ruby is an OO, dynamic, agile language –Everything’s an object For example, try puts -1.abs –Derives strengths.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Introduction to Ruby.
Advertisements

Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Language of the Month If it’s December, it must be Ruby! Adam Coffman and Brent Beer.
Bioinformatics is … - the use of computers and information technology to assist biological studies - a multi-dimensional and multi-lingual discipline Chapters.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Server-Side vs. Client-Side Scripting Languages
Using Visual Basic 6.0 to Create Web-Based Database Applications
Creating Web Services with Ruby on Rails Robert Thew Internet and Web Systems II.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
Page 1 Ruby by Tim Hanson & Mamadou Seck. Page 2 Philosophy "I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming,
Guide To UNIX Using Linux Third Edition
String Escape Sequences
Java web development Servlet & Java server pages.
Introduction to Ruby CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 03.
Ruby (on Rails) CSE 190M, Spring 2009 Week 1. The Players Kelly "Everyday I'm Hustlin' " Dunn Kim "Mouse" Todd Ryan "Papa T" Tucker.
Introduction to Python Dr. Bernard Chen Ph.D. University of Central Arkansas July 9 th 2012
Javascript and the Web Whys and Hows of Javascript.
A TOUR OF RUBY 2011 ACM Class, Dong Xie. What is Ruby?  Dynamic programming language  Complex but expressive grammar  A core class library with rich.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
SCRIPTING IN RUBY By Amber Bennett “Ruby is simple in appearance, but is very complex inside, just like our human body.” --Yukihiro Matsumoto.
Introduction to Python
Using Visual Basic 6.0 to Create Web-Based Database Applications
Ruby! Useful as a scripting language – script: A small program meant for one time use – Targeted towards small to medium size projects Use by: – Amazon,
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Ruby! Ronald L. Ramos. What is Ruby? Ruby is a scripting language designed by Yukihiro Matsumoto, also known as Matz. It runs on a variety of platforms,
Putting Applets into Web Pages.  Two things are involved in the process of putting applets onto web pages ◦ The.class files of the applet ◦ The html.
Ruby. Who am I? 1- Bunlong Van 2- Sreyleap Lay, 3- Chhon Meily Blog:
POS 406 Java Technology And Beginning Java Code
Ruby on Rails. What is Ruby? Programming Language Object-oriented Interpreted.
A very basic overview of Server-Side Scripting Or what is PHP, Perl, Python, Ruby and what can they do for me?
Trends in Scripting Languages History For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Chapter 6 Programming Languages (1) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Chapter 0 Getting Started. Objectives Understand the basic structure of a C++ program including: – Comments – Preprocessor instructions – Main function.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
RUBY by Ryan Chase.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Scripting with Ruby What is a scripting language? What is Ruby?
ELEE 4303 Digital II Introduction to Verilog. ELEE 4303 Digital II Learning Objectives Get familiar with background of HDLs Basic concepts of Verilog.
PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are.
Python Let’s get started!.
12. MODULES Rocky K. C. Chang November 6, 2015 (Based on from Charles Dierbach. Introduction to Computer Science Using Python and William F. Punch and.
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Pyragen A PYTHON WRAPPER GENERATOR TO APPLICATION CORE LIBRARIES Fernando PEREIRA, Christian THEIS - HSE/RP EDMS tech note:
Ruby Tien Ho and Brandon Hostetter. Overview ▸ Object-oriented, functional, imperative, and reflective ▸ Interpreted language ▸ Influenced by Perl, Smalltalk,
Windows Programming Lecture 03. Pointers and Arrays.
Presented By P.SRIVIDYA 085D1A0552 Programming Language.
JRuby on Rails Presenter Name
JRuby on Rails Brian Leonard ブライアン レオナルド
CST 1101 Problem Solving Using Computers
Ruby Getting started & Ruby.New Presented by Mario Tayah
Ruby: An Introduction Created by Yukihiro Matsumoto in 1993 (named after his birthstone) Pure OO language (even the number 1 is an instance of a class)
Scope History of Ruby. Where can you use Ruby? General Features.
What to do today: Brief history of Ruby General qualities/info
Ruby Testing 2, 11/9/2004.
Statements and expressions - java
Experiment No. (1) - an introduction to MATLAB
Tutorial 10: Programming with javascript
BlueJ: a very quick introduction
Web Application Development Using PHP
Presentation transcript:

1 Getting Started with Ruby

2 What’s Ruby? Ruby is an OO, dynamic, agile language –Everything’s an object For example, try puts -1.abs –Derives strengths of Perl, Smalltalk, Python Created by Matz in mid 90’s Prevalent in Japan; recent buzz in the US It’s a lightweight language –Clean, Higher signal-to-noise ratio There is no compiler to stand in your way Quite flexible–you’ll see when you use it

3 History Created by Yukihiro Matsumoto (Matz) in 1993 Slowly being accepted in the west Popularized by some key players in the industry Gaining strength in various applications –Ruby-On-Rails (ROR)

4 Downloading Ruby Ruby site – For windows, you may use one-click installer

5 Ruby Version You can find the version of ruby you’re using by typing ruby –v

6 Running Ruby Run ruby and type commands Interactively using irb Save code to file and run it I’ll run it directly from notepad2 Other tools and Plugins available as well

7 IDEs Comes with FreeRIDE IDE Mondrian IDE TextPad generally used on Mac Command line and Notepad(2) works great as well! –The following blog entry shows you how –

8 ri RDoc at Documentation…

9 Object-Oriented Ruby treats almost everything as objects nil is an object (try: puts nil.methods) Even classes are objects! –You use them like objects –These objects simply represent their class Pizza is a const that references Pizza class object

10 Code less, do more Java: Ruby Less Clutter GOJ

11 Less Clutter Clean language Less noise ; is not needed Parenthesis are optional Variables don’t have type specification Last statement of a method returns automatically You can even return multiple values!

12 Variables Dynamic typing Output:

13 Types Everything is an object

14 Writing a function

15 Another function Returns an array Assigns elements of array to individual variables

16 Ruby Conventions Conventions are very important Sometimes convention simply makes code look better At other times, it means something significant [you will learn some conventions the hard way ]

17 Class/Method conventions Class names, modules names, and constants start with upper case –SportsCar, ValueOfPI, DAYS_IN_WEEK Methods and variables start with lowercase and use underscore –start_engine(), miles_driven Instance variables Class variables use double ats Global variables use $ –$ozone

18 Method convention talks to you You can figure out what a method is up to from its looks Methods may end with an = –the method may appear as l-value Query method Doesn’t modify object Has side effect; mutates object

19 Global and Predefined Variables This is hideous You may be setting some global variable and not know it (familiarize yourself) Some predefs: $_, $0, $$, $&, $!, …

20 "" vs '' (Double vs. Single Quotes) '' is a simple string Expressions within "" are evaluated Better to use ' if you don’t have expressions

21 More on Strings