All of us would have started programming in java with the famous "hello world" program. If you can recollect, we saved the file with a '.java' extension and later compiled the program using 'javac' and then executed the program using 'java'. Apart from introducing you to the language basics, the important point is that it is a client-side program. That means you write, compile and execute the program in the client machine (i.e., your PC). No doubt, it is the easiest and fastest way to write, compile and execute the program. However, it has little practical significance when it comes to real-world programming.
Why Server Side Programming
Though it is technically feasible to implement almost any business logic using client-side programs, logically or functionally it server no purpose when it comes to enterprises application (e.g., banking, air ticketing, e-shopping, etc). To further explain, going by the client-side programming logic; a bank having 10,000customers would mean that each customer would have a copy of the program(s) in his or her PC (and now even mobiles) which translates to 10,000 programs! In addition, there are issues like security, resource pooling, concurrent access and manipulations to the database which simply cannot be handled by client-side programs. The answer to most of the issues cited above is-"Server Side Programming". Figure illustrates the Server Side Architecture in the simplest way.
Advantages of Server Side Programs
Some of the advantages of Server Side programs are as follows:
1. All programs reside in one machine called server. Any number of remote machines (called clients) can access the server programs.
ii. New functionalities to existing programs can be added at the server side which the clients can take advantage of without having to change anything.
iii. Migrating to newer versions, architectures, design patterns, adding patches, switching to new databases can be done at the server side without having to bother about client's hardware or software capabilities.
iv. Issues relating to enterprise applications like resource management, concurrency, session management, security and performance are managed by the server side applications.
v. They are portable and possess the capability to generate dynamic and user-based content (e.g., displaying transaction information of credit card or debit card depending on user's choice).
Types of Server Side Programs
The following are the different types of server side programs:
(a) Active Server Pages (ASP)
(b) Java Servlets
(c) Java Server Pages (JSP)
(d) Enterprise JavaBeans (EJB)
To summarize, the objectives of server side programs are to centrally manage all programs relating to a particular application (e.g., banking, insurance, e-shopping, etc). Clients with bare minimum requirements (e.g., Pentium II, Windows XP professional, MS Internet Explorer and an internet connection) can experience the power and performance of a server (e.g., IBM Mainframe, Unix Server, etc.) from a remote location without having to compromise on security or speed. More importantly server programs are not only portable but also possess the capability to generate dynamic responses based on user's request.