Javascript Design Patterns - 1. The Singleton

1 03 2007

This being the first part of a series of posts that I plan to write (hopefully) I will provide bits of basics as well. So on the way to implement a Singleton pattern I also briefly show how to create classes and how to have public as well as private attributes and methods.

Read the rest of this entry »

, , , , , , , , ,


Installing Eclipse as your IDE for developing PHP webapplications

1 03 2007

During the last couple of month I had to install my development environment over and over again. On my private as well as on work computers. It took me a while to find the ideal setup for myself and in the process of that I tried and tested many plugins.

This is to describe my current Eclipse setup for developing web applications. Techniques used include Javascript, XHTML, CSS, PHP, MySQL, XUL and Subversion.

Read the rest of this entry »

, , , , , , , , , , , , , , , , , , , ,


Messaging - Object interaction on custom events

21 02 2007

message.js

How can we implement a messaging service in Javascript to enhance encapsulation of classes? This post shows my idea of the implementation and how to use it.

Read the rest of this entry »



Stair-climbing robot

8 12 2006

A friend of mine recently posted a puzzle he took from Lambda the Ultimate and asked several people to send in possible solutions in their favourite language. My choice was Javascript naturally and I’m quite fond of it. After some discussion the solution seems to be approved by everyone included in the original thread.

Your stair-climbing robot has a very simple low-level API: the “step” function takes no argument and attempts to climb one step as a side effect. Unfortunately, sometimes the attempt fails and the robot clumsily falls one step instead. The “step” function detects what happens and returns a boolean flag: true on success, false on failure. Write a function “step_up” that climbs one step up (by repeating “step” attempts if necessary). Assume that the robot is not already at the top of the stairs, and neither does it ever reach the bottom of the stairs. How small can you make “step_up”? Can you avoid using variables (even immutable ones) and numbers?


taken from Lambda the Ultimate.

Read the rest of this entry »

, , ,