Upload
sarah-allen
View
1.753
Download
2
Embed Size (px)
DESCRIPTION
Ruby on Rails Fundamentals, slides for Class 1
Citation preview
Ruby on Rails Fundamentals
6:30 PM - 8:30 PMAug 25 - Sep 29
What is Ruby on Rails?
Ruby is a language. Rails is a framework.
• If you want to understand Rails, you need to be fluent in Ruby.
• Rails applications are Ruby applications.
The Ruby Language
• Originally by Yukihiro "Matz" Matsumoto• “Ruby is designed for programmer
productivity and fun, following the principles of good user interface design. He stresses that systems design needs to emphasize human, rather than computer, needs.”
http://en.wikipedia.org/wiki/Ruby_(programming_language)#History
• Ruby 1.0 was released in 1996.
What you will learn
• Ruby– Language concepts– Language syntax– Common patterns
• Rails Framework: creating web applications– Scaffold– Model, View, Controllers– SQL Queries– HTTP with REST and Routes– Log files and debugging– Associations
How you will learn
• Exploration: experiment, play• Test-Driven Development (TDD)– Initially as a learning methodology– Later as a development methodology
• Ask questions• Learn to find your own answers• Read
• Plus whatever works best for you
Class Structure
• Talk• Live Coding Demonstrations• In-class coding• Coding at home (or in social groups)• Google Group
Ruby Language Overview
• Dynamically typed• Interpreted• Can be modified at runtime• Object oriented• Blocks & lambdas• Nice support for Regular Expressions
Lets get started
• IRB: InteractiveRuBy>> 4>> 4 + 4
Everything is an object
“test”.upcase“test”.class“test”.methods
Everything evaluates to something
2 + 2(2+2).zero?
Methods are Messages
thing.do(4)thing.do 4thing.send “do”, 4
Operators are Methods
thing.do 4thing.do(4)thing.send “do”, 4
1 + 21.+(2)1.send "+", 2
Iteration
my_list = ["cat", "dog", ”world"]my_list .each do |item| puts "hello" + itemend
Test-First Learning
• Similar methodology to TDDwith a different purpose and workflow
• Teacher writes the test• Student implements the code
Test-Driven Development
• Design• Focus / Project Management• Creation of Tests
Time to Write Code