Monday, August 22, 2011

TrollDad

From reddit

If someone asks you if you can close the door you close the door, open it again and say: yes, I can close the door. And walk back to your original position.

This is the kind of shit my dad does all the time.
Another of his favorites is, if someone asks you to move (or move a body part like "Move your arm") just wiggle around instead of actually moving out of the way.

Or the ever classic;
"I feel like a hamburger."
"You don't look like a hamburger."

Related (with my four year old daughter)
"I don't like hamburgers."
"They always say such nice things about you!"

I prefer: "They probably don't like you very much neither."

"Mom, can you make me a sandwich?"
"Well...okay. POOF! You are now a sandwich!"
-My Childhood

Yeah when I'd say "I'm thirsty" my dad always responded with , "Hi thirsty, I'm Tom."

"what's up?" "the roof" ....sigh

My dad's favorite is when I say "I'm bored." "Funny, you don't look like a piece of wood."

Monday, August 15, 2011

Why use factories?

I'd often heard / seen people using factories in programming. I never really understood the point of having a whole new class just for allocating/creating objects.

There is no reason to have only one factory class. The thing I missed is that the usefulness is obvious once you have two: one real one, and one that makes fake objects for testing the code that relies on the created objects. This allows easily injecting test objects into your tangle of production code/logic without changing the production code.

To really make this work, writing really testable code requires that you use a factory to create almost every object, and that factory might make real objects or test ones. This is the thing that requires constant effort / attention.

(You also don't need a different factory for each class. One for short-lived objects and one for long-lived ones is probably enough.)

Monday, August 08, 2011

Useful chrome shortcuts

Ctrl+Shift+I Dev Tools: Network
Ctrl+Shift+C Dev Tools: Inspect Element