Slides

What is a computer?

  • A calculating machine
    • 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?

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" is an essay by Neil Stephenson describing the history of computers in an enjoyable and clever way

{Ruby} 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!

node - the Interactive JavaScript Executor

Exercise: Calculator

  • open a terminal
  • type node
  • 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
    • Memory
    • Storage
    • Input/Output Devices (monitor, keyboard, etc.)
  • software
    • Operating System
    • Drivers
    • Programs
  • wetware
    • that's you!

Computer Anatomy: Hardware

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

Von Neumann Architecture

The basic architecture of computers has not changed since the invention of the Von Neumann Architecture in the 1940s.

Computer Anatomy: Software

  • Operating System
  • Libraries
  • Drivers
  • 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

  • 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.

  • coding is more like America's Test Kitchen than like Top Chef -- you may run many test batches, but the goal is not cookies, but a recipe so someone else can make cookies later

(recipe from popcornpottery.com)

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

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

If your code is a two-year-old child, then an error is a temper tantrum.

  • It's not all gibberish
  • Try to read it -- really try! -- and pull out the pearls from the pig slop