## Week 1
# Introduction to Ruby & The Web
---
## Agenda
- Course Logistics
- Intro to the Web
- Brief Look into Ruby
- CURL Lab
----
# Instructors
<div style="display: flex; align-items: center;">
<img src="https://i.imgur.com/K9SzpOe.jpg" width="100" height="100" style="border-radius: 100%; margin: 20px;">
<h2>Freddy Cervantes</h2>
</div>
<div style="display: flex; align-items: center;">
<img src="https://i.imgur.com/8uoxVvA.jpg" width="100" height="100" style="border-radius: 100%; margin: 20px;">
<h2>Frederick Kim</h2>
</div>
----
# Teaching Assistants
<div style="display: flex; flex-wrap: wrap">
<div style="display: flex; align-items: center; margin-right: 35px;">
<img src="https://i.imgur.com/GhHsElh.jpg" width="75" height="75" style="border-radius: 100%; margin: 20px;">
<h4>Arpan Pal</h4>
</div>
<div style="display: flex; align-items: center; margin-right: 35px;">
<img src="https://i.imgur.com/usZ2ev0.png" width="75" height="75" style="border-radius: 100%; margin: 20px;">
<h4>Franco Monterrosa</h4>
</div>
<div style="display: flex; align-items: center; margin-right: 35px;">
<img src="https://i.imgur.com/ouDQRBu.jpg" width="75" height="75" style="border-radius: 100%; margin: 20px;">
<h4>Wilson Wang</h4>
</div>
</div>
---
# Course Logistics
----
# Weekly Lecture
Jacobs 210, 4-5:30 PM
- If you need to leave early, please do so quietly. It's your responsiblity to look up slides and catch up on material!
- 10 Classes Total
----
# Weekly Attendance (20% of grade)
- 0-1 unexcused = 20/20
- 2 unexcused = 10/20
- 3 unexcused = 0/20
- 4+ unexcused = Automatic NP 😢
----
# More notes
- Soft Pre-reqs: CS 61A (Highly Recommended!) & CS 61B (Concurrent enrollment OK)
- Let us know if you have any concerns and we'll do our best to support you
- Optional Corresponding Textbook: https://guides.rubyonrails.org/
---
# Course Resources
----
# Course Website
**your.rails.world**
- Attendance form
- Absence form
- Lecture Slides
- Homework
- Other resources
----
# Syllabus
The following URL: https://tinyurl.com/railsfa19syllabus
----
# Piazza!
Normal Piazza stuff you're all familiar with
- Live lecture threads!
- Homework/Project Threads
- Contact staff by using private posts
- Staff Weekly Office Hours: TBA!
---
# Grading
----
# Work
- 4 Homeworks, 2 Projects
- Four slip days for any type of assignment - at most 2 allowed for final project
----
# Grading breakdown
- 20% Attendance
- 25% Homework
- 25% Project 1 (Individual)
- 30% Final Project (Group) [no submission = automatic NP]
- 2 Units P/NP - 70% or higher is passing
---
# In-Class Labs + Discussions
----
# Lectures
- One hour of lecture
- Interspersed with discussion questions
- 30 minutes of lab
---
<!-- .two_col -->
# Let's Talk About The Web!
----
# Discussion Question
What happens when you type http://www.facebook.com in your browser and press `enter`?
----
# Understanding the web
- We communicate with websites and web applications through text
- Asking a simple static site will return text in the form of html
- Our browser reads the html and makes it look pretty for us
----
# Structure of Web applications
- The issue of templating
- When any of us go to facebook.com, we all see different things! How?
- Web applications have a data store and building a web application involves coordinating between what the user is asking for, what data is involved, and how to show the relevant "text" for the browser to display
----
![](https://i.imgur.com/svdkDFG.png)
---
# Communicating with Web Applications
----
# Requests!
- Requests have 3 main components
- Type (e.g.: GET, POST, PUT, PATCH)
- Headers (Dictionary of key-value pairs)
- Body (Plain-text)
----
# Curl Demo
- Browser is simply sending requests to websites asking for the text to display to the user
- We can also send requests and get back text!
---
# What is Ruby?
----
- High level programming language
- Dynamically Typed (like Python!)
- Object-Oriented (like Java!)
- Focus on humans, not machines
- Everything is an object
- `{ 1 => Integer, ‘String’ => String, :symbol => Symbol, [] => Array, {} => Hash, nil => NilClass }`
- Learn more: https://www.codecademy.com/articles/glossary-ruby
----
# Common Ruby Objects
- `nil` : representation of nothingness; similar to null, undefined
- `“String”` : Mutable sequence of characters
- `:symbol` : Strings, sort of
- `1` : Integer
----
- `true && false` : Boolean
- `[]` : Array
- Can contain multiple types of objects ( example: `[ 1.0, “foo”, :baz ]` )
- `{}` : Hash or Dictionary
- `{:foo => "bar", baz: :buzz} # two syntax styles`
---
# Lab Time!
Now it's your turn to try out CURLing!
---
# Day 1 Over!
### Attendance
Make sure to fill out the attendance form
### Homework
Submit the Welcome Survey by SUNDAY 11:59 p.m.
#### All links are at **your.rails.world**