Andrey (azangru) wrote,

Here’s an example of something that I notice pretty frequently in recorded workshops.

Here’s this guy teaching javascript debugging (mostly basic stuff, but still has occasional interesting bits). To illustrate his points, he is using some demo Backbone-based app. The fact that it’s written in Backbone is, as the guy says, irrelevant. Still, at some point he goes on to explain memory leaks, and focuses on a bit of code, where Backbone views are being added to an array and then just left there. So he shows that the array holding those Backbone objects should have been cleaned. So far so good.

Then a student asks him about a function that he has shown on the screen (the `remove` function called on each Backbone view before clearing the array of views).

And then a srange thing happens. The guy is clueless about what this function does. "We could probably just get away with that," he says. The thing is though, those `remove` functions are crucially important for the topic of memory leaks that he is talking about. If not called, they will not disassociate Backbone views (no longer needed for the UI) from the DOM nodes that they hold on to, and so those views will not be garbage-collected. This is a classical example of memory leaks when using jQuery (or Backbone, which is jQuery based and is notorious for leaking memory). The fact that the teacher just glosses over this issue is embarrassing.

And things like that (instructors’ mistakes, I mean) happen all the time. What the actual fuck?

  • (no subject)

    On the dreadful state of the style of modern Russian communication. "There is no alternative", writes an author, and then immediately outlines an…

  • Via Twitter

    Via a tweet, but I thought I'd get my own copy. A beautiful illustration of how a caption totally misrepresents what's been captured in the photo.…

  • (no subject)

    Here's an extract from Uncle Bob's book Clean Agile. Although he has fallen out of grace with the champions of social justice, the sentiment…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.