5.0.0.1 – Hello Ruby 6/26/2016 5.0.0.1.1 - Hello Ruby 1 5.0.0.1.1 Hello Ruby A scrumptiously delicious intro · Why Ruby? · What’s it look like? · So how.

Slides:



Advertisements
Similar presentations
Introducing yourself and Others
Advertisements

Molecular Biomedical Informatics Web Programming 1.
Recursion CS 367 – Introduction to Data Structures.
The Linux Operating System Lecture 6: Perl for the Systems Administrator Tonga Institute of Higher Education.
● Perl reference
Let's Learn Ruby AQAP As Quickly As Possible!.  Run the interactive ruby shell – irb  Suggest using Netbeans – download ALL Running Ruby Code 2.
Language of the Month If it’s December, it must be Ruby! Adam Coffman and Brent Beer.
Introduction to Python. Python is a high-level programming language Open source and community driven “Batteries Included” – a standard distribution includes.
Nov 10, Fall 2006IAT 8001 Debugging. Nov 10, Fall 2006IAT 8002 How do I know my program is broken?  Compiler Errors –easy to fix!  Runtime Exceptions.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
Practical Extraction & Report Language Picture taken from
Sorting. Simple Sorting As you are probably aware, there are many different sorting algorithms: selection sort, insertion sort, bubble sort, heap sort,
2.1 Lists and Arrays Summary of 1 st lesson Single quoted and double quoted strings Backslash ( \ ) – the escape character: \t \n Operators:
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
Subroutines Just like C, PERL offers the ability to use subroutines for all the same reasons – Code that you will use over and over again – Breaking large.
Hello AP Computer Science!. What are some of the things that you have used computers for?
1 Web Based Programming Section 6 James King 12 August 2003.
Chapter 12: Searching in Web applications The first examples use a search form embedded in a Web page to query the deptstore database, which contains the.
– Intermediate Perl 9/16/ Intermediate Perl - References Intermediate Perl Session 1 · references · complex data structres.
Jun 16, 2014IAT 2651 Debugging. Dialectical Materialism  Dialectical materialism is a strand of Marxism, synthesizing Hegel's dialectics, which proposes.
Introduction to Python John Reiser May 5 th, 2010.
1 Perl Perl basics Perl Elements Arrays and Hashes Control statements Operators OOP in Perl.
Perl Tutorial Presented by Pradeepsunder. Why PERL ???  Practical extraction and report language  Similar to shell script but lot easier and more powerful.
Structured programming 4 Day 34 LING Computational Linguistics Harry Howard Tulane University.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
Perl and Regular Expressions Regular Expressions are available as part of the programming languages Java, JScript, Visual Basic and VBScript, JavaScript,
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Perl Challenge Lecturer: Prof. Andrzej (AJ) Bieszczad Phone: “UNIX for Programmers and Users” Third Edition, Prentice-Hall,
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
And other languages….  Array literals/initialization a = [1,2,3] a2 = [-10..0, 0..10] a3 = [[1,2],[3,4]] a4 = [w*h, w, h] a5 = [] empty = Array.new zeros.
Recap form last time How to do for loops map, filter, reduce Next up: dictionaries.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
ProgLan Python Session 4. Functions are a convenient way to divide your code into useful blocks, allowing us to: order our code, make it more readable,
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
Perl Day 4. Fuzzy Matches We know about eq and ne, but they only match things exactly We know about eq and ne, but they only match things exactly –Sometimes.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Topic 4:Subroutines CSE2395/CSE3395 Perl Programming Learning Perl 3rd edition chapter 4, pages 56-72, Programming Perl 3rd edition pages 80-83,
Hello Computer Science!. Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening.
Scripting Languages Diana Trandab ă ț Master in Computational Linguistics - 1 st year
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
CSE373: Data Structures & Algorithms Lecture 6: Priority Queues Kevin Quinn Fall 2015.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
– Intermediate Perl 2/1/ Intermediate Perl - sort/grep/map Intermediate Perl – Session 3 · map · transforming data ·
Python Basics  Functions  Loops  Recursion. Built-in functions >>> type (32) >>> int(‘32’) 32  From math >>>import math >>> degrees = 45 >>> radians.
Bessie The Bee! By: Sophie and Audrey. One day there was a honey bee named Bessie, who loved the outdoors. Bessie was to young to leave the hive says.
CS 368 – Intro to Scripting Languages Summer 2009 Cartwright, De Smet, LeRoy Object Oriented Programming Programming Perl Chapter 12: "Objects"
BINF 634 Fall LECTURE061 Outline Lab 1 (Quiz 3) Solution Program 2 Scoping Algorithm efficiency Sorting Hashes Review for midterm Quiz 4 Outline.
Offer English 3 1st Meeting. Getting started With a group of 4, watch this video, identify it, and answer the questions below.
GETTING UNSTUCK Karen Brennan | Harvard University.
CSE 143 Lecture 9 Recursion slides created by Alyssa Harding
Programming in Perl references and objects Peter Verhás January 2002.
Java Expert Session By: Prof. Mehul Raval Prof. Adarsh Patel Prof. Mihir Suthar.
Clojure Macros. Homoiconicity All versions of Lisp, including Clojure, are homoiconic This means that there is no difference between the form of the data.
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Intermediate Perl - References
C++ coding standard suggestion… Separate reasoning from action, in every block. Hi, this talk is to suggest a rule (or guideline) to simplify C++ code.
Character (String) Data
Lab: ssh, scp, gdb, valgrind
COMP 2710 Software Construction Introduction to GDB
GREETINGS.
WHY DO I EAT WHAT I DO?.
Programming in Perl Introduction
CIT 383: Administrative Scripting
Programming Tips GS540 January 10, 2011.
Lesson 2. Control structures File IO - reading and writing Subroutines
Data Science with Python
Using a Debugger 1-Jan-19.
Recursion based on slides by Alyssa Harding
Presentation transcript:

– Hello Ruby 6/26/ Hello Ruby Hello Ruby A scrumptiously delicious intro · Why Ruby? · What’s it look like? · So how is it different than Perl? · Make it go! · dealing with variables

– Hello Ruby 6/26/ Hello Ruby 2 Hi, I’m I am not a Perl programmer.

– Hello Ruby 6/26/ Hello Ruby 3 Things I don’t like to do when programming, but find myself sometimes doing anyway: Spoon-feeding compilers Sifting through stack trace vomit Sifting through other people’s less-than-elegant code, searching for what should be obvious Typing like crazy to do something trivial I don’t want to be surprised anymore

– Hello Ruby 6/26/ Hello Ruby 4 Things I want out of a programming experience: · Minimize time it takes to get into my head · Minimize time it takes to get out of my head · Minimize frustration -> minimize effort -> conventional things are easy code machine colleague

– Hello Ruby 6/26/ Hello Ruby 5 Most important thing I want when programming: · Happiness

– Hello Ruby 6/26/ Hello Ruby 6 Why Ruby? Easy to read Easy to learn Great for string processing and system call…calling Full toolbox (CPAN-like package manager, built-in debugger, built-in interactive session, batteries included) Designed with programmer joy in mind

– Hello Ruby 6/26/ Hello Ruby 7 What’s it look like? # Perl = (qw(gelato chicken garlic beans lobster)); print qq(I’m thinking of $#food_list foods.); if (grep($_ eq { $feels_like_chicken_tonight = 1; } elsif { # we know food_list is an array # can test references using ref($x) eq "ARRAY" “broccoli”; } else { print “There’s no chicken.”; } print

– Hello Ruby 6/26/ Hello Ruby 8 Let’s write a simple function # Perl equivalent sub sort_by_length for $i { for $j (0.. $i-1) { if(length($list[$j]) > length($list[$j+1])) } } 0..list.size-1 0..i-1

– Hello Ruby 6/26/ Hello Ruby 9 A Ruby approach # Perl equivalent sub sort_by_length { sort {length($a)  } Ruby's iterator list do |x| CODE is like Perl's map map { CODE except Ruby defines the local iterator explicitly (|x|, |var|, etc) whereas Perl uses $_

– Hello Ruby 6/26/ Hello Ruby 10 What can it do? # Perl equivalent $fh = open(">sorted_food_list.txt"); for $food { print $fh $food; } close($fh); use LWP::Simple; my $html = get(" if($html =~ /Gene/) { print index($html,"Gene"); }

– Hello Ruby 6/26/ Hello Ruby 11 Why should I care? People are irrational and the world outside changes: dealing with requirement changes and getting help if you need it is easy.

– Hello Ruby 6/26/ Hello Ruby 12 Pretty graphs are nice (and easy)

– Hello Ruby 6/26/ Hello Ruby 13 Hitting the fan (debugging) $ ruby -rdebug broken_program.rb

– Hello Ruby 6/26/ Hello Ruby 14 When not to use Ruby Machine speed (write in C and call it from Ruby) Sadomasochism

– Hello Ruby 6/26/ Hello Ruby 15 Same programming time, same programming room Code jams and an open problem