Skip to content
 

Introducing www.sofinummer.com

In the first days of january Dreamhost ran a promotion where one could get two years of hosting for about 20 dollars on which I acted. As part of this package came a free one year .com registration. I used it to registrer www.sofinummer.com on which I intended to implement a tiny web application that can be used to generate and validate BSN/sofinummers

I have tried to keep the site as simple as possible. It shows an oversized text input field that is used for both validating and generating numbers and a message box that shows if the input field contains a correct sofinummer. After generating a number the contents of the input field are selected for easy copy/pasting.

Initially I wanted to use Ruby and learn a little about Sinatra and Haml. When I found out that deploying was quite hard I decided to rewrite it in Javascript.

The javascript has been split in two scripts. The first handles the user-interface and uses jQuery to add some event handlers and to show/hide the message boxes. The second script handles validating and generating numbers. I’ve implemented generating numbers by simply taking a random number, validating it and retrying if incorrect. In modern browsers Javascript is fast enough to make a few tries before arriving at a correct number and this has the advantage that the code is kept simple and that the numbers aren’t pulled from a skewed distribution.

I’ve used TDD and QUnit when creating the second script, and the test suite has really saved me a lot of times. To test the user-interface I’m thinking of using Selenium as I want to get some knowledge of it.

As dutch bankaccount numbers use almost the same check I’ve also registered www.banknummer.com to check bankaccount numbers that are 9 decimals large. Perhaps one day I’ll extend this to bankaccount numbers that are 10 decimals large, or to SEPA numbers

Leave a Reply