Design Web Application Component and APIs
Design Web Application Component and APIs
Design Web Application Component and APIs
Application Components
USER
Logical Design – MVC Architecture
Model
• The Model is responsible for manipulating the data
• The Model represents the application core (for
instance a list of database records).
• In 4-tier architecture, Model is loosely coupled from
the database engine. That is, does not contain SQL
statements
• The Model represents the data structures. It will
contain functions that help you retrieve, insert and
update information in your database.
Logical Design – MVC
Architecture
View
• The View displays the data ( the database
records).
• In most Web Applications - the View is the sub-
component that produces the HTML page.
• But a View can produce a native application
front end as well
• View should be responsive to the front end
device sizes
Logical Design – MVC
Architecture
Controller
• The Controller is the part of the application that
handles user interaction.
• It manages the invocation of Model and View
requests
• Typically, a controller decides which View
component needs to be executed for the user to
interact with
• When the user sends a request, it decides which
Model(s) need to be used to service the request.
• When the Models respond, it again decides which
MVC in Web 1.0
Response times?
Richness of user interactive-ness?
MVC in Web 2.0
Response times?
Richness of user interactive-ness?
Single Page Application
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
Single Page Architecture
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
SPA Example
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
Why Businesses Love SPA
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
Pros of SPA
•Reduced throughput – Small sized JSON data
makes it amenable
•Fast response to low-speed
– Except for connections
initial
•Cachingload time
capabilities –
•Offline
Increasedoperations
performance – reduced
number
•Continuousof server roundbeginning
UX – Clear trips
UX, middle UX, end UX
•Adaptable layout. For mobile and other types
of devices
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
Cons of SPA
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
Mix of MPA and SPA
Ref: Pros and Cons of Building Single Page Applications in 2019 - Gearheart
Improving server’s performance
During HTTP method calls
•Stateless request : Keep Session state entirely on the client so that server does
not get overloaded when
•when concurrent clients are connected
Request headers: Pass additional instructions along with the request to tell the
server how to interpret the request. These might define the type of response required or the
authorization details.
•Cacheable: the data within a response to a request can be implicitly or explicitly labelled
as cacheable or non-cacheable so that similar repeat request can be avoided
•Repeated requests due to network failures :
Unpredictable response due to failures can be avoided by designing service capabilities with
idempotent logic that enables them to safely accept repeated message exchanges
Idempotency guarantees that repeated invocations of a service capability are safe
and will have no negative effect.
Idempotent capabilities are generally limited to read-only data retrieval and queries.
For capabilities that do request changes to service state, their logic is generally
based on “set”, “put” or “delete” actions that have a post-condition that does not
depend on the original state of the service.
Ref: What are idempotent and/or safe methods? - The RESTful cookbook (restcookbook.com)
HTTP Method – Response Code
• Easy to learn
• Easy to use, even without documentation
• Hard to misuse
• Easy to read and maintain code that uses it
• Sufficiently powerful to satisfy requirements
• Easy to extend
• Appropriate to audience