This document discusses single page applications (SPAs). It begins with an introduction to SPAs and their motivations, such as improved user experience through reduced page reloads. It then compares SPAs to traditional multipage applications. Popular JavaScript frameworks for building SPAs are listed. The document concludes with recommendations for getting started with SPAs, such as choosing a framework and practicing best coding practices.
2. Who am I?
26/05/2017Single Page Applications Mónica Rodrigues
Mónica Rodrigues
Degree in Computer Science Engineer at ISEL
Software Engineer since 2010
Keywords: Web Applications, ASP.NET MVC, ASP.NET Web Api, REST, Javascript,
Angular, Best practices, Design patterns, Clean Code, SQL Server
3. Contents
26/05/2017Single Page Applications Mónica Rodrigues
What is SPA?
Motivations / Considerations
Multiple Page Applications vs Single Page Applications
Frameworks Javascript / SPA Samples
What I need to begin?
Best practices / Recommendations
4. First page – Long time ago
26/05/2017Single Page Applications Mónica Rodrigues
6. Challenge
26/05/2017Single Page Applications Mónica Rodrigues
Users want a central place to view or take
actions on most or all content so they don’t
have to waste time navigating between pages.
8. Solution
26/05/2017Single Page Applications Mónica Rodrigues
Use modern web development techniques to build a single-page app that doesn’t need to reload itself as
the user browses through it.
SPASingle Page Application
9. Motivations
26/05/2017Single Page Applications Mónica Rodrigues
Reach
Web app may be accessible on different platforms and devices
Round trip
Web app not require many round trips between client and server
Better user experience
Separation of responsibilities between client and server
10. Considerations
26/05/2017Single Page Applications Mónica Rodrigues
The first time that the application loads is slow
Maintain Navigation, Deep linking and History
SEO (Search engine optimization) is complicated
13. SPA and Multiple Page Application (Mix)
26/05/2017Single Page Applications Mónica Rodrigues
Products Page
Mini
SPA
Categories Page
Mini
SPA
Request Data
Request Data
Response Data
Response Data
16. What I need to begin?
26/05/2017Single Page Applications Mónica Rodrigues
Choose a framework or library
Depends, what do you want to do?
Choose a IDE and structure your folders
Think about your application, namely HTML structure and CSS
Lets start with Javascript
Don’t forget the best practices !!!!
17. Recomendations
26/05/2017Single Page Applications Mónica Rodrigues
Best practices in Javascript
Join and minify CSS files and Javascript files
Use a task runner like Gulp
Learn MVVM pattern
App.js
App-users-controller.js
site.min.js
18. Javascript Patterns
26/05/2017Single Page Applications Mónica Rodrigues
Functions as abstractions
Functions to build modules
Functions to avoid global variables
21. Functions to build modules
26/05/2017Single Page Applications Mónica Rodrigues
What’s the matter with previous code?
There are two global variables
worker
createWorker
There variables can be redefined in other files
22. Functions to avoid global variables
26/05/2017Single Page Applications Mónica Rodrigues
Reduce to 1 global
variable
But, how can I get 0
global variables?
23. Functions to avoid global variables
26/05/2017Single Page Applications Mónica Rodrigues