16
Ruby on Rails Fundamentals 6:30 PM - 8:30 PM Aug 25 - Sep 29

Ruby on Rails Fundamentals, Class 1

Embed Size (px)

DESCRIPTION

Ruby on Rails Fundamentals, slides for Class 1

Citation preview

Page 1: Ruby on Rails Fundamentals, Class 1

Ruby on Rails Fundamentals

6:30 PM - 8:30 PMAug 25 - Sep 29

Page 2: Ruby on Rails Fundamentals, Class 1

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.

Page 3: Ruby on Rails Fundamentals, Class 1

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.

Page 4: Ruby on Rails Fundamentals, Class 1

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

Page 5: Ruby on Rails Fundamentals, Class 1

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

Page 6: Ruby on Rails Fundamentals, Class 1

Class Structure

• Talk• Live Coding Demonstrations• In-class coding• Coding at home (or in social groups)• Google Group

Page 7: Ruby on Rails Fundamentals, Class 1

Ruby Language Overview

• Dynamically typed• Interpreted• Can be modified at runtime• Object oriented• Blocks & lambdas• Nice support for Regular Expressions

Page 8: Ruby on Rails Fundamentals, Class 1

Lets get started

• IRB: InteractiveRuBy>> 4>> 4 + 4

Page 9: Ruby on Rails Fundamentals, Class 1

Everything is an object

“test”.upcase“test”.class“test”.methods

Page 10: Ruby on Rails Fundamentals, Class 1

Everything evaluates to something

2 + 2(2+2).zero?

Page 11: Ruby on Rails Fundamentals, Class 1

Methods are Messages

thing.do(4)thing.do 4thing.send “do”, 4

Page 12: Ruby on Rails Fundamentals, Class 1

Operators are Methods

thing.do 4thing.do(4)thing.send “do”, 4

1 + 21.+(2)1.send "+", 2

Page 13: Ruby on Rails Fundamentals, Class 1

Iteration

my_list = ["cat", "dog", ”world"]my_list .each do |item| puts "hello" + itemend

Page 14: Ruby on Rails Fundamentals, Class 1

Test-First Learning

• Similar methodology to TDDwith a different purpose and workflow

• Teacher writes the test• Student implements the code

Page 15: Ruby on Rails Fundamentals, Class 1

Test-Driven Development

• Design• Focus / Project Management• Creation of Tests

Page 16: Ruby on Rails Fundamentals, Class 1

Time to Write Code