How Not To Code

ft. Taylor Swift


"We Are Never, Ever, Ever Getting Back Together"

The law of Demeter

A bad breakup?


Northwestern University

The Demeter Project

"a given object should assume as little as possible about the structure or properties of anything else"

a.k.a. "The Law of Least Knowledge"

don't let objects send messages to too many other objects

"...We are never ever ever getting
    back together,
You go talk to your friends,
    talk to my friends, talk to me
But we are never ever ever
    ever getting back together..."

var you =
new Scumbag();
// returns 'Uncaught Exception: This code sucks'


"Blank Space"

"Cause we're young and we're reckless
We'll take this way too far 
It'll leave you breathless
Or with a nasty scar
Got a long list of ex-lovers
They'll tell you I'm insane
But I got a blank space baby
And I'll write your name"

var blank = "";

var blank += yourName;

 # Ruby

print 'This is so fun!' if ''

# =>> 'This is so fun!'
// JavaScript

if ('') {
    console.log('This is so fun!');

// =>> undefined


AJAX roulette



"I Knew You
Were Trouble"

"I knew you were trouble when you walked in
So shame on me now
Flew me to places I'd never been
Now I'm lying on the cold hard ground
Oh, oh, trouble, trouble, trouble
Oh, oh, trouble, trouble, trouble"

Why is Taylor in so much trouble?

Because she didn't use a strongly-typed language.

public class Trouble{
  public Trouble(String name){
        "I knew " + name + 
        " were trouble"

  public static void main(String []args){
    Trouble you = new Trouble(“you”);

(I am not a Java developer)

What about dynamically-typed languages?

def fun_with_types(n)
    if n == 1
    elsif n == 2   
    elsif n == 3

can !== should


"You Belong
With Me"

"If you could see
That I'm the one
Who understands you.
Been here all along.
So, why can't you see
You belong with me,
You belong with me."

tight coupling

bad for feminism

bad for enterprise systems design

in conclusion

great singer

bad programmer

listen to Uncle Bob


How Not To Code, ft. Taylor Swift

By Denise Yu

How Not To Code, ft. Taylor Swift

Taylor Swift songs as cautionary tales about bad software design practices.

  • 3,154