Skip to content

Latest commit

 

History

History
173 lines (128 loc) · 2.82 KB

programming_intro.md

File metadata and controls

173 lines (128 loc) · 2.82 KB

!SLIDE

The Complete Beginner's Guide to Programming

!SLIDE

What is a program?

!SLIDE

!SLIDE



!SLIDE centereverything

!SLIDE

How do I write one?

!SLIDE

  • 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

Let's start writing code!

!SLIDE

Windows Mac OS X

!SLIDE centereverything


irb

!SLIDE

Variables

words that hold information


> my_variable = 5
=> 5
> my_other_variable = "hi"
=> "hi"

!SLIDE

Types of information

text, numbers...collections?


> fruits = ["kiwi", "strawberry", "plum"]
=> ["kiwi", "strawberry", "plum"]
> states = {"CA" => "California", "DE" => "Delaware"}
=> {"DE"=>"Delaware", "CA"=>"California"}

!SLIDE

Operators

doing stuff with variables


> 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

Loops

doing the same thing a bunch of times

> puts fruits[0]
kiwi
=> nil
> puts fruits[1]
strawberry
=> nil
> puts fruits[2]
plum
=> nil
VS > fruits.each do |f|
* puts f
> end
kiwi
strawberry
plum
=> ["kiwi", "strawberry", "plum"]

!SLIDE

Conditionals

doing something only if a condition is met


> fruits.each do |f|
*   puts f if f == "plum"
> end
plum
=> ["kiwi", "strawberry", "plum"]

!SLIDE

Now we've done some Ruby...

...let's do some Rails!

!SLIDE centereverything

!SLIDE centereverything