Skip to content

Timeline Week 2

David Rogers edited this page Jan 4, 2015 · 1 revision

Week 2 -- Intro to Programming, JavaScript, TDD

  • Intro to Programming:
    • Basic Types, Variables, and Operators
    • Conditionals and Loops
    • Functions and Callbacks
  • Running JavaScript via node
  • Basic TDD with node.assert
  • Writing pseduo-code and logical diagramming
  • Interactive debugging via C9 and Chrome

Objectives

Students should be competent at:

  • Writing vanilla JavaScript:
    • given significant structure
    • to solve logical problems
    • in a test-driven manner
    • with simple assert statements
  • Running JavaScript from the CLI:
    • via the node binary
    • via the mocha script
    • continuously with --watch
  • Pair programming with multiple partners:
    • Pilot-Copilot style
    • Ping-Pong style
    • Randori style with the class

Students should be familiar with:

  • Experimenting with JavaScript in:
    • the Cloud 9 IDE "Immediate" REPL
    • the Chrome JavaScript Console
    • the node REPL
  • All basic types in JavaScript:
    • Null
    • Undefined
    • Number
    • String
    • Boolean
    • Array as List
    • Object as Hash
  • Methods of the basic types, e.g. String.length, String.slice(), Number.toFixed()
  • Named function definitions and invocations:
    • with and without parameters
    • with variable parameters
  • Conditional statements and guard clauses
  • Looping statements with while and for
  • Breaking down problems into pseudo-code within code comments
  • Deleting and re-writing code in iterations
  • Logical digramming of blocks and conditions

Students should be exposed to:

  • Complex problem domains via Conway's Game
  • Various forms of refactoring:
    • decomposing conditionals
    • conditional chains to lookup
    • extract method / variable
    • replace literal
    • replace with guard

Projects

I should build...

  • Very basic math and string operations:
    • 1 + 1 vs '1' + '1'
    • 1 - 1 vs '1' - '1'
    • 'one' - 'one'
  • Basic calculator functions:
    • plus(a, b)
    • minus(a, b)
    • star(a, b)
    • slash(a, b)
  • String Calculator Kata (addition)
    • add('zero', 'zero') === 0
    • add('zero', 'one') === 1
    • add('one', 'one') === 2
    • add('one', 'two') === 3
    • add('two', 'two') === 4
    • refactor to data provider
  • Check Writing Kata (<10)
    • toString(1) === 'one dollar & 00/100s'
    • toString(2) === 'two dollars & 00/100s'
    • toString(3.14159) === 'three dollars and 14/100s'
  • Project Euler Problems (Randori Kata)
    • #1: Sum of 3s and 5s < 1000
    • #2: Sum of even Fibonaccis < 4M

They should build...

  • Individually and in Pairs
  • With TDD via require('assert')
  • Running from the CLI with:
    • node filename.js
    • mocha filename.js
    • mocha --watch filename.js
  • String Calculator via:
    • chained conditionals
    • checkpoints: 'ten', 'twenty', 'thirty', 'fifty', etc
    • refactored to lookup
  • Check Writing via:
    • chained conditionals
    • checkpoints: 0-10, 10-20, 20-30, 30-50, etc
    • refactored to lookup
  • Project Euler Problems 1 & 2
  • Chess Board as Array (from MDN)
    • with "Catalan: Closed" opening
    • with "Catalan: Closed" opening + midgame
    • refactored to array of step functions