Question

In: Computer Science

Explain the architectural patterns-layered, client-server, and application architecture.

Explain the architectural patterns-layered, client-server, and application architecture.

Solutions

Expert Solution

Answer:-

Explain the architectural patterns-layered:-

Layered Pattern

The layered pattern is probably one of the most well-known software architecture patterns. Many developers use it, without really knowing its name. The idea is to split up your code into “layers”, where each layer has a certain responsibility and provides a service to a higher layer.

There isn’t a predefined number of layers, but these are the ones you see most often:

  • Presentation or UI layer
  • Application layer
  • Business or domain layer
  • Persistence or data access layer
  • Database layer

The idea is that the user initiates a piece of code in the presentation layer by performing some action (e.g. clicking a button). The presentation layer then calls the underlying layer, i.e. the application layer. Then we go into the business layer and finally, the persistence layer stores everything in the database. So higher layers are dependent upon and make calls to the lower layers.

You will see variations of this, depending on the complexity of the applications. Some applications might omit the application layer, while others add a caching layer. It’s even possible to merge two layers into one. For example, the ActiveRecord pattern combines the business and persistence layers.

Layer Responsibility

As mentioned, each layer has its own responsibility. The presentation layer contains the graphical design of the application, as well as any code to handle user interaction. You shouldn’t add logic that is not specific to the user interface in this layer.

The business layer is where you put the models and logic that is specific to the business problem you are trying to solve.

The application layer sits between the presentation layer and the business layer. On the one hand, it provides an abstraction so that the presentation layer doesn’t need to know the business layer. In theory, you could change the technology stack of the presentation layer without changing anything else in your application (e.g. change from WinForms to WPF). On the other hand, the application layer provides a place to put certain coordination logic that doesn’t fit in the business or presentation layer.

Finally, the persistence layer contains the code to access the database layer. The database layer is the underlying database technology (e.g. SQL Server, MongoDB). The persistence layer is the set of code to manipulate the database: SQL statements, connection details, etc.

Advantages

  • Most developers are familiar with this pattern.
  • It provides an easy way of writing a well-organized and testable application.

Disadvantages

  • It tends to lead to monolithic applications that are hard to split up afterward.
  • Developers often find themselves writing a lot of code to pass through the different layers, without adding any value in these layers. If all you are doing is writing a simple CRUD application, the layered pattern might be overkill for you.

client-server:-

lient-server is a relationship in which one program (the client) requests a service or resource from another program (the server). At the turn of the last century, the label client-server was used to distinguish distributed computing by personal computers (PCs) from the monolithic, centralized computing model used by mainframes.

Today, computer transactions in which the server fulfills a request made by a client are very common and the client-server model has become one of the central ideas of network computing. In this context, the client establishes a connection to the server over a local area network (LAN) or wide-area network (WAN), such as the Internet. Once the server has fulfilled the client's request, the connection is terminated. Because multiple client programs share the services of the same server program, a special server called a daemon may be activated just to await client requests.

In the early days of the internet, the majority of network traffic was between remote clients requesting web content and the data center servers that provided the content. This traffic pattern is referred to as north-south traffic. Today, with the maturity of virtualization and cloud computing, network traffic is more likely to be server-to-server, a pattern known as east-west traffic. This, in turn, has changed administrator focus from a centralized security model designed to protect the network perimeter to a decentralized security model that focuses more on controlling individual user access to services and data, and auditing their behavior to ensure compliance with policies and regulations.

Advantages and disadvantages of the client-server model

An important advantage of the client-server model is that its centralized architecture helps make it easier to protect data with access controls that are enforced by security policies. Also, it doesn't matter if the clients and the server are built on the same operating system because data is transferred through client-server protocols that are platform-agnostic.

An important disadvantage of the client-server model is that if too many clients simultaneously request data from the server, it may get overloaded. In addition to causing network congestion, too many requests may result in a denial of service.

Client-server protocols

Clients typically communicate with servers by using the TCP/IP protocol suite. TCP is a connection-oriented protocol, which means a connection is established and maintained until the application programs at each end have finished exchanging messages. It determines how to break application data into packets that networks can deliver, sends packets to and accepts packets from the network layer, manages flow control and handles retransmission of dropped or garbled packets as well as acknowledgement of all packets that arrive. In the Open Systems Interconnection (OSI) communication model, TCP covers parts of Layer 4, the Transport Layer, and parts of Layer 5, the Session Layer.

In contrast, IP is a connectionless protocol, which means that there is no continuing connection between the end points that are communicating. Each packet that travels through the Internet is treated as an independent unit of data without any relation to any other unit of data. (The reason the packets do get put in the right order is because of TCP.) In the Open Systems Interconnection (OSI) communication model, IP is in layer 3, the Networking Layer.

Other program relationship models

Other program relationship models included master/slave and peer-to-peer (P2P). In the P2P model, each node in the network can function as both a server and a client. In the master/slave model, one device or process (known as the master) controls one or more other devices or processes (known as slaves). Once the master/slave relationship is established, the direction of control is always one way, from the master to the slave.

application architecture:-

An application architecture is a set of constraints that you place on the design of an application.

The constraints you place on the application should be designed to make bad things hard or impossible, good things easy or possible.

Let me illustrate why this matters with a thought experiment. Imagine dozens of programmers at computer keyboards happily producing code, compiling, and running them. Every one of them gets to make their own design designs at any point in time.

How often do you think developers might conflict with each other?

Probably a lot.

An application architecture provides a barrier against nonsensical designs. Sure, lots of developers might not get to execute their designs, but the designs that do make it through the development pipeline have a better chance of being useful.

And yes, developers are responsible for design. Every coder has to make design decisions with every line of code they write.

A good application architecture will force a developer toward a design that is consistent with the overall goal of the business.


Related Solutions

Write a paragraph or two about which of five software architecture patterns (Layered Architecture, Event Driven...
Write a paragraph or two about which of five software architecture patterns (Layered Architecture, Event Driven Architecture, Microkernel Architecture, Microservices Architecture Pattern, and Space-Based Architecture) would be best given each scenario. Indicate which pattern would be used to implement the system and why it is the best choice. Use descriptions of how the various architectural characteristics apply to this system and pattern to support your decision as needed. The first system in question is a set of software drivers and...
Explain the key difference between a web service application and a general client/server application
Explain the key difference between a web service application and a general client/server application
Submit a DRAFT of ARCHITECTURAL DESIGN SPECIFICATIONS (designed with the Client-Server Approach).
Submit a DRAFT of ARCHITECTURAL DESIGN SPECIFICATIONS (designed with the Client-Server Approach).
What is a three-tiered client-server architecture? (operating system)
What is a three-tiered client-server architecture? (operating system)
The IT manager for the Credit Call Center is planning to implement a client/server architecture to...
The IT manager for the Credit Call Center is planning to implement a client/server architecture to support the operations of the call center. The owner of the company is content with the current setup and reluctant to allocate resources to a client/server architecture. You have been tasked by the IT Manager to explain client/server architecture to the owner and discuss the benefits and how it will help Credit Call Center in your explanation address What is meant by client/server architecture?...
Discuss in your own words what is meant by client/server architecture.
Discuss in your own words what is meant by client/server architecture.
In Java and using JavaFX, write a client/server application with two parts, a server and a...
In Java and using JavaFX, write a client/server application with two parts, a server and a client. Have the client send the server a request to compute whether a number that the user provided is prime. The server responds with yes or no, then the client displays the answer.
Draw the three layers of the client-server architecture of a chocolate company or Hershey and including...
Draw the three layers of the client-server architecture of a chocolate company or Hershey and including the content of each layer.
what will be the code in C programming for the client and server chat application for...
what will be the code in C programming for the client and server chat application for the below issue :- write the C Programming code that able client have a unique ID to be known by the server
Develop a client /server talk application in C or C++. You should run your server program...
Develop a client /server talk application in C or C++. You should run your server program first, and then open another window if you use loopback to connect the local host again, or you may go to another machine to run the client program that will connect to the server program. In this case you must find the server’s IP address first, and then connect to it. If you use loopback, your procedure may look like: ➢ Server Server is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT