Archive for the 'Javascript' 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 [...] -
2010.07.13
Why I still use PHP
posted in Javascript
Since december 2009, I work in an all Microsoft shop. Coming from a pure LAMP-world – both Python and PHP – the step was quite big to C#, VB and SQL Server. But I’ve grown to really like the technology stack. SQL Server is brilliant much because of SQL Server Management Studio, and I really [...]
-
2009.08.20
Separate concerns with queues
posted in Javascript
When you’re doing Javascript, you often find yourself listening to events, and then taking action upon what happened. Let’s take a classic example; the drag and drop effect. You have code that listens for the mousedown event which should signal that it’s time to start listening for the mousemove event. In the mousemove event listener [...]
-
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.09
AD Gallery – a jQuery gallery plugin
posted in Javascript
I got inspired by myself when I wrote the Editable Select plugin, so I decided to write another one. It’s a gallery plugin that’s a bit different than plugins like Thickbox and Lightbox.
You can see it here (it’s a work in progress, please be gentle).
After quite a lot of tweaking, bug fixing and making sure [...] -
2009.07.07
An editable select list plugin for jQuery
posted in Javascript
For a job I did for a client for a couple of months ago, there was a need for a select list that could be editable. I found a plugin for it (don’t remember where I found it, unfortunately), and it worked, kinda. So this morning, I felt like writing such a plugin from scratch.
It [...] -
2009.07.04
Closures in Javascript
posted in Javascript
Closures in Javascript are very powerful, and without them, you wouldn’t really be able to do very much in Javascript. They can be defined as in Wikipedias post about closures:
In some languages, a closure may occur when a function is defined within another function, and the inner function refers to local variables of the outer [...] -
2009.07.04
The beauty of this
posted in Javascript
I’d argue that you won’t love Javascript until you know about the “this” reference, and how to work with it. If you’ve done object oriented programming, you’re probably familiar with the “this” reference in some other language. But if you’re thinking that it works the same in Javascript as in your language of choice, you’re [...]
-
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 [...]
About the archives
Welcome to the archives here at The Coffeescripter. Have a look around.