We have two approaches to build web applications in current time: Traditional web applications
and Single page applications (SPAs)
. Traditional web applications perform most of the application logic on the server side
whereas single page applications (SPAs) perform most of the user interface logic
in a web browser. Single Page Application communicate with the web server primarily using web APIs.
When to Choose Traditional Web Pages
We can use below factor to use Traditional Web Pages.
1. Application is simple and very less user interaction
Many web application has very less user interaction like google.com, where user only search any query and they get result in result box below it. No other interacteion is done here.
Similarly we have may blog or articles sites, public facing content management system these are fit for this criteria. In these sites, any user can visit, search any content and see content as per their interest.
2. Application need to work without any JS framework
Web applications that need to function in browsers with limited or no JavaScript support should be written using traditional web app workflows .SPAs require client-side JavaScript in order to function; if it’s not available, SPAs are not a good choice.
3. Development team is unfamiliar with JavaScript or TypeScript development techniques
If your team is well versed with server-side web application development and there is lack of knowledge about JavaScript or TypeScript framework. In that case team will probably be able to deliver a traditional web app more quickly than a SPA.
Unless learning to program SPAs is a goal, or the user experience afforded by a SPA is required, traditional web apps are a more productive choice for teams who are already familiar with building them.
When to Choose Single Page Application
We can use below factor to use Single Page Application.
1. Application must expose a rich user interface with lots of features
SPAs can support rich client-side functionality that doesn’t require reloading the page as users take actions or navigate between areas of the app. SPAs can load more quickly, fetching data in the background, and individual user actions are more responsive since full page reloads are rare. SPAs can support incremental updates, saving partially completed forms or documents without the user having to click a button to submit a form.
SPAs can support rich client-side behaviors, such as drag-and-drop, much more readily than traditional applications. SPAs can be designed to run in a disconnected mode, making updates to a client-side model that are eventually synchronized back to the server once a connection is re-established. You should choose a SPA style application if your app’s requirements include rich functionality that goes beyond what typical HTML forms offer.
2. Development team is familiar with JavaScript and/or TypeScript development
Writing SPAs requires familiarity with JavaScript and/or TypeScript and client-side programming techniques and libraries. Team should be competent enough in writing modern JavaScript using a SPA framework like Angular.
3. Application must already expose an API for other (internal or public) clients
If you’re already supporting a web API for use by other clients, it may require less effort to create a SPA implementation that leverages these APIs rather than reproducing the logic in server-side form. SPAs make extensive use of web APIs to query and update data as users interact with the application.
Based on above points, we can consider below decision points
Factor | Traditional Web Page | Single Page Application |
---|---|---|
Required Team Familiarity with JavaScript/TypeScript | Minimal | Required |
Support Browsers without Scripting | Supported | Not Supported |
Minimal Client-Side Application Behavior | Well-Suited | Overkill |
Rich, Complex User Interface Requirements | Limited | Well-Suited |