SlideShare a Scribd company logo
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

PDF
4.5 practice (compound inequalities)
PDF
JOINT-DESIGN OF LINK-ADAPTIVE MODULATION AND CODING WITH ADAPTIVE ARQ FOR COO...
PPTX
DOC
Giá máy bơm hơi cho tiệm sửa xe chuyên nghiệp
DOCX
Historia de la inteligencia artificial
PPTX
End of Semester Portfolio
PPTX
France T253
PPTX
LPGN Compensation Plan for indonesia
4.5 practice (compound inequalities)
JOINT-DESIGN OF LINK-ADAPTIVE MODULATION AND CODING WITH ADAPTIVE ARQ FOR COO...
Giá máy bơm hơi cho tiệm sửa xe chuyên nghiệp
Historia de la inteligencia artificial
End of Semester Portfolio
France T253
LPGN Compensation Plan for indonesia

Viewers also liked (9)

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

Similar to Intro to Programming (1) (20)

PDF
CPAP.com Introduction to Coding: Part 1
PPT
Introduction To Programming
PPTX
Software fundamentals
PPTX
Ruby Basics
PDF
Rubykin
PPT
Programming Fundamentals - Lecture 1.ppt
PDF
Introduction to programming by MUFIX Commnity
PDF
Introduction To Programming (2009 2010)
PDF
Basics of Programming - A Review Guide
PDF
Javanotes6 linked
PPTX
Computer science principals in terms of Programming
PDF
Javanotes5 linked
PDF
8 programming concepts_you_should_know_in_2017
PDF
Introduction to Programming Using Java v. 7 - David J Eck - Inglês
PPTX
Ruby -the wheel Technology
PDF
javanotes5.pdf
PPTX
classVII_Coding_Teacher_Presentation.pptx
CPAP.com Introduction to Coding: Part 1
Introduction To Programming
Software fundamentals
Ruby Basics
Rubykin
Programming Fundamentals - Lecture 1.ppt
Introduction to programming by MUFIX Commnity
Introduction To Programming (2009 2010)
Basics of Programming - A Review Guide
Javanotes6 linked
Computer science principals in terms of Programming
Javanotes5 linked
8 programming concepts_you_should_know_in_2017
Introduction to Programming Using Java v. 7 - David J Eck - Inglês
Ruby -the wheel Technology
javanotes5.pdf
classVII_Coding_Teacher_Presentation.pptx
Ad

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