Skip to content

Instantly share code, notes, and snippets.

View theotherzach's full-sized avatar

Zach Briggs theotherzach

View GitHub Profile

Pressure

Stop your code from shattering.

Our code is put under immense pressure

Fat JavaScript apps enforce a separation of concerns between Ruby domain logic and the presentation layer

When we refactor a model we have to make changes in the views by default.

describe "Bowling Scorer", ->
describe "gutter game", ->
Then -> expect(game.roll(0, 20).score()).toBe(0)
describe "all 1's", ->
Then -> expect(game.roll(1, 20).score()).toBe(20)
describe "spare", ->
Then -> expect(game.roll(5, 2).roll(3).roll(0, 17).score()).toBe(16)

Computering With JavaScript

Building large systems is devilishly hard and all evidence points to us still being bad at it. Since the dawn of electronic computation, the relative effort required to maintain legacy systems has continued to increase, which suggests that we are not solving the problem on our own.

One potential solution could be propagators; a mesh of independent systems who individually listen to neighboring propagators and produce increasingly refined outputs. A system such as this would be more flexible than a traditional system, suggesting that change requests and maintenance could be less expensive.

This talk makes the case that our current development methodologies are unsustainable, introduces the concept of propagators, and shows what a propagator network looks like when written in JavaScript. Hold on because there's code, math, bold claims, and wild-ass-guesses ahead.

Broken

Have you noticed how nobody is talking about being outsourced anymore? Does it seem odd that the crisis of our generation is dealing with the recruiter calls? You know, people who want to give us money. Have you stopped to wonder why the times are so good?

The demand for us is so high because the systems we build are so broken.

Each decade we spend an increasingly large proportion of our effort maintaining legacy systems from the previous decade. We continue to throw abstractions at this labor devouring monster, but it shows no signs of slowing. Higher level languages, type systems, DSL's, TDD, and many others have been developed to increase our productivity but they are not enough.

The way we preform computation today is fundamentally broken. Every instruction that is added to an existing program reduces the chance of it executing properly and increases maintenance and change cost in a super linear fashion. Each line of code in production makes our systems worst and our response is to write mor

Frontend Performance

It is quite possible to instrument and collect timings from our front end code. Suddenly we've got just as much insight into our frontend code as our backend and optimize accordingly.

We want to use the native browser performance api where possible and fall back to Date.now() when it's not. Luckily a polyfill library exists already - User Timing

The first step is to instrument the actual JavaScript.

toggleAllComplete: function () {
  var elapsedTime,

Broken

Maintenance is the primary cost of software systems. What we build is brittle and ill suited for even minor changes.

Maintenance as a % of the total cost by decade.

  • 35-40% in the 70's
  • 40-60% in the 80's
  • 70-80% in the 90's

The consequence of this is an exponential increase in the cost of building systems as they grow.

class Today
WEDNESDAY = 3
def self.wednesday?
Date.today.wday == WEDNESDAY
end
end
parse: function(response){
return response.notifications.map(function(e) {
return e.notification;
});
},