Archive for the 'Object Oriented' Category

  • 2010.08.08 Dependency injection and IoC in Javascript posted in Javascript, Object Oriented

    There has been some talk lately about DI and IoC in Javascript, and other dynamic languages such as Ruby and Python. A popular opinion seems to be that these concepts are obsolete in dynamic languages, mainly because you can alter an object at runtime. This certainly makes testing easier, but testability isn’t the main goal [...]

  • 2010.07.31 Inheritance in Javascript posted in Javascript, Object Oriented

    Javascript is a very dynamic language, and you can implement inheritance and code reuse in multiple ways. Lately, I’ve grown fond of what Douglas Crockford calls Parasitic Inheritance.
    By using parasitic inheritance, you can avoid using the new operator all together. The new operator isn’t evil, but it’s problematic in that if you write a function [...]

  • 2009.08.13 A Javascript OO gotcha posted in Javascript, Object Oriented

    Every now and then I run into this issue when I’m do OO in Javascript. It creates really wierd bugs that can make you want to rip you hair off (I have no hair left…), so I thought it might be a good idea to share it. It all boils down to the fact that [...]

  • 2009.07.02 Building a Javascript clone of Civilization, part 1 posted in Javascript, Object Oriented

    So I thought it might be fun to build a game in Javascript, and not just some dead simple game. As I was younger (because I’m so old now) I liked the games Civilization and Colonization a lot, so I wanted to try to make a clone of them, using Javascript.
    I decided from the start [...]

  • 2009.07.01 Automatic getters and setters in Javascript posted in Javascript, Object Oriented

    When you’re working with object oriented code, writing those dumb getters and setters can be a bit of a pain, since they’re just getting and setting simple values most of the times. So I thought I’d bring in some magic to my Javascript classes to generate these methods.
    I’m using John Resigs Simple Javascript Inheritance to [...]

About the archives