When Should You Use A Single Page Application?

I am going to make this quick and give you the TL;DR. The answer is It Depends :;.

Love2Spa

I wanted to take a few moments to answer the question "When should you use a single page application?' Search online, attend one of my presentations or any modern web related developer event and you will notice this question being asked over and over. Heck I am asked all the time and my answer is the same , always.

Single Page Applications (SPAs) have been a thing for almost 7-8 years now. Of course they were not called SPAs till the past 3-4 years. I started toying with the concept back in the jQuery era or 2009. I started building my first professional SPA in late 2010. My second one launched with over 400 views and taught me so much and gave me confidence in the approach.

There is a common objection to using SPAs, search engine optimization. The objectors accept the false premise Google and other search engine spiders cannot index their content. Google recognized this as a problem back in 2009 and created an AJAX crawling specification.

In short the specification says a single page application should use hash fragment routes. Let those routes be converted to a queryString parameter, escapefragement_, that passes to the server. Use this parameter to render the content from the server. In essence this means keep maintaining a classic web site.

What is a Core Site and Should You Have One?

I combined this requirement with the need to support legacy browsers, leveraging a 'core site'. I found making a single page application work in Internet Explorer 8 was a loosing proposition. Architecting for a dying platform cost way too much. This approach limits the application's ability to leverage modern web standards and browser platform features. Worse developers rely on JavaScript polyfils mimicking modern features, but not as efficiently and of course add more weight, slowing down the application load and boot times.

As I wrote last month Google decided it is time to deprecate their AJAX crawling specification. Google now has confidence in their spiders being able to execute your rich web experiences.

Microsoft is dropping support for Internet Explorer 10 and earlier on January 12, just over a month from now. This is serious and there is no real way to get continued support for obsolete versions of Internet Explorer. If you need a legacy version you need to upgrade to IE 11 and start using Enterprise Mode ASAP.

For developers this releases us from the burden of including support for legacy browser platforms!

With these two policy changes happening almost on top of each other the need to maintain a classic web site, or core site, is dead. This clears the way for you to confidently build single page applications going forward.

Still there is much confusion on the Internet about how to properly build a single page application. Should you use a fast food framework or roll your own? I say neither. I have built and continue to maintain several SPA specific libraries and recommended architecture I call Love2Spa.

-SPAjs

-l2StorageCache

-DollarBill

My approach loads almost instantly over broadband and within mentally acceptable levels over GPRS on mobile devices. But this article is not about the technical details, it is about when you should use a SPA, the answer again is every time.

SPA Advantages

The advantage adopting a single page application gives you today is longevity and general user satisfaction. This means the capital costs you sink into a proper SPA enjoy a rewarding return on investment. It also means your customers and stakeholders should enjoy using the application more than a classic web site.

Higher customer satisfaction should correlate to higher conversions. This can be improved sales, newsletter sign ups or for internal line of business applications more productivity. These all directly increase the bottom line.

Having a modern application leveraging module architecture and a data API means it is easier to maintain and modify in the future. You can go longer before you rewrite the front-end. Plus a modular architecture is very friendly to today's DevOps IT culture and the cloud.

Another single page application advantage is they work across all platforms. Unlike native applications bound to a single platform. App store censorship and heavy transaction costs are also avoided.

Instead of 20-30% of the sale going to Apple, Google or Microsoft, a business merchant or PayPal account charges 1-3% per sale. Plus you can publish what ever you want, when you want. This is great for a continuous delivery cycle, not to mention quickly fixing bugs. I call this freedom.

SPA Disadvantages

Of course these advantages are dependent on you being able to develop, test, deploy and maintain the application. This is where we are very thin when it comes to skilled front-end web developers. Right now we are heavy with classic web site and back-end developers being asked to suddenly master user experience and browser internals. Unfortunately most ignore both points and try to create something mimicking back-end architecture.

The Future is Bright and There are Seasoned Resources

Fortunately there are a few, like me, working in the SPA world for over 5 years now. I have personally built or help build several hundred SPAs. This is why I can say with confidence I have not seen an application scenario in the past few years I could not see a SPA solution.

So the next time you need to start a new client facing application or rebuild a legacy application a single page application should be your choice for front-end user experience. I hope you will consider Love2Spa and my libraries as your choice for a fast, flexible SPA solution.

You can read about the philosophy behind Love2Spa in my now 2 year old book, High Performance Single Page Web Applications. Articles on this Blog, my Slide Decks and my book should be helpful in your SPA development journey. I also speak around the country every year. If you have an event you might want me to present feel free to ping me on Twitter. I am always open to some virtual consulting and virtual presentations.

Learn to love SPAs and adopt them for your client application solutions.

Share This Article With Your Friends!

We use cookies to give you the best experience possible. By continuing, we'll assume you're cool with our cookie policy.

Install Love2Dev for quick, easy access from your homescreen or start menu.

Googles Ads Facebook Pixel Bing Pixel LinkedIn Pixel