Click here to Skip to main content
15,890,897 members
Articles / Web Development

Architecture of Web Applications

Rate me:
Please Sign up or sign in to vote.
4.22/5 (6 votes)
15 Jan 2015CPOL3 min read 13.4K   4   6
Architecture of web applications

I consider software development more art than an exact science, and as such, in software development almost always there is not a single way of solving a problem. Although there are defined best practices, it is a matter of problem being solved and the knowledge of the team that influences most the definition of the architecture of web applications and software applications in general.

Recent years has brought to popularity using REST in the architecture of web application solutions. I am a huge fan of REST, I like it a lot mostly because of its consistent way of expressing CRUD operations and brings simplicity to the API implementation. The use of REST has been pushed further with advancement of MV* JavaScript frameworks as they tend to have a natural way of consuming resources from REST APIs.

Lately, I am seeing that most newly built web applications tend to use REST in some way, if not exposing APIs, they do consume one or more of them. In my opinion, REST tends to create a viral effect on developers, as much as you use it, you want more of it. Now after we experience REST, I think there is a question which pops up:

Do we have to expose everything as REST API?

The universal answer “it depends” applies here very well! If you want to use a client side framework such as AngularJS that does not need server-side code and is well suitable to consume REST services, it might be a very good idea to expose the whole business logic as REST API and consume it through AngularJS services. This comes with an additional benefit that if you want to have a mobile app of your web application, you do not have to write any additional code on server-side to support your mobile app, just consume the very same REST services and you are good to go. A diagram representation of such layered architecture of web applications could look like this:

Web application architecture with REST API and client side MV*

This is one of the most often used architecture styles I am seeing these days in web applications. However, what if you are not keen on using MV* JavaScript frameworks and want to use a server-side backend and generate your HTML representation using let’s say ASP.NET MVC. Do you still need to expose business logic as REST API?

Exposing business logic as REST API or any other form of service layer, if you do not have multiple types of consumers (web, devices, etc.), in my opinion is waste of resources (time and effort). Exposing and consuming services do introduce a level of complexity (you need to put extra effort on error handling, security, versioning, asynchronous access, etc.) to the architecture and application code. This complexity is non considerable if you have multiple consumers of your application as it avoids writing the same functionality multiple times, however, if there is only one consumer and it is the web GUI, then in my experience I have seen that it only makes things worse. In such a situation, going with an old style server-side backend is a lot more easier. If you say I have a mobile client as well which consumes part of the functionality, in that case I think it is better to create a small REST API service group exposing only that part of the functionality, is a better choice. This will also allow you to develop your web app and mobile app in different paces (if you have lack of developer resources, you shall come to this requirement). The modified version of our new architecture will look like this:

Web application architecture with server-side backend and rest api

Sometimes, we are keen to jump to new technologies and architecture styles just because its presentation looks attractive and we like to get our hands in it and give it a try. Often, this pushes us to situations which makes maintenance of our code base difficult in later stages of our application lifespan. It is very important that evaluation of the application architecture be done as early as possible and be judged from the simplicity and maintainability perspective.

The post Architecture of web applications appeared first on arian-celina.com.

This article was originally posted at http://arian-celina.com/architecture-of-web-applications

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Albania Albania
I am a Software Architect, a web developer, and a Computer Science lecturer. I enjoy solving business problems by providing software solutions to them. My favorite technologies and fields of interest include ASP.NET, C# programming language, Java programming language, Javascript, jQuery, AngularJS, Web Services, REST, and mobile application development

Comments and Discussions

 
GeneralMy vote of 3 Pin
DarthFrost16-Jan-15 13:51
DarthFrost16-Jan-15 13:51 
GeneralRe: My vote of 3 Pin
Arian Celina17-Jan-15 0:59
Arian Celina17-Jan-15 0:59 
GeneralA seemingly small question, but big implications Pin
David Days16-Jan-15 9:03
professionalDavid Days16-Jan-15 9:03 
I work on integrating large data systems (legacy and modern CRM), and backend-to-backend development is fairly straightforward; when you start putting people or multiple service consumers into the mix, then the "artistic" design requirements go way up. I think you hit a common problem very precisely, and you have a very good point--lots of things are ending up as RESTful services because, well, "we do REST..."

REST is a nice way to expose an endpoint/service/business process if you have (or envision having) more than one kind of consumer of that service. But, as you say, it brings along a whole plethora of other design requirements (security, concurrency, resource usage, etc.)

Thumbs Up | :thumbsup:
vuolsi così colà dove si puote
ciò che si vuole, e più non dimandare
--The answer to Minos, and the question "Why are we doing this way?"

GeneralRe: A seemingly small question, but big implications Pin
Arian Celina16-Jan-15 9:24
Arian Celina16-Jan-15 9:24 
QuestionTagged as ... Pin
Member 374629215-Jan-15 3:55
Member 374629215-Jan-15 3:55 
AnswerRe: Tagged as ... Pin
Arian Celina15-Jan-15 5:25
Arian Celina15-Jan-15 5:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.