My New Blog

While the world of online poker remains in a critical situation, I’m spending time on a mini-project to learn HTML5 and the latest greatest JavaScript techniques. As I’m sure most of my Poker Copilot blog readers are not so interested in this, I’ve started a new blog to follow this project.


The Cost of Features


From JavaScript: The Good Parts

We see a lot of feature-driven product design in which the cost of features is not properly accounted. Features can have a negative value to consumers because they make the products more difficult to understand and use. We are finding that people like products that just work. It turns out that designs that just work are much harder to produce than designs that assemble long lists of features.

Features have a specification cost, a design cost, and a development cost. There is a testing cost and a reliability cost. The more features there are, the more likely one will develop problems or will interact badly with another. In software systems, there is a storage cost, which was becoming negligible, but in mobile applications is becoming significant again. There are ascending performance costs because Moore’s Law doesn’t apply to batteries.

Features have a documentation cost. Every feature adds pages to the manual, increasing training costs. Features that offer value to a minority of users impose a cost on all users. So, in designing products and programming languages, we want to get the core features—the good parts—right because that is where we create most of the value.

We all find the good parts in the products that we use. We value simplicity, and when simplicity isn’t offered to us, we make it ourselves. My microwave oven has tons of features, but the only ones I use are cook and the clock. And setting the clock is a struggle. We cope with the complexity of feature-driven design by finding and sticking with the good parts.



Things I’ve Learnt About JavaScript

I’m continuing with my HTML5 experiment. It now has context menus (aka right-click popup menus) and editable text. I’m still astounded how much one can achieve with little code. If one can work out the right code to use. For example, this single function is all I needed to write to implement context menus (with a little bit of additional CSS and jQuery support):

function dubbiyaPopup(x, y, items) {
var clear = function () {

$('.dubbiyaPopupOuter').css("left", x + "px");
$('.dubbiyaPopupOuter').css('top', y + 'px').fadeIn(200);
for (var i = 0; i < items.length; i++) {
var item = items[i];

var s = '#dubbiyaPopupItem' + i;
' + item.text + '
$('.dubbiyaPopupOuter').click(function (e) {
var id =;
var s2 = 'dubbiyaPopupItem.';
if (id.substring(0, s2.length) === s2) {
var num = parseInt(id.substring(s2.length));
var itemFunction = items[num].itemFunction;;

$(document).one('click', null, function() {

Although there’s not much code there, it took me a couple of hours to make it work properly. Actually, I’m not sure if it works properly because testing it properly is awkward.

I’m subjecting myself to a self-run crash course in everything JavaScript. Here’s what I’ve learnt:

  • JavaScript is almost certainly the most-used programming language on the planet. That’s because we all surf all day, and the only language that runs within a web browser is JavaScript.
  • JavaScript was created in only 10 days, under enormous pressure from his managers, by one person, Brendan Eich. This means it never got the chance to be tested thoroughly and refined. Eich, by the way, means Oak in German, and the Java programming language – which has almost nothing to do with JavaScript – was originally called Oak.
  • To make using JavaScript bearable, one should use a JavaScript library such as jQuery or Prototype.
  • The StackOverflow programmer’s Q&A site is indispensable for JavaScript programming.
  • JavaScript has some very good bits and some very bad bits. JavaScript : The Good Parts is important to read to work out which bits are good.
  • JavaScript is really hard to debug.


HTML5 and JavaScript

If you are not a programmer, this post won’t interest you.

I’ve continued a little on my HTML5 experiment, which you can see here if you are using the latest and greatest Firefox, Safari, or Chrome. I’ve added Undo and Redo – use [Cmd] + Z for undo, and [Cmd] + [Shift] + Z for redo.

Adding Undo and Redo seems complicated unless you know one of the proven software design patterns for implementing this. For example, the Command pattern. Each action, such as moving a shape around, has a Command object, which contains two methods: one to perform the move, and one to perform the undo. These are kept in an undo stack. When the user performs an undo, you pop the stack, call the undo method on the command object you popped, then push the command object onto the redo stack.

JavaScript makes it extremely easy to implement this, because of its first-class functions, aka lambdas; and the low-hassle way to create objects. Creating an object can be done on the fly without any class definition:

         function createCommand(name, executeFunction, undoFunction) {
     return {name: name, execute: executeFunction, undo: undoFunction};

It is similar to a factory constructor in Java.

Using that function, I can create a command to, for example, handle moving and undo for moving as follows:

        var executeFunction = function() {
shape.x = newX;
shape.y = newY;
var undoFunction = function() {
shape.x = oldX;
shape.y = oldY;
var command = createCommand(

After spending recent years programming mostly in Java and a little in Objective-C, I have mixed feelings about these JavaScript constructs. It is awfully easy and concise to code features such as Undo and Redo. On the other hand, the code lacks all type-safety features that catch many simple programming mistakes at compile-time.



Experiments with HTML5

I’ve put together a little HTML5 experiment in a web page that uses the canvas and local storage. If you are using Chrome 11 or Safari  5, try it here. Add a shape, drag the shapes around, close your browser, open it again, and return to the page. You should see the shapes exactly where you left them.

In the month since  Online Poker’s Black Friday, Poker Copilot sales have plummeted. Until there is some clarity in the online poker situation, I’ve switched into “maintenance” mood for Poker Copilot. That means I’m doing just enough work to fix significant issues and to help customers and potential customers solve problems. I’ve halted further development of new features.

This has given me some time to look into HTML5. I’ve seen some interesting HTML5 demos but I’ve always assumed they involved a mass of unreadable, unmaintainable JavaScript. Then last week I saw the Chrome-only browser-based version of Angry Birds and decided it was time to see exactly what HTML5 can do.

HTML5 leaves me flabbergasted. Amazed. Astonished.

You have a full drawing canvas with well-thought out graphics primitives. You can draw lines and rectangles, arbitrary shapes, Bézier curves, all with a range of strokes, fills, and shadows.

HTML5 also has “local storage”, meaning a web page can store stuff on your computer, and load it again when you return to the same web page another day. To save a object graph to local storage, you can do this:

localStorage["myData"] = JSON.stringify(myData);

To restore it, you do the following:

var item = localStorage["myData"];
if (!item) {
myData = ... make new stuff ...
} else {
myData = JSON.parse(item);



German Word of the Day: verschlimmbessert

Sometimes a German word just can’t be replace with an English one that has the same effect. From an email today:

it seems you verschlimmbessert it 😉

It is the German words for “to make better” and “to make worse” combined into one. It seems to mean that in trying to improve something you make it worse.


Ideas and Execution

Did you ever have some success starting a business? Then you may identify with this problem.

Often an acquaintance or a friend offers me an “idea”.

Them: “Hey, I have this great idea for a website. I’m so generous, I’ll give you the idea and I only want 50% of the millions you’ll make with it.” This happened three times last week alone.

Me (a little too snarkily): “I get to spend 18 months of my life bringing your off-the-cuff idea to life, refining it, reworking it, marketing it, selling it. An idea which may already have been turned into a successful website so often the market is crowded. Or is actually an unworkable idea. Or has no wide market appeal. And in return I give you 50% of the profits? Or is it 50% of the turnover that you desire? Have you done market research? A feasibility study? You _have_ googled to see if it is already available, right?”

Them: “Um, no, I just thought about it while waiting at the doctor’s yesterday. But I’m sure it will be very successful. Jeez, you didn’t have to be so negative.”

The reality: I’m not short of ideas. I have lots of ideas for software products and web applications. I have half-a-dozen small software prototypes on my computer. Ideas are nothing without a lot of dedicated hard work executing them. And even then, they may not work. I heard that at a certain software payments processor, the majority of all their clients never sell a single copy of their software.