State Management
State Management - Web Development
State
management is a key aspect of web development. It refers to the management and
storage of the current state of a web application. State management on both the
client and server sides is crucial for building robust and efficient web
applications.
The choice of state management approach depends on the specific requirements of the application, its complexity, and the development framework being used. Each approach has its own advantages and trade-offs, and the selection often involves a balance between simplicity, scalability, and maintainability. Let's understand the concept in details.
What State exactly mean?
In object-oriented paradigm, a class is used to model a real-world entity. An Entity is a person, place, thing or a concept about which one needs to store certain information and it performs certain actions. A class has data-members or fields to represent information about the entity being modelled. Memory is allocated for fields to store the information about the object or an instance of the class (called instance variable). Recall, a class is a mere definition and a user-defined datatype, to use it, the programmer creates its variable termed as object or an instance of the class in OOPs Terminology. In Object-Oriented Analysis and Design terminology (OOAD), a field of the class is termed as a State of an object. The state of an object holds the information of an object at that instance of time.
What is the need of State Management?
The application when executing creates objects or instances of class when required and destroyed when not required. Resources like memory, files or network connections, system resources like specific hardware are allocated to object when created and released when destroyed. The state of the object is to be maintained by the application. However, it requires that the application should be in continuous execution. Example – Windows Application is a continuously running application until it is closed.
Is State Management applicable to Web?
Web Applications are hosted on remote servers and accessed through an internet
using a web browser. It is based on client-server model. The communication is
in the form of Request-Response cycle. It is based on HTTP (Hypertext Transfer
Protocol) and it is a stateless protocol.
Web
Sites are not a continuously running application. It executes on server when
request from client comes for a particular interactive and a dynamic page. The
server may create many objects or instance of the class when generating the
dynamic page. The page once created is sent as a response to the requesting client
browser. The objects created are destroyed on the server. This is necessary
because the server is serve many client request from all over the world. Each
request will creates its own required objects which in turn uses server
resources. The Server will ultimately will run out of resources and will not be
able to serve the requesting clients.
Client-side State Management
Server-side State Management
Server-side
state management involves techniques to store and manage the state of an
application on the server, rather than on the client's browser. It is central
for maintaining the consistency and integrity of application data, handling
user sessions, and ensuring security. The common server-side state management
techniques uses Session and database to maintain state. However it uses
server-side resources.
Next, the State Management in Web Technologies - ASP.Net, JSP, PHP and Python wii be explored.
No comments: