Stuff to be “proud of ”BSc 1st Class (Hons) Computer Science
Helped write two W3C standards
Written code for:
NASATescoChannel 4Three TelecomYahoo!
3 RULES TO LIVE BY
RULE 1.COMPLEXITY IS THE ENEMY
WHAT IS COMPLEXITY?
COMPLEXITY IS...
...TOO MANY FEATURES
...UNINTELLIGIBLE CODE
...CODE THAT DOES THINGS MORE THAN ONE WAY
...TOOMUCHCODETHATJUSTGOESONANDONANDRUNSTOGETHER
COMPLEXITY IS...
...ANYTHING THAT REDUCES UNDERSTANDING
WHY IS UNDERSTANDING SO IMPORTANT?
“BUILD TWITTER”
What is Twitter?
140 character micro-blogging service
AJAX web site
API
Scalability (sort of)
etc
“BUILD TWITTER” IS NOT UNDERSTANDABLE
COMPUTERS REQUIRE PERFECT INSTRUCTIONS
PERFECTION REQUIRES UNDERSTANDING
RULE 1A.HAVE A CLEAR GOAL
TANGIBLE OBJECTIVE
IT IS YOUR JOB AS DEVELOPER TO ACCEPT THE REQUIREMENTS
CLEAR OUTCOME
SUCCESS = ??
A WAY TO MEASURE SUCCESS
TDD
PUBLIC API
AGILE ALLOWS YOU TO FAIL FAST
FAILING FAST ALLOWS REDUCE COST OF DEFINITION
RULE 1B.WRITE CODE YOU* CAN UNDERSTAND
* and your team
function(a,b,c){return{pub:function(d,e){for(c in a)if(c.split("-")[0]==d)a[c](e)!==!1||delete a[c]},sub:function(d,e){a[d+--b]=e}}}({},0)
function(
a, // the subscription object b, // the current event number c // (placeholder)){
return { // return an object, with pub: function( // a "pub" function that takes d, // a channel name and e // a message value, ){ // and for( // for each c // subscriber in a // in the subscription object, ) if ( // if c // its name, with the event number discarded .split // by splitting it ("-") // with a hyphen and [0] // taking only the first part, == d // is equal to the published channel ) a[c](e) // call the subscriber. and if !== !1 || // the value returned is false delete a[c] // unsubscribe by removing the subscriber, and }, sub: function( // a "sub" function that takes d, // a channel name and e // a subscriber function ){ // and, a[ // on the subscriptions object, d + // sets the name of the channel appended with --b // a hyphen and the decremented event number, to ] = e // the function passed. } }}( // auto-run with
{}, // the subscription object 0 // and event id.)
LIKE “REAL” CODE
TERSE != BETTER
LANGUAGES ARE EXPRESSIVE
//this is JavaScript
var isTrue
if (true) {
isTrue = true
}
//still JavaScript
var isTrue = true ? true : undefined
ANOTHER EXAMPLE
var c = Math.floor(b)
var c = ~~b
YOUR BRAIN HAS MORE TO REMEMBER
FRENCH VS. ENGLISH
THERE ARE MANY REAL PATTERNS TO REMEMBER
DON’T ADD SYNONYMOUS PATTERNS
RULE 1C.PICK SOME CONVENTIONS
BE OPINIONATEDAS LONG AS YOU STICK TO IT
PLACE { AFTER )
function buildObjectLiteral()
{
return // this returns! { "someProperty": "hello" };}
STUPID ERROR
STUPID CODE
IF YOU PICK A GOOD STYLE YOU WON’T WRITE STUPID CODE