javascript - Why do we need a Single Page Application? -


the single page application (spa) has come us. lot of new things come well, routing, page life cycle @ client side, mvc pattern, mvvm pattern, mv* pattern,... , of javascript patterns come amd pattern, singleton, facade,..

a lot of spa frameworks , libraries developed. can find out of on internet. angularjs, reactjs, backbonejs, durandaljs,.. , lot of third party components make javascript coding more easy requirejs, amplifyjs, breezejs...

but think why need spa? because it's seen introducing of new complex things in developing web application. inspite of spa, can use traditional web application, each request each loading page. see benefit can easy run on mobile , adapt new web application development trend. explain more that?

one more thing, if use lot of third party components composition 1 spa. make consistency web application? think should make complex maintain huge components inside our web application. how think that?

all suggestions welcome.


i believe direction websites should moving in considering number of devices users utilize today, , abilities , limitations of each.


important:

before reading rest of this, please understand concept built on foundation of basic principles of designing web. in order design single page application devices , situations, cannot run exclusively single page application. must build foundation work on basic of browsers highly limited features , enhancing user's experience according device's capabilities.

this may cause more work you, capable of satisfying larger , more diverse audience, more impressive throwing web app built modern desktop or phone browsers specifically.



decrease load time and/or weight

single page applications more capable of decreasing load time of pages , amount of data transfer server client.

some of heavily impacting features of method include :

  • storing global functionality once loaded first time,
  • allowing easier data transfer between pages , more complex user interface
  • removing cost of loading whole page after postback when need specific components

increased chance of on complicating

this design method may allow laziness in developer , more interference end user. developer, sure ui it's job (get, display , submit server) , server it's job (provide, validate , submit database). end users won't attempt break system using information in javascript file, including information data structure asking trouble in opinion.

start strong architecture!

as webpage, the processing of data can moved directly service handlers instead of pages result in architecture utilizing following layers:

  • database (data storage)
  • bl (data handling , transport)
  • user interface (data display , user interaction)

services on page handling

in opinion using services pretty requirement organized , modulated code in website. standard , post methods used in backwards compatible website can use these services hit services representing business objects instead of pages. this allows code more generalized across modules concerning same objects.

the update single page application becomes simplistic in can initialize ui pick or post methods , perform them using ajax methods instead of causing postback events, single page instance.

a side effect of using these services handle ui events eliminate need event handling in code behind file except life cycle events. life cycle events useful handling , modifying relevant data display based on situation modifying returned html lighten load on user's device.

deferred loading!

any complex website come complex modules , plenty of unique components.

a benefit gain using single page application have option deffer load time ajax process , whenever part of application (i.e. first attempt use module, dead time after initial page load, etc), making initial load faster , processing time more controlled.

my list of best practices

as best practices.. there quite few optimizations , should made design intending use method, such :

  • storing information comes, obliterating when no longer relevant
  • loading in script, html , js files through ajax when needed
  • using data loaded on 1 page in if can instead of reloading each new "page"
  • minimalist data structure ui since means displaying , not processing.
  • don't obsess validation on ui because services should built validate information submitted it

these optimizations helpful load time, data handling , object associations. not complete list, great head start building single page application.

finally, suggest researching concepts designing 1 web build solid foundation. after that, rest relatively simple enhancements. (tip: 1 of enhancements catch actions resulting in postback , use information build asynchronous call instead).

there sorts of information on this, , sorts of libraries use, but suggest using own code as possible basic functionality , get library code solves issues , research instead of trying implement complex system generic library code. using code example may lead smaller overhead , stronger code specific situation.

good luck!


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -