The most important thing in a web application is finding a way to get information from the client (a browser) to the server. And as a developer I have to do this task (moving information around) in an efficient way and without dying of boredom doing it.
So I've found a way, my way. Perhaps there are better ones, but this is mine. I use JSON for data communication, and HTML/CSS for presentation (nothing new). But I do that separately. JSON is usually generated at the server and transported with AJAX, and joins the HTML in the browser. HTML is only loaded once, and then only JSON is moved between client and server. This way it is easy to maintain the form state, because it's static (remember, HTML only loads once).
To avoid dying of boredom in the task of retrieving the value of 40 fields of a form (for example), load the 40 values in 40 parameters of a stored procedure. I do that with serialization/deserialization. I have a software tool that automatically creates a mapping between controls and values, so I don't mind having 5 or 50 fields in a form because the tool will deal with that. As a developer I only have to do fine tuning, putting a calendar, a combo, cascade combos, some business logic, etc. The heavy lifting is done by a tool.
In order to access a database (DB) I use stored procedures (SP) and in order to create those SPs I also have a tool that creates them, and a class in C# that invokes those SPs (clsDades)
To connect the client (browser) with the class that invokes the SPs I use ASHX, with very good results in a lot of projects (some big ones and a lot of little ones).
Printing is usually the weak point of web applications, and I've found a solution using PDFs. The problem here is how to create this PDFs, I use HTML and later I convert it to PDF using a library from Winnovative. If there are a ton of PDFs to do, and the result the PDF is too big to move around in a web environment, I resort to a desktop application that does only that.
So the architecture of a web application is something like the next diagram.
In future posts I will deal with all of these parts, and how are they built.
#18/02/2014 12:01 Programming Author: Alex Canalda