Monday, January 27, 2014

Web Application Vs Client-Server Application - Sujan Ghosh

Can a simple question always have a simple answer? 

This brigs up a very simple but million$ question, often asked to fresher software developers or even to experienced IT professionals:
"Compare Web application with Client-Server application"

Lets focus on some of the common answers which are often received:

1. Web apps runs on a browser, client-server apps runs as .exe.
2. Web applications run on server, Client-Server apps run on client side.
3. Web application is thin client, client-server app is thick client.
4. Web application does not need to be installed in client system, Client-server apps need to be installed in client system
5.Web apps need low maintenance, client-server apps need high maintenance
6. Web apps are less secured, client-server apps are more secured.


Can we have only these words to compare a web application & a client server application? I agree in any interview we may not have hours to explain the differences but are we clear about our own conceptual knowledge? in most cases it has been found the basic concepts are not clear to IT professionals. 

Lets dig little deeper into this............. (mostly bullet points, I know paras are annoying)

Any client requirement (except few rare ones) can be developed using either web or client-server technology, so where exactly are the differences? Lets ask ourselves the following questions:
  • What are the factors which will decide which one to choose?
  • Does the choice depends on business requirement?
  • What are development & behavioral differences?
  • What are maintenance differences?
Do we have answers of the above questions? lets find out.

1. To choose between Web or Client-Server technology:

When to choose Client-Server
  • If the application need to be developed & implemented with very few target users.
  • The budget does not permit to invest on a server hardware 
  • Need rapid development and deployment
  • Need not be accessed beyond the local office boundary
  • A rich user experience
  • The application does not frequent version upgradation
  • Lesser IT budget for both development & deployment
  • No or limited availability of Internet connection
  • When the application need to be developed for a specific platform
When to choose Web
  • When there are numerous target users and need to be accessed from anywhere in world.
  • The budget is not restriction to invest on a server hardware, in which the application can be hosted.
  • Rapid development with limited UI functionalities, though modern IDEs provide rich UI look & feel
  • The application need to be updated & versioned frequently
  • High speed Internet connection available
  • IT budget is not a constraint, as some security equipments are needed in prod environment
  • When the application does not need to depend on users' platform. It only need to know the users' browser details.
  • Where there is no dedicated admin team to deploy the updated application in each client system
  • Application can be accessed over mobile.

2. Does the choice depends on business requirement:


As far as the functional requirements are concerned, it is not a major factor to decide between web or client-server technology.
But yes some non functional requirements (as mentioned above) stand as decision factors. Some of the specific UI need from client can also be a decision factor where a more complicated UI will suggest a client-server application.

3. What are development & behavioral differences:

The modern development does not differ much but behavior of a web & a client-server application differs lot. 

Development of Web & Client-Server Application

Most of the major IDEs support development of both web & client-server applications. The IDEs load & configure themselves based on the type of the project selected.

Modern tools & technologies support event-driven approach for both web & client-server applications. This make the developer's life easier, but certainly there are differences:

Web app
  • While developing web application we need to follow both server side coding (ASP/Java/Php) & client side coding (Vb script & Javascript). The client side coding eliminates postback of the application to server for small functionalities which can be performed on the browser memory itself. The javascript syntax will be same throughout the browsers.
  • The developers need to know the event sequence to understand the page life cycle.
  • While sharing data between multiple pages, the session memory need to be utilized. the session need to be managed by the server side coding whose syntax varies depending on the chosen IDE.
  • Web development supports application memory of the web server through which data can be shared between multiple users.
  • To make the UI compatible with all browsers, the CSS & common supportive features need to be utilized. This will make the web application independent of screen resolution.
  • Few modern technologies like Ajax & JQuery need to be implemented to improve the performance of the application, through partial postback.
Client-Server app
  • The developer need to know only the server side coding.
  • The developers need to know the event sequence to understand the form life cycle.
  • While sharing data between multiple forms the data need to be stored in public memory area, which can be accessed by all forms.
  • The client server applications are not really independent of resolution, where some distortion happens depending on the screen resolution. Few modern technologies render the UI using some special technique to make it independent of resolution.

Behaviors of Client-Server Application:
  • The app get compiled in form of .exe (assembly) file. The exe files when double clicked get executed which loads the compiled code (assembly) in the memory of the system where its been executed. Though latest technologies support just-in-time load of assembly in the memory, to avoid memory overload.
  • Any UI activity are responded from the locally loaded assembly, hence are faster in response. 
  • All data (variables) are stored within the memory of the loaded assembly (.exe). These in memory variables can easily be shared & accessed between multiple forms.
  • The in-memory variable data cannot be shared with other instances of the application in some other system.
  • Any request to external resources (database, service)are communicated & managed by the loaded assembly (.exe).
  • Any local references (.dll) are loaded within the memory space of the main assembly(.exe). This is termed as in-process communication and are always faster.
Behaviors of Web Application:
  • A web application gets compiled in form of .dll (assembly) or just in form of some pages (html).
  • The assembly(.dll) are loaded within the memory space of the web server. Separate memory are allocated for each user, so in case the app crashes for 1 user, it will not affect the other.
  • The web application need to be hosted in a web server (IIS, Apache-Tomcat). Once hosted the application will have an Uniform Resource Locator(URL).
  • The users need to access the application by typing the URL in a browser.
  • The request from the browser will reach the web server, which will be parsed and the response will be sent back to the browser in form of HTML. The HTML will be rendered in the user's browser.
  • Users' subsequent activity will be posted back to the web server and will pass through the same process sequence. This will have some performance degradation as it need to traverse between browser & web server & depends on Internet bandwidth on users' & server side.
  • All data (variable) are stored within the memory space of the web server.
  • Web server manages session for each user, and variable stored in session can be shared & accessed by pages between multiple postback.
  • Any request to external resources (database, service) are managed by the web server & the memory space allocated to a particular user. 
Web Application (source - ImaginetVenture)

4. What are maintenance differences:

Any application needs some maintenance activity when deployed in production environment. The maintenance activities may include:
  • Re-installation
  • Memory cleanup
  • App version upgradation
  • Hardware upgradation
  • Crash Post-mortem
The maintenance activity can be higher in multiples of n, in case of a client server application. 

In case of a web application as the application is hosted in a single hardware, all maintenance activities would remain concentrated around the single piece/cluster of hardware. 

Where as in case of a client server application the activities need to be performed in each 7 every piece of hardware, where the application is installed. 

As a result the post production maintenance cost is much higher for client server application compared to web application.


5. Summary:

While both desktop and web applications have their pros and cons, they are ultimately just the tools that people use to help them solve problems. For instance, we can work with electronic spreadsheets on your laptop using the Microsoft Excel desktop application or a web application like Google Docs. Both of them allow for basic spreadsheet editing, but the Google option requires a live Internet connection to work. To address this shortcoming, some web applications have developed offline capabilities that allow you to start work online and then continue later even if you are disconnected from the Internet. Some desktop applications also make use of technologies that were originally created to build web applications. 

As we can see, each type of application has its own benefits and weaknesses and can be utilized best within its own limit. I believe that both desktop and web applications will continue to coexist for a long time, or at least until the Internet becomes supreme and all computers become thin terminals that connect to their respective digital environments in the global cloud.