URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use...

18
URails Meeting 001

Transcript of URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use...

Page 1: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

URails

Meeting 001

Page 2: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

HTTP

• Old/Young guys with beards decided “We need to communicate. Let’s use text!”

• Hypertext Transfer Protocol• HTTP is just sending and receiving text from a

server• You don’t even need a browser, you just need

to follow the protocol! (curl example)

Page 3: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Server

Client (Such as a web

browser)

“Hey, I want to see www.kewl.com”

“Here you go”

GET / HTTP/1.1Host: kewl.comConnection: closeUser-Agent: my-browserAccept-Encoding: gzipAccept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7Cache-Control: no-cache

<html> This is my Kewl website!</html>HTTP Header ---->

Response

Page 4: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

What do HTTP servers send back?

• HTML?– YES!

• Anything it wants?– YES!

• Most commonly, HTML is sent for viewing webpages, but other formats are used like XML, JSON, ANY-THING

Page 5: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

What is HTML

• “Pretty text with formatting”• How does it work?

<tag> <- opening tag …content here, including perhaps more tags…</tag> <- closing tag

– Hierarchical representation of data (Tree anyone?)• And… that’s it (basically)• Demo time!

Page 6: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

It isn’t enough!

• Dynamic vs. Static?• What if we want content on a webpage to

change without humans editing HTML?• Time Example• What’s happening?– The web server, when it receives a request for a

website, replaces “dynamic” content with plain text/html before sending it to the client

Page 7: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Server

Client (Such as a web

browser)

“Hey, I want to see www.kewl.com”

“Here you go”

GET / HTTP/1.1Host: kewl.comConnection: closeUser-Agent: my-browserAccept-Encoding: gzipAccept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7Cache-Control: no-cache

<html> This is my Kewl website! 2011-07-14</html>

<%= Time.now %> replaced with 2011-07-14

Page 8: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Databases

• What are they and why are they important?– They help keep large amounts of data organized,

easily accessible, and (hopefully) safe from corruption

– We will talk more about Databases in later lectures

Page 9: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Server

Client (Such as a web

browser)

Database Safely stores all data related to a website

Gets data from database, mixes it with HTML, sends it to the client (often referred to as “Business Logic”)

Receives HTML, and presents it prettily to the user

Page 10: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

What types of websites use this model?

• Almost all of them (at least any worth using)• Facebook/Engadget/Twitter/Hulu/ESPN/etc.• How do you think Facebooks uses databases?

Page 11: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

So Why Ruby on Rails?

• The Web is the Wild-Wild-West of programming. It’s a hodge-podge of different technologies that have to work together

• What is involved in building a webpage?– HTML– Javascript– CSS– Databases– Security– Managing sessions– Etc…

• Bottom line: It can get complicated

Page 12: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

So why Ruby on Rails? (cont.)

• Ruby is a sweet language (more on that in later lectures)

• Rails is a “framework” that provides an excellent way to abstract away and organize the complexity of building dynamic websites

• Define “framework”? (this phrase is used a lot in CS)

• Let’s see an example! (Get ready for an overload)– After we look at MVC

Page 13: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Server

Client (Such as a web

browser)

Database Safely stores all data related to a website

Gets specific data from database, mixes it with HTML, sends it to the client (often referred to as “Business Logic”)

Receives HTML, and presents it prettily to the user

MVC

(M)odel

(C)ontroller

(V)iew

Page 14: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Thing we’ll be covering

• Linux command-line/filesystem• Source Code Version Control (SVN/Git)• HTML/CSS/Javascript• Relational Databases• MVC• HTTP• “Statelessness” of HTTP (sessions, cookies)

Page 15: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

What to expect

• Rails is command-line intensive (which is good to learn now rather than later)

• You will need to run Linux– Options for Windows users

• Dual Boot (run both windows and linux and choose which to use when your computer boots)

• Run Linux in a Virtual Machine (free software exists for this)• Run Cygwin, which emulates a Linux command-line (similar to a Virtual

Machine but less demanding on your computer)• Choose one

• Next Lecture: How to install Cygwin/Linux, Ruby, Rails, some command-line practice, and some more Rails in action if we have time.

Page 16: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

Why this club will be worth it

• Rails is a very valuable/employable skill to have• The world is moving toward the web, so even if you

don’t prefer it, you need to know how to get around if you need to

• The Rails environment, outside of the web, provides an excellent environment to learn essential skills like getting around at a command-line, version control for source code, and collaborating on non-school projects (rare to find here at the U)

• Rails is the cool thing to do.

Page 17: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

If we have time…

• Where would you like to go from here?• Do people have pet projects they already

know they want to work on?• For those that don’t, are you interested in

having a “group” project that we work on together, both during meetings and individually?

• If not, are there other suggestions?

Page 18: URails Meeting 001. HTTP Old/Young guys with beards decided “We need to communicate. Let’s use text!” Hypertext Transfer Protocol HTTP is just sending.

That’s it!

Questions?