Server Side Programming

Server Side Programming | It is a program that runs on a server dealing with the generation of content on a web page.

Why do we need server-side programming? Assume we develop a bank application using client-side programming, and the bank had 10000 customers. It means each customer should have a copy of the programs on his/her computer. In addition, there are multiple issues like security, resource pooling, concurrent access, and manipulations to the database which simply can’t be handled by client-side programs. The solution to most of the issues cited above is- “Server-side programming”.

The objective of server-side programs is to centrally manage all programs relating to a particular application example Banking, insurance, e-shopping, and e.t.c. Clients with bare minimum requirements like operating systems, web browsers, and internet connections can experience the power and performance of a server from a remote location without having to compromise on security and speed. More importantly, server programs are not only portable but also possess the capability to generate dynamic responses based on the user’s request.


Advantages of Server Side Programs

Know Program Img 24 Tablet Laptop

The important advantages of server-side programs are,

  1. All the programs reside in one machine called the server, therefore any number of remote machines (called clients) can access the server programs.
  2. To add new functionalities to existing applications, add programs on the server-side. The client doesn’t need to modify anything.
  3. Migrating to newer versions, architectures, design patterns, adding patches, and switching to new databases can be done at the server side without bothering about the client’s hardware or software capabilities.
  4. Issues related to enterprise applications like resource management, concurrency, session management, security, and performance are managed by server-side applications.
  5. They are portable and possess the capability to generate dynamic and user-based content for example displaying transaction information of credit card or debit cards depending on the user’s choice.

Server-Side Programming Languages Examples

The server-side web technologies are used to develop server-side web components. Examples of Server Side Web Technologies are:-

Server Side
Web Technologies
Given byPlatform
Servlet Sun Microsystems/Oracle Java
JSP Sun Microsystems/Oracle Java
asp (old)Microsoft .net 
asp.NetMicrosoft .net 
PHPApachePHP
SSJSNetscapeJavaScript
NodeJs, ExpressJsJavaScript

PHP:- Personal home page for hypertext processing/preprocessing
JSP:- Java Server Pages
ASP:- Active Server Pages
SSJS:- Server Side javascript

Know Program Img 39 web development

In the market, we also have frameworks to develop server-side web components. Using these frameworks we can develop server-side web applications very easily and fastly. Note that these frameworks are given on top of server-side web technologies.

Server Side
Web Frameworks
Given byPlatform
Spring MVC or
Spring-boot MVC
interface21
or pivotal team
Java
WebworkOpenSymphonyJava
ADFOracle Java
Asp.netMicrosoft.net
DrupalApachePHP
DjangoPython vendorPython

Currently, five dominant Programming/technologies or frameworks are used to develop server-side web components,

  • PHP:- It is used for small-scale websites. Example:- Movie promotion websites, car model promotional websites, blogs. WordPress is developed using PHP, and it is the most popular built-in tool to develop a website.
  • asp.net:- It is used for medium-scale websites. Example:- College, University websites.
  • Java technologies Servlet, JSP, and Java Framework Spring MVC:- They are used for medium and large-scale web application development where security and complexity are involved. Example:- Merchant websites like Amazon.com, Banking applications like citibank.com
  • NodeJS, ExpressJS:- Used for small and medium-scale web application development. Grabbed PHP and asp.net market. 
  • Django (extension of Python):- It came as an alternative to above all but did not succeed because of security and performance issues.

In modern days we can use JavaScript files as helper web components (form validation) and also as dynamic web components (server-side) in the case of Node.Js/ExpressJS.

Server Side vs Client-Side Web Programming

Server-side programming is used to develop server-side web components whereas client-side Programming is useful to develop client-side web components. 

The end-user types the URL in the browser address and generates the request. Web server software listens to that request and maps to appropriate web components of appropriate deployed web applications. Web component processes the request. The output/results generated by the web component go to the webserver.

After requesting a web component, if its code is executing in the web server itself then it is called a server-side web component. Example:- servlet component, JSP component, PHP component, asp.net component and e.t.c. 

After requesting a web component, if its code is coming to the browser from the webserver for execution then it is called a client-side web component. Example:- HTML file (HTML interpreter is available in the browser), Javascript code (JavaScript engine is available in the browser).

Note:- Don’t decide whether the web component is client-side or server-side based on the place where it resides, decide it based on the place where its code executes.

Let us understand it through Gmail. When we try to open the Gmail application from our browser then the browser sends a request to the Gmail web application. In the Gmail web application, some code is there which executes in the server itself to fetch all the mail for your Gmail id from their database. That code is an example of a server-side web component. After fetching the mail it is redecorated to HTML, CSS, and JavaScript files so that the end-user can easily read them (this work is also done by server-side web component). Finally, that file comes as a response to the browser and the browser executes them. This file is an example of a client-side web component.

Client-side Web Technologies

We have already seen examples of server-side programming language/technology/framework. Some examples of client-side web technologies are:-

Client-Side
language/technologies/frameworks
Given by
HTML W3C
CSSW3C
JavaScript Netscape + SunMicrosystems 
VBScriptMicrosoft
TypeScriptMicrosoft
AjexGoogle
jQueryJohn Resig
Angular/AngularJSGoogle
React/ReactJSFacebook
BootstrapTwitter
VueEvan You

Server Side Programming in Java

In Java to develop server-side components, we have Java technologies Servlet, JSP (Java server pages), and Java frameworks Spring MVC.

Servlet componentes are the Java class that are developed using Servlet API. The Servlet component is a Java-based component, whereas JSP components are tags-based components that are internally servlet components. The industry is using both servlets, and JSP technologies together in Java web application development. The JSP components are internally converted to servlet components.

To execute standalone Java applications we need JVM, to execute HTML code we need the HTML interpreter (browser), to execute JavaScript code we need the JavaScript Engine. Similarly, to execute Servlet components (code), we need a Servlet Container or Servlet Engine. For JSP components we need both Servlet containers and JSP containers. 

Every Java-based Web Server software like tomcat gives one set of built-in Servlet Container and JSP Container. We don’t need to arrange them separately, it came along with web server software. All Java web containers (like Servlet Container, and JSP Container) internally run on the top of JVM/JRE. Without JVM/JRE single line of Java code can’t execute, if it is executing it means either directly or indirectly JVM is involved.

In Java, when do we use technologies like Servlet/JSP and when do we use a framework like Spring MVC?

  • We use Java technology like servlet, and JSP to develop Java-based small-scale web applications. Example:- university websites, college websites.
  • We use Java frameworks like spring MVC to develop Java-based large-scale and complex web applications. Example:- e-commerce website, banking website, and e.t.c.

Process and Thread based Server-Side Web Technology

Server-side web technologies that are given to develop server-side web components are two types,
a) Process-Based Server-side web technology. Example:- CGI (Common Gateway Interface)
b) Thread Based Server-side web technology. Example:- Servlet, JSP, asp.net, PHP, and e.t.c.

Before going into detail you must know the difference between process and thread, process context switching vs thread context switching. Important note from there:- Process-based context switching takes more time compared to thread-based context switching.

Thread vs Process Context Switching

Process-Based Server-Side Web Technology

In process-based server-side web technologies for every request given to the web component, one separate process will be created. For 100 requests 100 processes will be created.

CGI programs can be written in different languages like VB, C++, PERL, and e.t.c. Among these, PERL is the best option. GCI programs are also web components like servlet components/JSP components having capabilities to generate web pages.

Process-based server-side web technology creates multiple processes for multiple requests. If we give a huge number of requests to CGI programs then huge numbers of processes will be created and a lot of time will be wasted only in the process context switching. Due to this reason, the overall performance of the web application will be very slow.

CGI-based websites give good performance for the fewer requests, but give bad performance when a large number of requests are given. Therefore the CGI-based web applications are non-scalable and a huge number of people can’t visit the website. Due to these disadvantages CGI based web application development is outdated and currently, no one is using it.

Thread Based Server-Side Web Technology

In thread-based server-side web technology for every request given to the web component, one thread will be created inside the process that represents the webserver or container. For 100 requests 100 threads will be created inside the same 1 process. In a thread-based web server whenever we start the webserver then one daemon process will be created. Examples of server-side web technologies:- Servlet, JSP, asp.net, PHP, and e.t.c.

Servlet in Java

Context switching between two threads of a process takes less time compared to context switching between two processes. Therefore the overall performance of web applications is good. The performance of web applications is good irrespective of the number of requests increased or decreased. This allows us to develop scalable web applications.

Example:- The servlet is a thread-based server-side web technology it means If we give 100 requests to 1 servlet component then the servlet container will create only 1 object for that servlet component and starts 100 threads on that object representing 100 requests. This makes the servlet component a “single instance – multiple threads” component.

If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!

Leave a Comment

Your email address will not be published. Required fields are marked *