Zurich Frontend Conference 2012 lightning talk
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
01.txt
02.txt
03.txt
04.txt
05.js
06.js
07.js
08.js
09.md
README.md

README.md

 ________________________
< Rise against the state >
 ------------------------
        \   ^__^
         \  (oo)\_______
            (__)\  λ    )\/\
                ||----w |
                ||     ||

@ikr - Ivan Krechetov

Problem: Software crisis

  • Complexity

    • Essential? (Brooks)
    • Accidental! (Moseley, Marks)
  • Main reason: state management

Place-oriented programming

  • Heritage of 70's; now irrelevant
  • Not how the real world works
    • Facts, not fact placeholders

Solution: functional programming

  • Places: bad; values: good
  • Referential transparency

Start small...


// :(

return $.extend(o, {foo: "bar"});

// :)

return $.extend({}, o, {foo: "bar"});

// :(

someDate.add(2, "months");
return someDate;

// :)

return someDate.aNewDateIn(2, "months");

// :(

function pluck(objArray, propertyName) {
    var result = [];

    for (i = 0; i < objArray.length; i++) {
        result.push(objArray[i][propertyName]);
    }

    return result;
}

// :)

function pluck(objArray, propertyName) {
    return objArray.map(function (obj) {
        return obj[propertName];
    });
}

// :(

this.foo = 42;
this.bar = seeminglyComplexCalculation(this.foo);

// :)

this.foo = 42;

this.seeminglyComplexCalculation = function () {
    return compute(... this.foo ...);
};

...read/watch up

The video of the talk

http://www.ustream.tv/recorded/25240687