Wednesday, 5 June 2013

Speeding up


Recently I have problems with speeding up. There are quite some things to do. Projects, things to check out, learn - neverending list. How do you solve them all the fastest? Not like when you're rather reading the page numbers in the book instead of the content.


First you have to know what do you want to do. Then you have to know when to quit. The huge problem with many new things is the benefit is buffering. You have to pay a lot of time and for a while it doesn't pay back at all. Then suddenly you realize how useful it was. Unfortunately I face with this symptom too many times. You just cannot simply code like the wind when you don't know the structure. I have to admit reading an introductory book always a great idea.
If my biorhythm would be a simcity I'd build it much better. 15m of sleep each hour. 2m of eating. 2m of brainless staring. Rest would be some ultrahigshspeed tech or whatevs.

Quite ironical that the less things I do the better I do them. Why it's not possible to have one thing? I just found a new video about Elon Musk - I absolutely love the guy - and started panicking when I can watch it. At the moment there is no reserved time for videos. I guess I mentioned the drawback of no cognitive load is that you're facing with elementary challenges quite a lot.

Accidentally I miscalculated my week. Today was only Wednesday. Tomorrow leg and Backbone day. One thing I like in London is that it's so high (~51° N) that Sun is almost always up. Have you seen that movie with the guy? He wakes up one day, and everything seems to be just like the previous day. And some on the following day. On and on. I'm rushing out the same 2 minute window each morning and see the same people, same cars, same buses and same everything. Only the weekly new receptionist that is indicating the progressing of time.

Also I realized there are coding patterns I don't feel good about. It feels like cheating. Disrespecting code. One is - I call - the traveller. You have a fix event callback but you want to push your custom function in a reusable way.
See jQuery's ajax error callback for instance:

jQuery.ajax({
  error: function (jqXHR, textStatus, errorThrown) {
  }
});

What you can do in order to achieve the aforementioned usecase is:

var errorHandler = function (callback) {
  return function (jqXHR, textStatus, errorThrown) {
    // Stuff.
    callback();
  };
};

jQuery.ajax({
  error: errorHandler (function () { /* stuff */ });
});

It's totally cheating, I'd dump the callback immediately.

---

Peter

No comments:

Post a Comment

Note: only a member of this blog may post a comment.