We have to earn the attention and trust of our listeners and readers


None of us ever truly has a captive audience. We have to earn the attention and trust of our listeners and readers. – Rachel Toor

I find myself talking at length about subjects I am most interested in. Perhaps to the chagrin of my colleagues. Sometimes I get heated and animated because I love the concepts or feel that I have something brilliant to say that I speak loudly, quickly, and intrusively.

After reading this article on the Chronicle of Education I’m having second thoughts.

In every situation, simply carrying on, is going to bore your audience. A conversation needs a back and forth. Or else it’s a soliloquy.

This aint no Shakespeare play. This is real life!

Early-career professors who worry about their authority may feel the need to prove that they deserve to be at the head of the class. They may suffer from impostor syndrome, having just learned the stuff they’re teaching. Eager to cover any inadequacies or incomplete knowledge, they trot out what they do know. They may be uncomfortable with silence and rush to fill it. – Rachel Toor


Or it’s possible that, like me, they just get so excited about the material that they can’t refrain from pointing out every single thing they think is cool. I’ve learned that it’s often a bad idea to teach a book I adore because if my students don’t love it as much as I do, first my feelings get hurt and then I rush in to show them what they’re missing. In class I’ll talk too much instead of waiting for them to say all the things they would have said if I’d only given them a chance. I try to be aware of that; sometimes I succeed. – Rachel Toor


How do they manage to miss they way the temperature in the room cools when they filibuster? Do they not see how people shut down? How suddenly everyone’s cuticles need picking or there’s a rush to use the bathroom? – Rachel Toor



Since then, at the start of every course, I ask each student to wait until three others have had a chance speak before they pipe up again. That can allow time and space for those who need a few extra moments to have their say. I try to follow the same rule myself in meetings. – Rachel Toor

I love simple rules. Rules to live by. Rules that can be applied universally. When I find a rule like this I immediately put it into place and test it out. What’s your experience with this?

Can you stop yourself from talking about subjects you love until at least 3 people have had a chance to talk? Test it out and let me know!

Swift Pair Programming – Day 1

Just finished pair programming with Nick. He’s in San Francisco. And I’m in Hawaii. We’re using ScreenHero to pair and it’s fantastic. There was a bit of a lag in screensharing because my internet connection was pretty bad. Next time I’ll be pairing from the library or from Hi Capacity. An hour goes by really quickly. Maybe we need to meet for longer?

Prior to meeting I made a list of the topics that I understand the least:

  • Closures
  • Coalescing operators
  • Optional binding
  • Force unwrapping
  • Guard statements
  • Optional chaining
  • veratic parameters
  • inout parameters
  • Nested function that returns a function
  • Currying

Questions that came up this session

How to we indicate a multi type array?

Lessons learned

  • Playground will not show up the play button if its a playground inside of the xcode project.
  • edit all in scope.
  • can’t do ++ in swift
  • Figure out how to do a next item in swift that is safe
  • Use inout in your parameter list to mutate parameter. Be sure to call method with & on parameter to indicate inout status

Shared tools:

SpectacleApp – FREE mac app to move and resize windows with ease. Window control with simple and customizable keyboard shortcuts. For mac.

Next Week:

We’re planning on finishing the bubble sort.

White-knuckle Whiteboarding Part 2 – Merge Sort

mergeToday I had J do a merge sort. This time I held silent. I managed to stay silent for 40 minutes while J worked on the code. This time through, the code is more robust and cleaner. J is showing more familiarity with arrays and sorting.

Feedback given today:

  • “Keep your left indentation clearer so others can follow along while you trace through the program.”
  • “Good to see you started manipulating the data before writing any code.”
  • “Now that you’ve explained how your code works, please run through the code with the sample data given.”

Check out White-Knuckle Whiteboarding Part 1 here

Magritte in the age of Augmented Reality

Everything we see hides another thing, we always want to see what is hidden by what we see. – Rene Magritte

I can’t shake this thought. Magritte’s paintings show a world that is undone. Images overlap and obscure other images. Loaded objects are pulled from obscurity and placed into a familiar scene.

In an episode of Black Mirror  people tune each other out when they don’t want to talk. The person is still visually there, but their speech is washed out and they appear grainy and unwanted.


Augmented Reality (AR) seems loaded. Like there’s an insidiousness within it that I can’t help but foresee. Dangerous potential lurks in projecting the coveted, desired, and wanted over the unwanted, unfortunate, unwashed, and unseen.

AR by definition edits out things.

How do we decide what cannot be edited out? How do we force people to confront truths as more and more technology exists to obscure it?

In order to see what we add, we must hide what was there before.

Swift 2.0 Essential Training notes

Playground supports markup
  //: Playground - noun: a place where people can play

import AppKit for osx
import UIKit for ios

source files in sources folder will be compiled once
image files in resources file will make those resources available to your playground

each page has its own sources and resources files

previous and next links allows us to go back and forth between pages

markup allows us to create links between pages.

semicolons are optional in swift.
  do not put them into the code.
  only time to use is when you have two statements on a single line

0..<64 means 0 to 64

NSLog still works. Good to use if you want a timestamp in your console

veratic function can take multiple parameters

print() default separator and terminator can be found in function definition

show graph of function by clicking on Show Result button in the result side bar

"//TODO:" inserts a bolded label in the jump bar


func printLiteralExpressions() {

	print("Function: \(__FUNCTION__)")
	print("Function: \(__FILE__)")
	print("Function: \(__LINE__)")
	print("Function: \(__COLUMN__)")
  Function: printLiteralExpresions()\n // name of this function
  File<EXPR>\n // does not work in named playground file but works in all source files
  Line7\n // line in source file
  Column:20\n // column in source file

Literal expressions are preceeded and succeeded by __ (2 underscores)


Create landmarks in swift playgrounds with the following one line comments:

// MARK: This is viewable in the jump bar
// MARK: - Add separator above this line
// TODO: Do this
// FIXME: Fix this

MARKUP: (make sure "render demarcation" is enabled in the right gutter )

## Header
### Header
> Block quote
* list item 1
* list item 2
1. List item 1
2. List item 2
`code format`
quick help comments
/// A quick help comment
Quick help multiline comment
- seealso: `someComplexFunction` // allows to embed link to function in playground


type swift in command line
press return
use up and down to shuffle through history
#> means waiting for input
#. means waiting for more input
Press tab for autocompletion in terminal
:q to quit
REPL can be started in the middle of a paused xcode app
  just type repl in console


use . notation to access property of class
use same . notation to set the property of a class
can chain multi dot notation
Good to cut up long dot notation like so:
  .print() // works because when compiler encounters . on line, looks for line above for reference


Swift has 2 types of values
  Value types (passed by copy)
	    Floating points
	    Tuples // forgetting what these are
	    Optionals // any datatype may have a value or be nil
  Reference types (passed by reference)
    **Closures // really want to focus on closures

Value types are passed by copy
  passed to a function
  changes to copy will not affect original
  value types are not copied until they are changed (implementation detail)
Reference types are passed by reference
  Uses a pointer to a reference
  Both pointing to the same exact instance

Variables are mutable (var)
Constants are immutable and cannot be changed (let)

Always create as constant if you don't need to change it later

Swift is a strongly typed language
Compiler will infer type of instance based on what is being assigned to it.

All types in swift should begin with capital
Variables and constants should begin wtih lowercase letter
Camel casing should be used to distinguish multiword types and instance names
Variable names and characters can be used with unicode and emojis!

Equivalent ways to explicitly state what kind of data type it is:

let aCharacter : Character = "a"
let bCharacter = "b" as Character // as operator literally casts the previous character

Write unicode scalars with \u <unicode value>
  let uWithUmlaut: Character = "\u{75}\u{308}"

When defining ints, use underscores to denote placement for easy reading
  1000000 can be written as 1_000_000
When writing an unsigned int:
  let anUnsignedInteger : UInt = 1_234_567

Float - 6 decimal precision
Double - 15 decimal place precision
  Use Double as default is recommendation from apple

Booleans are defined with true and false
  explicitly define your bools with let bool : Boolean = true


let binaryTen = 0b1010 // 0b
let octalTen = 0o12 // 0o
let hexTen = 0xA // 0x
let twelveMillion = 1.2e7 // 1.2 * 10^7

DEFINING TYPE ALIASES // option click to see what type it is aliasing

typealias IPOctet = UInt8 // use alias to lessen typing
  alias keyword followed by original word
let minOctetValue = IPOctet.min
let maxOctetValue = IPOctet.max

Type must be explictly declared when a value is not assigned on declaration

Constants accessed before defining value, will error.

Optionals allow us to declare
  suffix with a ?
    contains some value or nil
    nil is a valueless state
    empty string is not same as nil

Optional type is a box
  access a value we know has a string, must unwrap it.
  force unwrapping is used by following optional with !
  keeps your code as safe as possible.
  run time error will be cause if it is used unwrapped

String instances are passed by copy

M_PI is a constant imported in Foundation

print(String(format:"The %@ with a radius of %.0f", shape, radius))

String manipulation:

let quote : String = "In the end, we only regret the chnages we didn't take."
quote.hasPrefix("In the end") // true
quote.hasSuffix("Abraham Lincon") // false

let firstCharacter = quote[quote.startIndex] // gets substring

let eigthCharacter = quote[7] // does not work, will not accept int as index here
let eigthIndex = quote.startIndex.advancedBy(7) // use advancedBy method to get index
let eightCharacter = quote[eightIndex]
let lastCharacter = quote[quote.endIndex.predecessor()] // gets the eigth index

Insert and delete string componenets:

quote.insert("!", atIndex: quote.endIndex.predecessor()) // insert character at end of string
let period = quote.removeAtIndex(quote.endIndex.predecessor()) // returns last character in string

Create range:

To and including last number
  let aRange = 1...3
  let startIndex = quote.endIndex.advanceBy(-41)
  let range = startIndex..<quote.endIndex // creates range start to last number inclusive
  quote.replaceRange(range, with: replacementString)

Escape Characters:

\n - new line
\t - tab
\ - escape \ and "
\0 - null character

Swift has 3 formal collection types:

Default initializer:
var testScores = [Double]()
var testScores2 = Array<Double>()

Set array with multiple values at once
var scores = [Double](count: 4, repeatedValue: 10.0)
var scores2 = Array(count: 20, repeatedValue: 0) // element types infered by repeated value

Can be inialized wtih optionals
Pick a style that works for you and stick with it.

threeStooges.isEmpty // checks if has any elements
threeStooges.contains("Moe") // returns true or false

let twoStooges = threeStooger[0..<2].sort(>) // sorts array in ascending order

Arrays passed by copy

Use + to join 2 arrays.

myArray + ["David", "Shemp"]

// Nesting arrays

Break them into separate lines to make it look good.

print(famousGroupsOfThree.flatMap( { $0 } )) // flaten multidimensional arrays
// this is a closure function
// short hand argumenting

Store values of the same type in Dictionaries.
No redundant keys are allowed.

Declare Dictionary

var birthYears : [String : Int] = [:]
var raceResults = Dictionary<Int, String>()
var tourDeFranceResults : [Int:String]

Setting a value to nil removes it from the dictionary

Get all values in array


Modifying Dictionaries

Remove value for key returns key

You can nest dictionaries as well

Optional chaining
If any part is nil along the way to resolving the value, return nil.

Sets have a long form

var teachers = Set<String>()
var staff : Set<String> = []

When adding items to a set, any dupblicates will be removed.

Set supports count and isEmpty


Insert and remove values in Sets

Need to force unwrap arguments if the method does not accept an optional.

Defining Tuples

Group multiple values into a combinatorial value.

Useful to return multiple values from a function.

let httpStatus = (200, "Ok")

var playerScores: ([Int], firstName: String, lastName: String?)

Tuples can be accessed by index or by the name of the variable

**Tuples seem like a light-weight class replacement.

Add up the scores in tuples liek this:
let averageScore = scores.reduce(0, combine: +) / scores.count

Writing underscores for unneeded values can speed up compile time.

let (httpStatusCode, _) = httpStatus200

** use the letter t to switch lynda.com viewer from fullscreen to normal

Use dot notation to access nested tuples.

// Operators

Compiler will change int values to float implicitly

Division of integers will return an integer. Change one of those to a double and it will give you a decimal.

Swift modulus does floating point modulus as well!

a &+ 1
wraps around to maximum value.

Strings can use + and += to concatenate string

Arrays can use + and += to join two arrays

Instances of a class are passed by reference.

== checks for equality between operands
**=== checks if two operands are pointing to the exact same instance

Supports ternary operators ? true : false

Ternary operators can be nested like so:

let generation = birthYear < 1945 ? "Greatest Generation" : // switch statement is better than this
birthYear < 1965 ? "Baby Boomers" :
birthYear < 1982 ? "Generation X" :
birthYear < 1965 ? "Generation Y" :
"Generation Z"

**Coalescing operators
let defaultSize = "M"
var selectedSize: String?
let orderSize = selectedSize ?? defaultSize // not sure I get this one

Range operators

to but not including the ending value

let rangeA = 0..<10 // 0 through 9
let rangeB = 0...10 // equals 0 through 10 including 10

Type checking and casting operators:

Classes are reference types

class ClassB : ClassA // Class b inherits from Class A

let arrayOfClassInstances = [a, b]

item2 is ClassB // checks to see if this is an instance of the ClassB class type

// as! is a forced downcast
let classBInstance = item2 as! ClassB

// as casts a subclass as its superclass

let classBACtingAsClassAInstance = classBInstance as ClassA

[AnyObject]  // allows for any kind of class in the array
[Any] // allows for any kind of class or value in the array

Preceding zeros can be removed in a 0b00001010 binary value
rewrite as 0b1010

For loops do not need to be wrapped in paranthesis

for i in 0..<10 {

for _ in 0..<3 {  // underscore used here when the variable i is not needed.
print("I will not waste chalk")

// Stride method allows us to iterate through a loop at different step lengths between

for i in 3.stride(to: 30, by: 3) {

// print out key value pairs in an array

for (k, v) in people {
print("\(k): \(v)")

// iterat through values in a Set
for v in letters {

// iterate through array with conditional
for n in numbers where n.isPrime {
print("\(n) is a prime number")

//While loops

click blue play button in playground to re-execute the playground code

if statements don't need parenthesis

// if available

if #available(iOS 9, OSX 10.11, watchOS 2.0, *) { // stars indicate a wildcard. Parens required for #available()
    // Use applicable API from iOS 9, OS X
} else {
    // execute other API code if those platforms are not available

**// Optional binding

var firstName: String? = "Betty"
if let firstName = firstName { // set as constant

**// Guard statement

guard birthday.earlierDate(twentyOnesBirthday) == birthday
  else { // falls through if false
    print("\(name) is not old enough")

  print("\(name) can enter")

values assigned in a guard statement endure for the lenght of the guard statement.

// Switch

// create switch based on 2 values

let die1 = [1, 2, 3, 4, 5, 6].randomItem()
let die2 = [1, 2, 3, 4, 5, 6].randomItem()

switch(die1, die2) {
    case (1,1):
    case (6,6):
      print("30 points")

// Using Labels // NEVER GOING TO USE THIS!!!

var i = 0
let hello = "Hello, Playground!"

start: do { // here is the label
  do {
  if i < 3 {
    continue start // goto label

// Enums

Use dot notation to write out the enumeration quickly

// Defering code execution

if allSystemGO {
    defer { // runs only after the for loop completes and reaches end of if scope
      print("lift off!")

    for i in (1...10).reverse() {
      print(i, terminator: " ")

// Optional chaining

**if let marciasAge = hank.children?.first?.children?[1]. // if anything along the way is nil, whole thing is nil

//optional chain always returns an optional.

func sayGreeting(greeting: String, toName name: String) { // sets name with directive toName:
    print("\(greeting), \(name)!")

func addTwoIntegers(a: Int, _ b: Int) { //underscore suppresses the parameter name


func addTwoIntegers(a: Int, _ b: Int) { //underscore suppresses the parameter name
    return a + b

let sumOfIntegers = addTwoIntegers(3,5)

// set a function name to be reused

let integerAdder = addTwoIntegers // this sets the method to this new method name

let integerAdder: (Int, Int) -> (Int) = addTwoIntegers


let helloWorldSayer: () -> () = sayHelloWorld // keep in mind to keep off parens for the method itself

Void is just a type alias for an empty tuple

so it can be rewritten like this:

let helloWorldSayer2: Void -> Void = sayHelloWorld

// set methods with default parameters like this, set default parameter at end of parameter list.

func sayGreeting(greeting: String, toName name: String = "friend") { // sets with default param
    print("\(greeting), \(name)!")

sayGreeting("Hey") // now we can omit the name because it has a default value set on it

**veriatic parameters

**inout parameters // pass values by reference

// prefix argument with & to show that it is an inout parameter and passes by reference

// Create contextual help

Mutates passed in score
- parameter score: raw score
- parameter meanScore: average score
- parameter deviation: standard deviation

@available(*, introduced=1.2, depreciated=2.0, message="Use different version") // used to depricate a function

// Pass reference type parameter to function

Pass a function into another function:

func addTwoIntegers(a: Int, _ b: Int) -> Int {
  return a+b

func performIntegerOperation(operation: (Int, Int) -> Int, a: Int, b: Int) -> Int {
    return operation(a, b)

// rewritten to take a function instead of parameters

performIntegerOperation(addTwoIntegers, a: 10, b: 8) // notice we do not pass the parens, we pass the function name followed by a list of parameters

**// create nested function that returns function
  // requires returning an alias of the function that is created inside of the nested function

**// Currying

replace multiparameter fucntion with a single curried function

func addLineItem(product: String, price: Double)(quantity: Int) -> String {
    let discountMultiplier: Double
    switch quantity {

    return String(format.....)
let sellCustomTShirt = addLineItem("Custom Tshirt", price: 10.0)
var lineItem = sellCustomTshirt(quantity: 5) // here is the result of currying the function, can call with default vars and a single param

**// Error Handling