Thursday, December 20, 2012

Software architecture

Let me understand the real difference between "tire" and "layer" terms commonly used in architecture.

tire - referes to physical entity that is PC(s) and Server(s)
e.g - client machine running webbrowser, app serve running the web app, database server hosting the database. 

layer - refers to logical entity that is a component
e.g. userinterface layer, business logic layer, data access layer, database layer etc.

The conventiona asp or servlets, jsp or any web app that returns the html content and on the other side queries the database with SQL queries may not be a pure layered architecture because of the overlap of the layer reponsibilities.

A clean layered architecture could be

client - html, javascript, css client talking with a webservice using HTTP GET or POST, all presentation logic is part of javascript and css

dataaccess - webservice interfaceing with database using stored procedure (not SQL queries) to access data and return the data to the client in JSON or XML formats.

database - servers the webservice for the requested data using the stored procedures

The client machines can be many, the webservice if stateless can be
hosted in many servers for scalability reasons, the database server could be hosted in redudant high end server machines for availability reasons.

There are three logical "layers" and 3-tires but actually involving "n" number of physical machines.

client-HTTP(GET/POST)->webservice-TCP database connection ( to execute Stored Proc) ->DB
client<-http database="database" font="font" recordset-db="recordset-db" webservice="webservice">
 
No HTML is exchanged between client and webservice. 
No SQL command is issued by webservice to DB.

The above is a clean layered and tired architecture if the client, webservice and DB are deployed in different machines.

Reference: http://msdn.microsoft.com/en-us/library/aa905336.aspx

to be continued..

No comments: