!SLIDE subsection
!SLIDE
!SLIDE
!SLIDE
!SLIDE centereverything
!SLIDE incremental smbullets
- Learn about customer's requirements
- Translate to "stories"
- Pick a story that seems doable
- Write code that does it
- Show your work to the customer, get feedback
- Based on feedback, adjust your stories
- When a story is done, go back to "pick a story"
- Repeat until app is finished!
!SLIDE subsection
!SLIDE bullets
!SLIDE commandline
$ irb
!SLIDE
> my_variable = 5
=> 5
> my_other_variable = "hi"
=> "hi"
!SLIDE
>> fruits = ["kiwi", "strawberry", "plum"]
=> ["kiwi", "strawberry", "plum"]
>> states = {"CA" => "California", "DE" => "Delaware"}
=> {"CA"=>"California", "DE"=>"Delaware"}
!SLIDE
> my_variable + 2
=> 7
> my_variable * 3
=> 15
> my_fruits = my_fruits + ["lychee"]
=> ["kiwi", "strawberry", "plum", "lychee"]
> my_fruits = my_fruits - ["lychee"]
=> ["kiwi", "strawberry", "plum"]
!SLIDE
The hard way:
>> puts fruits[0]
kiwi
=> nil
>> puts fruits[1]
strawberry
=> nil
>> puts fruits[2]
plum
=> nil
!SLIDE
The easy way:
>> fruits.each {|f| puts f}
kiwi
strawberry
plum
=> ["kiwi", "strawberry", "plum"]
!SLIDE
The easy way, with "do...end" rather than "{...}"
>> fruits.each do |f|
?> puts f
>> end
kiwi
strawberry
plum
=> ["kiwi", "strawberry", "plum"]
!SLIDE
>> fruits.each do |f|
?> puts f if f == "plum"
>> end
plum
=> ["kiwi", "strawberry", "plum"]
!SLIDE
@@@ Ruby
require 'rubygems'
require 'sinatra'
get '/' do
"<b>Hello, <i>bang bang</i>!"
end
!SLIDE commandline
$ gem install sinatra
$ ruby hello.rb
== Sinatra/1.2.6 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
then open a browser to http://localhost:4567/
!SLIDE
!SLIDE
!SLIDE