SlideShare a Scribd company logo
1 of 15
Download to read offline
Code & Supply #StarterSeries
Why?
Job Growth
Software development jobs will grow 32% through
2020.
Pays well
$93,350 median salary (2012)
Fun
Creative outlet
Other reasons? This presentation
Me
Professional Rails Dev - 5 years
Professional Software - 7 years
@justinxreese @codeandsupply @builderworksco
Starting out
Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results
Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results
Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results
Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results
What is a
program?
Basically: A file that can be
executed
More typically: a collection of
files that can be executed
How does
a program
run?
Think of it like “opening a
file with Ruby”
Code ProgramEditorEnvironment Results
Different Kinds of Programming
- Web
- Ruby on Rails, JavaScript, Python
- Native
- iOS (Objective-C, Swift), Android, OSX
- Systems
- Go, C, Rust
Different Programming Languages Different types of languages
- Functional
- Object oriented
- Concurrent
- Markup
Ruby
Why this class uses Ruby
- Object Oriented
- Typically used for web
- English-like syntax
- I know it well
Ruby on Rails?
Ruby != Rails
Ruby != Rails
!= means “these things are not equal”
Ruby == Ruby
Ruby == Ruby
== means “these things are equal”
1 == 1 1 == 1
1 == 1
3 == 3
1 == 1
3 == 3
1 == 1
3 == 3
4 == 5
1 == 1
3 == 3
4 == 5
1 == 1 true
3 == 3 true
4 == 5 false
You just learned booleans!
1 == 1 true
3 == 3 true
4 == 5 false
You already knew booleans!
1 == 1 true
3 == 3 true
4 == 5 false
Why not “=”?
Assignment
Because = is used to
assign things
x = 5
eyes = 2
fingers = 10
Assignment
Variables because the
values can change
x = 5
eyes = 2
fingers = 10
horrible_accident
fingers = 9
Using variables
Can be used in
calculations
my_eyes = 2
your_eyes = 2
my_eyes + your_eyes
=> 4
More operators*
* Don’t try to learn all of these today
Other operators
What other things can
you do with variables?
Arithmetic
pies = 3
people = 2
pies + people # 5
pies - people # 1
pies * people # 6
pies / people # 1 (???)
pies % people # 1
pies ** people # 9
Other operators
What other things can
you do with variables?
Comparison
pies = 3
people = 2
pies == people # false
pies != people # true
pies > people # true
pies < people # false
pies >= people # true
pies <= people # false
pies ⇔ people # 1
pies === people # false
Other operators
What other things can
you do with variables?
Logic
pies = 3
people = 2
pies && people
pies and people
pies || people
pies or people
!pies and !people
not pies and not people
Back to variables
Variables aren’t just numbers
Give it a name my_eyes = 2
my_name = “Justin”
Using variables
What if I try this? my_eyes = 2
my_name = “Justin”
my_eyes + my_name
Using variables
What if I try this? my_eyes = 2
my_name = “Justin”
my_eyes + my_name
=> Error
Why does it break?
Variables are
incompatible types
Data structure is
different
my_eyes = 2 # Integer
my_name = “Justin” # String
my_eyes + my_name
=> Error
Common types
- Symbols
- Hashes
- Arrays
- Strings
- Integers
- Floats
- Booleans
symbol = :symbol
hash = {a: 1, b: 2}
array = [1,2,3]
string = “Hello”
integer = 1
float = 1.5
boolean = true
Types we’ll use tonight
- Arrays
- Strings
- Integers
- Booleans
array = [1,2,3]
string = “Hello”
integer = 1
boolean = true
Array
Good for holding lists classmates = [‘Sandy’, ‘Josh’,
‘Amy’, ‘Alfred’]
dice_numbers = [1,2,3,4,5,6]
d20_numbers = dice_numbers +
[7,8,9,10,11,12,13,14,15,16,17,18,19
,20]
Control
Iteration
Doing something for
each item in a list
classmates = [‘Sandy’, ‘Josh’,
‘Amy’, ‘Alfred’]
classmates.each do |classmate|
puts classmate
end
Conditions
If/Else
Do something that
depends on the result
of something else
classmates = [‘Sandy’, ‘Josh’,
‘Amy’, ‘Alfred’]
classmates.each do |classmate|
if classmate == ‘Sandy’
puts classmate
else
puts “who?”
end
end
Code organization
Methods
Pieces of functionality
grouped together
def say_hello
puts “hello”
end
Modules
Group together like
methods
module Greetings
def say_hello
puts “hello”
end
def say_hello_french
puts “bonjour”
end
end
Classes
Group methods related
to a type of object
class Person
attr_accessor :first_name, :
last_name
def full_name
first_name + last_name
end
end
You can program
Concepts you’ve learned
- Assignment
- Data structures
- Iteration
- Conditions
Use of concepts
These basic concepts can get you through most
any problem you’ll have in programming
Advanced topics will help you get better
- Design patterns
- Object oriented programming
- Architecture
- Frameworks
- Libraries
- Abstraction
- More...
Time to code
Ruby
For this class we’ll
use runnable
IRB
Interactive shell
Creating and running a program
my_program.rb
“open with” ruby
Becoming a good developer
Mini-presentation time!
Learn the
language well
Before you dive into Rails
- Learn Ruby well
- Be able to spot the boundaries between Ruby the
language and Rails the framework
Learn the ecosystem
- Learn the tools around Ruby
- Many libraries (Gems) to do specific tasks
Learn best practices
- Version control
- test driven development
- clean code (DRY)
Community involvement
- Code & Supply events
- lectures
- build nights
Continuing education
- Codecademy, Treehouse - Like today, but no instructor
- Ruby Koans
Participate/Give back
- Ask questions. answer anything you can
- IRC - #ruby #codeandsupply
- StackOverflow
- Don’t be afraid of being wrong
Don’t be afraid of
being wrong
Continuing Education

More Related Content

Viewers also liked

Системы оценки рисков при катании вне трасс
Системы оценки рисков при катании вне трассСистемы оценки рисков при катании вне трасс
Системы оценки рисков при катании вне трассAlexandr Gabchenko
 
The Red River March Catalogue Part 1 B
The Red River   March Catalogue   Part 1 BThe Red River   March Catalogue   Part 1 B
The Red River March Catalogue Part 1 BNilakshi_Das
 
Teorias organizativas - Adriana Neira
Teorias organizativas - Adriana NeiraTeorias organizativas - Adriana Neira
Teorias organizativas - Adriana NeiraAdriana Neira
 
Telling the story of your community with demographics
Telling the story of your community with demographicsTelling the story of your community with demographics
Telling the story of your community with demographics.id - the population experts
 
Vietnam Delegation VR Presentation
Vietnam Delegation VR PresentationVietnam Delegation VR Presentation
Vietnam Delegation VR PresentationMikeWalshPhDLPCCRC
 
Guide pratique Restaurateur / Numérique
Guide pratique Restaurateur / NumériqueGuide pratique Restaurateur / Numérique
Guide pratique Restaurateur / NumériqueStephanie Dardenne
 
Teachers Social Bookmarking
Teachers Social BookmarkingTeachers Social Bookmarking
Teachers Social Bookmarkingharrisongee
 
Sagar Gawande New Resume
Sagar Gawande New ResumeSagar Gawande New Resume
Sagar Gawande New Resumesagar gawande
 

Viewers also liked (9)

Системы оценки рисков при катании вне трасс
Системы оценки рисков при катании вне трассСистемы оценки рисков при катании вне трасс
Системы оценки рисков при катании вне трасс
 
The Red River March Catalogue Part 1 B
The Red River   March Catalogue   Part 1 BThe Red River   March Catalogue   Part 1 B
The Red River March Catalogue Part 1 B
 
Teorias organizativas - Adriana Neira
Teorias organizativas - Adriana NeiraTeorias organizativas - Adriana Neira
Teorias organizativas - Adriana Neira
 
Telling the story of your community with demographics
Telling the story of your community with demographicsTelling the story of your community with demographics
Telling the story of your community with demographics
 
Vietnam Delegation VR Presentation
Vietnam Delegation VR PresentationVietnam Delegation VR Presentation
Vietnam Delegation VR Presentation
 
BAB 6 PENENTANGAN TERHADAP KUASA ASING
BAB 6 PENENTANGAN TERHADAP KUASA ASINGBAB 6 PENENTANGAN TERHADAP KUASA ASING
BAB 6 PENENTANGAN TERHADAP KUASA ASING
 
Guide pratique Restaurateur / Numérique
Guide pratique Restaurateur / NumériqueGuide pratique Restaurateur / Numérique
Guide pratique Restaurateur / Numérique
 
Teachers Social Bookmarking
Teachers Social BookmarkingTeachers Social Bookmarking
Teachers Social Bookmarking
 
Sagar Gawande New Resume
Sagar Gawande New ResumeSagar Gawande New Resume
Sagar Gawande New Resume
 

Similar to Intro to Programming (1)

The Final Programming Project
The Final Programming ProjectThe Final Programming Project
The Final Programming ProjectSage Jacobs
 
Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Brian Hogan
 
Building conversational experiences with Actions on Google
Building conversational experiences with Actions on GoogleBuilding conversational experiences with Actions on Google
Building conversational experiences with Actions on GoogleIdo Green
 
Python in one shot
Python in one shotPython in one shot
Python in one shotGulshan76
 
Extreme Programming practices for your team
Extreme Programming practices for your teamExtreme Programming practices for your team
Extreme Programming practices for your teamPawel Lipinski
 
Tcea 2014 video game design software
Tcea 2014   video game design softwareTcea 2014   video game design software
Tcea 2014 video game design softwareMike Ploor
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principlesEdorian
 
API Simplicity == Speed; Designing APIs That are Easy and Fun to Use
API Simplicity == Speed; Designing APIs That are Easy and Fun to UseAPI Simplicity == Speed; Designing APIs That are Easy and Fun to Use
API Simplicity == Speed; Designing APIs That are Easy and Fun to UseHarold Madsen
 
What every beginning developer should know
What every beginning developer should knowWhat every beginning developer should know
What every beginning developer should knowAndy Lester
 
Android design patterns
Android design patternsAndroid design patterns
Android design patternsVitali Pekelis
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review GuideBenjamin Kissinger
 
bgwjdpdx0814
bgwjdpdx0814bgwjdpdx0814
bgwjdpdx0814Thinkful
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst PracticesBurt Beckwith
 
GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1Heather Rock
 

Similar to Intro to Programming (1) (20)

The Final Programming Project
The Final Programming ProjectThe Final Programming Project
The Final Programming Project
 
Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7Intro to Ruby - Twin Cities Code Camp 7
Intro to Ruby - Twin Cities Code Camp 7
 
Building conversational experiences with Actions on Google
Building conversational experiences with Actions on GoogleBuilding conversational experiences with Actions on Google
Building conversational experiences with Actions on Google
 
Python in One Shot.docx
Python in One Shot.docxPython in One Shot.docx
Python in One Shot.docx
 
Python in one shot
Python in one shotPython in one shot
Python in one shot
 
Extreme Programming practices for your team
Extreme Programming practices for your teamExtreme Programming practices for your team
Extreme Programming practices for your team
 
Python slide
Python slidePython slide
Python slide
 
Tcea 2014 video game design software
Tcea 2014   video game design softwareTcea 2014   video game design software
Tcea 2014 video game design software
 
Learn to code in 15 minutes
Learn to code in 15 minutesLearn to code in 15 minutes
Learn to code in 15 minutes
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principles
 
API Simplicity == Speed; Designing APIs That are Easy and Fun to Use
API Simplicity == Speed; Designing APIs That are Easy and Fun to UseAPI Simplicity == Speed; Designing APIs That are Easy and Fun to Use
API Simplicity == Speed; Designing APIs That are Easy and Fun to Use
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Dodo does-math
Dodo does-mathDodo does-math
Dodo does-math
 
What every beginning developer should know
What every beginning developer should knowWhat every beginning developer should know
What every beginning developer should know
 
Ruby 101
Ruby 101Ruby 101
Ruby 101
 
Android design patterns
Android design patternsAndroid design patterns
Android design patterns
 
Basics of Programming - A Review Guide
Basics of Programming - A Review GuideBasics of Programming - A Review Guide
Basics of Programming - A Review Guide
 
bgwjdpdx0814
bgwjdpdx0814bgwjdpdx0814
bgwjdpdx0814
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst Practices
 
GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1GDI Seattle - Intro to JavaScript Class 1
GDI Seattle - Intro to JavaScript Class 1
 

Intro to Programming (1)

  • 1. Code & Supply #StarterSeries Why? Job Growth Software development jobs will grow 32% through 2020. Pays well $93,350 median salary (2012) Fun Creative outlet
  • 2. Other reasons? This presentation Me
  • 3. Professional Rails Dev - 5 years Professional Software - 7 years @justinxreese @codeandsupply @builderworksco Starting out Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results
  • 4. Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results Code ProgramEditorEnvironment Results What is a program? Basically: A file that can be executed More typically: a collection of files that can be executed How does a program run? Think of it like “opening a file with Ruby”
  • 5. Code ProgramEditorEnvironment Results Different Kinds of Programming - Web - Ruby on Rails, JavaScript, Python - Native - iOS (Objective-C, Swift), Android, OSX - Systems - Go, C, Rust Different Programming Languages Different types of languages - Functional - Object oriented - Concurrent - Markup Ruby Why this class uses Ruby - Object Oriented - Typically used for web - English-like syntax - I know it well
  • 6. Ruby on Rails? Ruby != Rails Ruby != Rails != means “these things are not equal” Ruby == Ruby Ruby == Ruby == means “these things are equal”
  • 7. 1 == 1 1 == 1 1 == 1 3 == 3 1 == 1 3 == 3 1 == 1 3 == 3 4 == 5 1 == 1 3 == 3 4 == 5
  • 8. 1 == 1 true 3 == 3 true 4 == 5 false You just learned booleans! 1 == 1 true 3 == 3 true 4 == 5 false You already knew booleans! 1 == 1 true 3 == 3 true 4 == 5 false Why not “=”? Assignment Because = is used to assign things x = 5 eyes = 2 fingers = 10 Assignment Variables because the values can change x = 5 eyes = 2 fingers = 10 horrible_accident fingers = 9
  • 9. Using variables Can be used in calculations my_eyes = 2 your_eyes = 2 my_eyes + your_eyes => 4 More operators* * Don’t try to learn all of these today Other operators What other things can you do with variables? Arithmetic pies = 3 people = 2 pies + people # 5 pies - people # 1 pies * people # 6 pies / people # 1 (???) pies % people # 1 pies ** people # 9 Other operators What other things can you do with variables? Comparison pies = 3 people = 2 pies == people # false pies != people # true pies > people # true pies < people # false pies >= people # true pies <= people # false pies ⇔ people # 1 pies === people # false Other operators What other things can you do with variables? Logic pies = 3 people = 2 pies && people pies and people pies || people pies or people !pies and !people not pies and not people Back to variables
  • 10. Variables aren’t just numbers Give it a name my_eyes = 2 my_name = “Justin” Using variables What if I try this? my_eyes = 2 my_name = “Justin” my_eyes + my_name Using variables What if I try this? my_eyes = 2 my_name = “Justin” my_eyes + my_name => Error Why does it break? Variables are incompatible types Data structure is different my_eyes = 2 # Integer my_name = “Justin” # String my_eyes + my_name => Error Common types - Symbols - Hashes - Arrays - Strings - Integers - Floats - Booleans symbol = :symbol hash = {a: 1, b: 2} array = [1,2,3] string = “Hello” integer = 1 float = 1.5 boolean = true
  • 11. Types we’ll use tonight - Arrays - Strings - Integers - Booleans array = [1,2,3] string = “Hello” integer = 1 boolean = true Array Good for holding lists classmates = [‘Sandy’, ‘Josh’, ‘Amy’, ‘Alfred’] dice_numbers = [1,2,3,4,5,6] d20_numbers = dice_numbers + [7,8,9,10,11,12,13,14,15,16,17,18,19 ,20] Control Iteration Doing something for each item in a list classmates = [‘Sandy’, ‘Josh’, ‘Amy’, ‘Alfred’] classmates.each do |classmate| puts classmate end Conditions If/Else Do something that depends on the result of something else classmates = [‘Sandy’, ‘Josh’, ‘Amy’, ‘Alfred’] classmates.each do |classmate| if classmate == ‘Sandy’ puts classmate else puts “who?” end end
  • 12. Code organization Methods Pieces of functionality grouped together def say_hello puts “hello” end Modules Group together like methods module Greetings def say_hello puts “hello” end def say_hello_french puts “bonjour” end end Classes Group methods related to a type of object class Person attr_accessor :first_name, : last_name def full_name first_name + last_name end end You can program Concepts you’ve learned - Assignment - Data structures - Iteration - Conditions
  • 13. Use of concepts These basic concepts can get you through most any problem you’ll have in programming Advanced topics will help you get better - Design patterns - Object oriented programming - Architecture - Frameworks - Libraries - Abstraction - More... Time to code Ruby For this class we’ll use runnable IRB Interactive shell
  • 14. Creating and running a program my_program.rb “open with” ruby Becoming a good developer Mini-presentation time! Learn the language well Before you dive into Rails - Learn Ruby well - Be able to spot the boundaries between Ruby the language and Rails the framework Learn the ecosystem - Learn the tools around Ruby - Many libraries (Gems) to do specific tasks Learn best practices - Version control - test driven development - clean code (DRY)
  • 15. Community involvement - Code & Supply events - lectures - build nights Continuing education - Codecademy, Treehouse - Like today, but no instructor - Ruby Koans Participate/Give back - Ask questions. answer anything you can - IRC - #ruby #codeandsupply - StackOverflow - Don’t be afraid of being wrong Don’t be afraid of being wrong Continuing Education