Friday, 4 June 2010

LongDivision ASP.NET Web-service application

Meanwhile i been reading "Beginning ASP.NET 3.5: in C# and VB" by Imir Spaanjaars in recent weeks in my quest to try and pick up web development. It seems a good read.

Here is my very first stab at writing a web service. It is a web service that utilises a class that i wrote for automating long division calculation. It is coded in C#. I felt such an application is a perfect way to introduce and familiarize myself to ASP.NET.


In school long division was common and useful back in the day for dividing very large numbers when a calculator was not available or allowed. However, it was always a pain to use and the calculations always took a while to work out, especially if the numbers were very large.

Basically we have a divisor and dividend. My application takes both these numbers as input, validates them and produces an automated end result showing the workings (just like it would be done manually by hand). The below is the input screen:


When the calculate button is pressed with the two input values in place, the result is generated and presented to the user (as a PNG image). Below is what the user will see.


I use the System.Drawing namespace to draw the output. This is drawn onto a bitmap and then converted to a PNG image suitable for view in a browser. The drawing of the output makes anything we are displaying more readable and presentable (especially any output data). Also, it enables us to draw the division lines and vertical lines etc.

I felt this application is quite useful and original in a sense because i have not seen any web services on the net at the current moment that automates LongDivision. The source code can be downloaded here if anyone is keen on seeing how it works.


Moving on with times ( ASP.NET )

For too long now i have been focusing my programming attention developing standalone applications. Nowadays it would appear most of the money to be made is in the web development segment. It has been this way for a very long time now. I suppose i can blame my lack of moving on the fact that when i first started learning to program it was at a time when standalone applications was all there was really, a time before web development (at least in an object oriented sense anyway) gained prominence. It was a habit more than anything. ASP.NET had not been invented. ASP (classical ASP) had merely just been invented or had not existed.


There is still a need for local application development in today' s society, but nowhere near on the mass scale that web development has brought about. Especially with ASP.NET. Nowadays there is a huge need for not just dynamic behaving web sites (they behave more like standalone apps) but web applications/services that can be invoked through them.


My main ambition is to move on to developing for profit and not just as a hobby. The best way to achieve this is without a doubt to move on into web development! The internet has really exploded in the last 10 years with the need for e-commerce, dynamic sites such as web shops and various booking systems that make money. Developers are needed to make them.


There is two ways to achieve this, via PHP (a scripting platform and more geared at open source) or ASP.NET (a true programming platform). I chose ASP.NET because in my opinion it is more superior. It is more recent, better for dealing with complex sites, is backed by a strong framework (.NET), a powerful IDE (integrated development environment), websites behave more like standalone apps as well and most importantly i can use C# (a language i have strong faith in its capabilities and develop standalone apps in anyway) to develop the sites in. This should not only make the transitioning more straightforward but give me access to an area where profit can be made since ASP.NET web development market is the most highly sought after at the minute.