Quote Calculator mini web application

I get many enquiries from my wheelbuilding site called Wheelbuilding with Arup now at version 4.2. The bulk of these enquiries are requests for a quote on having a set of wheels built. This takes me a little time looking around to find the best prices and then adding them all together to get the quote. Often the task can take me up to 20 minutes and it’s one that I have to do again and again. It is however one that I enjoy doing as I have a chance to look at bike parts and ride the wave of enthusiasm of someone about to build a new bike.

Quote Calculator

DRY – Don’t Repeat Yourself

In Agile software design they have an expression called DRY or Don’t Repeat Yourself. But it can be extrapolated beyond the realms of software. And here I am repeating myself answering emails that require much the same answer. So what about creating a draft and then sending that each time? But that wouldn’t work because even though the replies would be similar they wouldn’t contain exactly the same prices or parts. Wouldn’t it be great if prospective clients could get an instant quote? A fairly accurate figure on how much their wheel was going to cost them. That would be cool.

PHP training

During my PHP training I wrote a short script that calculated a sale adding tax and shipping. What about the same thing here? I wanted to make it really easy for the user so had the idea of select menus rather than input fields. All the prices and makes could be included in that list and it would also remove the need to create data entry validation checks. I could add new data as required into the arrays that hold the data and the user could see a full list of all the hubs, rims and spokes in the select menus. The data that I included in the arrays came from all the popular hub and rim choices made during 2008. I’m assuming that they will be similar in 2009.

Why version 1.1 rather than 1.0?

When I was more or less happy with my quote calculator tool I began to test it and noticed one major flaw: allowing the user to choose the number of wheels. This lead to a lot of inaccuracy. I wanted the hub choices to reflect exactly what was available on the market but that meant buying hubs in pairs. Only some are available singly and some are only available as pairs. So if a user chooses a pair of hubs and then a pair from the number of wheels option the calculator just doubled up the price of the hubs. I noticed this error just before I was about to go public.

I removed that choice completely and got the calculator to check if the user wanted one or two wheels by adding a keyword to the hub choices: front, rear or pair. Job done but it was a major change and so I called it version 1.1. A more accurate final value and improved usability. I also tidied up some of the code and sorted it alphabetically.

The MVC architecture

MVC or Model View Controller frameworks is an important concept in software design. It makes it much easier to implement, debug and maintain. This is only one script so what is the need for MVC? Again being a novice programmer I had not really considered this idea initially but looking at the finished script I noticed that I have neatly divided it into three distinct areas. At the top are the arrays containing the data, next comes the logic which adds up the various inputs and finally the views. These clear divisions make it easy to maintain. I can see where I am and if I wanted to expand it to add tyres for example it wouldn’t be too difficult. If the data arrays got too large for one script they could easily be moved to another file and called from this one. It helps to think in this way even for such a tiny little app.

Quite chuffed

I’m quite proud of myself even though it may be such a simple thing to an experienced programmer. I’ve created something to address a need and did it using skills that I have taught myself. Learn the web from the web, everything you need is available to you online.

One Response to “Quote Calculator mini web application”

  1. london sex contacts Says:

    Useful guide, Been looking for a easy to follow guide in basic aray features.

Leave a Reply