Demystifying closures

In JavaScript, closure is a very handy technique that allows a function to retain a reference to variables from its parent scope. It can be confusing though as to how this is achieved, and how to make the best use of it.

Using photos from other sites

Web development can be an image-heavy process, so the discussion around using photos from other sites has really taken off and helped people to understand issues around copyright.

There are lots of stock photo sites that allow you to buy the rights to use certain images, and a Google Image Search even has a usage-rights selection so that you can search for images that you’re allowed to use.

One of the fundamental ideas that came up in the thread is that you’re free to use photos that you’ve taken yourself, but when it comes to photos that other people have taken, you need to discover the license that’s on the photo. Once you’ve done that and the license allows you to use it, or you’ve paid for the right to use the photo, it’s all on from there.

Dependency injection breaks encapsulation

A long-running and at times controversial discussion on dependency injection has renewed, with the aim of having a civilized discussion about whether dependency injection breaks encapsulation, and if there are times that dependency injection (DI) may not be useful.

From the discussion it seems that if you’re intent on staying away from DI you then end up with having spooky action at a distance, where a class has secret unknown hooks into other areas that you weren’t aware of.

It’s difficult to find good examples against DI, as using that technique results in portable code that can benefit multiple people in different situations. It seems that there really are few options when you want to increase the reuse of code and reduce maintenance costs.

Some of the more useful article links that came up in this discussion have been:

I'm a web developer living in Christchurch (thanks for all the quakes) where JavaScript is my forte.
When off the computer I volunteer down at the local community centre, or enjoy playing tabletop games such as Carcassonne or Stone Age with friends.