Andrey (azangru) wrote,
Andrey
azangru

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?
Subscribe

  • (no subject)

    A beautiful cartoon on the front page of The Week:

  • (no subject)

    This is just as bad as a brief exchange with a belligerent guest on a regular news show: Six minutes! Six minutes, during which Rand Paul is…

  • (no subject)

    The war on repetitions:

  • Post a new comment

    Error

    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.
  • 2 comments