Other Pages

computers.md

<!-- next_step "objects" -->

# What is a computer?

* A smart box
  * desktop
  * laptop
  * cell phone
  * smart phone

# The Universal Machine

* A computer can do anything
  * (at least on the inside)
* This can be intimidating!
* But the basic rules are simple

# The Terminal

* the *TERMINAL* is a window into which you can talk directly to your computer
![Shall we play a game?](img/wargames-terminal.jpg)

# In The Beginning Was The Command Line

* the *TERMINAL* is a window into which you can talk directly to your computer
* aka *console* or *command line* or *command prompt* or *shell* or *prompt*
  * contrast *CLI* (Command Line Interface) to *GUI* (Graphical User Interface)

* ["In The Beginning Was The Command Line"](http://www.cryptonomicon.com/beginning.html) is an essay by Neil Stephenson describing the history of computers in an enjoyable and clever way

# irb - the Interactive Ruby Browser

## Exercise: Calculator

* open a terminal
* type `irb`
* press the `return` key (also called `enter`)
* see the `>` prompt
* type `1 + 1`
* press the `return` key again
* see the `2`
* yay, a $1000 calculator!

* Bonus: what other math can you do?

* From now on, whenever you see text in the `code font`, try typing it into irb and see what happens!

# Computer Anatomy: Hardware

* CPU ("the brain")
* Memory
* Input/Output
  * keyboard, mouse, touch screen, monitor

# Computer Anatomy: Software

* Operating System
* Libraries
* Applications
* Languages

Every piece of software on your computer is a PROGRAM.

# A Program Is Like A Recipe

* a recipe is a collection of *ingredients* and *instructions*

![Grandma's Cookie Recipe](img/cookie-recipe.gif)

* a program is a collection of *data* and *code*

When you are writing code, you are not baking cookies, you are writing a recipe for how to make cookies.

(recipe from http://www.popcornpottery.com/rec.html)

# Languages

* every program is written in a LANGUAGE
  * like Java or Python or C or Fortran
  * even HTML and CSS and SQL are languages
  * every computer language has a silly name
* different languages are useful in different areas, but there is a lot of overlap
* today we will learn the RUBY programming language

# Ruby

* Ruby was invented in the 1990s by a very nice Japanese man named Yukihiro Matsumoto (nicknamed Matz)
* The motto of Ruby is MINASWAN:

> Matz is nice, and so we are nice.

# Ruby is fun

* Ruby was [designed to be fun](http://blog.crowdint.com/2013/06/11/matz-keynote-at-ruby-kaigi-2013.html) to write code in, while also being powerful and well-rounded.
* *Ruby is poetry*
  * especially compared to other languages

# Errors Are Awesome

* Don't be afraid of errors
* Your computer is trying to help you fix your program
  * It's just *really* bad at communicating
* It's not all gibberish
* Try to read it -- really try! -- and pull out the pearls from the pig slop