Showing posts from June, 2011

Golden Rules of Computer Security

The three golden rules to ensure computer security are: do not own a computer; do not power it on; and do not use it.That's from computer security pioneer Robert Morris, who passed away recently.

Improved Many-to-Many Relationships in Dubbiya

A class has many students. A student has many classes. In data modelling, this is a classic example of a many-to-many relationship. Type "Student = Class" into Dubbiya, my nascent browser-based, HTML5-dependent entity-relationship modelling tool, and until today, you got a Student entity, a Class entity, and a line between them.The problem is, relational databases can't actually have real many-to-many relationships. You need to simulate them using an in-between table. Dubbiya now creates this for you:This reflects my intention that Dubbiya be a tool for physical data modelling, not logical data modelling.

Why No Alternatives to JavaScript?

This is a question whose answer I can't find.When you put some JavaScript in a web page, you use this syntax:<script type="text/javascript"> document.write("Hello World!") </script>You explicitly state that this is JavaScript.It's been 16 years since JavaScript was invented. Why have no alternative languages been developed and added to HTML? Clearly HTML allows for the possibility. JavaScript is a language created in ten days, launched without time to go through a "are we really doing this a good way" phase. Hence there are several bad things in JavaScript. An more rigorously developed alternative would be valuable.CoffeScript exists. But this must be compiled into JavaScript before adding to a web page.

JavaScript, Type-checking, and Preconditions

So JavaScript doesn't have type-checking. Which was the root source of a bug that took me a while to find.I'm so much more comfortable with strong type-checking. In many languages, I can create a new type, including its allowable values. In Java, for example, here's a type I created:public enum RelationshipType { ONE_TO_ONE, MANY_TO_MANY, ONE_TO_MANY, MANY_TO_ONE } Now I can specify that a function (method, actually) only accepts one of these four values wherever I need a relationship type.In JavaScript, a function parameter can be ANYTHING - number, string, array, or object. You need to manually check the values. Which leads to template code like this:function createRelationship(type) {
    if (!(type === 'one_to_one' ||
type === 'many_to_many' ||
type === 'one_to_many' ||
type === 'many_to_one')) {
throw 'IllegalArgumentException';

// now do the actual stuff for the functi…

Dubbiya with better logging

Having the big window for Dubbiya log messages was ugly. So I took some inspiration from modern computer games and put the log right into the main canvas.The last 20 log messages are shownYou can toggle the log on and off with Ctrl+LThe faded-out effect on the first message is intentional - a little experiment with HTML5 canvas gradients and rgba colours

Dubbiya now sorta working on iPhone

It turns out that Dubbiya, my entity-relationship diagram maker in-the-browser tool, works somewhat on iPhone and Android. But you couldn't move entities around. On a desktop computer in JavaScript you use mousedown, mousemove, and mouseup events to track what the user does with the mouse. Using these I've implemented the moving around of entities. On the iPhone, you don't have a mouse, and therefore these events don't work. However there are touchstart, touchmove, and touchend events. They are similar to the mouse events, but not quite the same. Now you can whip out your iPhone or (hopefully) Android device, or even (again hopefully because I ain't got a) iPad, open Safari, go to Dubbiya, and move the entities around by dragging them. While testing this, I dropped my iPhone YET AGAIN. Another crack opened in the case, another small piece of plastic flew off. I wonder how many more drops my iPhone can survive. The iPhone is roughly two years old, so maybe these…

Dubbiya Layout with Animation

Dubbiya, my fledgling browser-based ER diagram app, now animates the auto-layout. This is less jarring that the sudden jumping around of entities. Watch a demo (best in HD or full-screen):Try it here.

Animation in HTML5 Canvas

A friend pointed me toward an excellent one-hour presentation on creating games in HTML5. I applied the animation techniques I learnt from the presentation to Dubbiya, my experimental browser-based database entity-relationship project. Click the "Animation" button and the background text follows a trigonometric path across the canvas.Clearly this is not so useful yet. It is just a small test to understand the issues with animation in HTML5. I intend to use the technique to animate automatic changes to the diagram layout.

What is Dubbiya? Rethinking Entity-Relationship Diagrams

Dubbiya is the code name. I hope a better name comes to me soon. Suggestions welcome.My vision for Dubbiya:database design in the browser;that works WITH you;that doesn't involve fiddling around with lines and layout;that is as easy to use as drawing on a white board;yet looks damn attractiveA month ago, Dubbiya was nothing more than an itch to try out HTML5's new Canvas feature. Now it has become an embryonic project.I've been creating entity-relationship diagrams for years. First I used ERwin, which was powerful software with a clumsy user interface. It did the job, but you had to fight somewhat to get it done. Then came Visio, which I started using before Microsoft acquired it. This was a big step forward from ERwin for usability. Another product I've used and loved is SQLEditor for Mac OS X. It wins on simplicity and prettiness. The Mac world also has OmniGraffle, which makes pretty diagrams but doesn't have smarts about what an entity-relationship diagram rea…

Dubbiya now with auto-layout

I integrated my JavaScript graph layout code with Dubbiya. Now when you add an entity, the diagram is automatically laid out. At the moment it is a bit annoying because each time you add an entity the whole diagram changes. I think I'll experiment with anchoring some entities or introducing some animation that makes the jumping around less visually distracting.