Relax, it's spa time

33
Relax, it's SPA time Mónica Rodrigues http://netpont o.org 60ª Reunião Presencial - 19/03/2016

Transcript of Relax, it's spa time

Page 1: Relax, it's spa time

Relax, it's SPA timeMónica Rodrigues

http://netponto.org60ª Reunião Presencial - 19/03/2016

Page 2: Relax, it's spa time

Who I am?Mónica Rodrigues

Web development since 2010HTML5, CSS3, AngularJs, Knockout, Asp.Net WebApi, ASP.NET MVC, C#, SQL Server 2014

Member and Organizer

Degree in Computer Science Engineer at ISEL

Page 3: Relax, it's spa time

Contents• Challenge• Solution• Motivations vs Considerations• Multiple page application vs SPA• Multiple page application and SPA - Mix• Some Javascript Frameworks• SPA Samples• What I need to begin• Recomendations• Javascript Patterns• Demo• References

Page 4: Relax, it's spa time

First page – Long time ago

Page 6: Relax, it's spa time

Challenge

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.

Page 7: Relax, it's spa time

SolutionGo to a SPA

Page 8: Relax, it's spa time

SolutionUse 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

Page 9: Relax, it's spa time

Motivations

ReachWeb app may be accessible on different platforms and devices

ResponsiveWeb app needs to be responsive to different screen resolutions

Round tripWeb app does not require many round trips between client and server

3R’s

Page 10: Relax, it's spa time

Motivations

Better user experience

Separation of responsibilities between client and server

Offline Applications

Page 11: Relax, it's spa time

Considerations

The first time that the application loads is slow

Maintain Navigation, Deep linking and History

SEO (Search engine optimization) is complicated

Page 12: Relax, it's spa time

Multiple Page Application

Page access

Returns rendered page

Page rendering

Page 13: Relax, it's spa time

Single Page Application

Requests data

Returns data

DOM processing and manipulation

Page 14: Relax, it's spa time

SPA and Multiple Page Application (Mix)

Products Page

Mini SPA

Categories Page

MiniSPA

Request data

Request data

Returns data

Returns data

Page 15: Relax, it's spa time

Some Javascript Frameworks and Libraries

Page 16: Relax, it's spa time

SPA Samples

Page 17: Relax, it's spa time

What I need to begin?

• 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!!

Page 18: Relax, it's spa time

Recomendations

• Best practices in Javascript• Join and minify CSS files and Javascript

files– Use a task runner – Gulp

• Learn MVVM pattern

App.js

App-users-controller.js

site.min.jsdeploy

Page 19: Relax, it's spa time

JavaScript Patterns

• Functions as abstractions• Functions to build modules• Functions to avoid global variables

Page 20: Relax, it's spa time

Functions as abstractions

Page 21: Relax, it's spa time

Functions to build modules

Revealing module pattern

Page 22: Relax, it's spa time

Functions to build modules

• What’s the matter with previous code?– There are two global variables•worker• createWorkerThese variables can be redefined in other files

Page 23: Relax, it's spa time

Functions to avoid global variablesReduce to 1 global variable

But, how can I get 0 global variables?

Page 24: Relax, it's spa time

Functions to avoid global variables

Page 25: Relax, it's spa time

NetPonto Attendance Manager SPA

demo

Page 26: Relax, it's spa time

Questions?

Page 27: Relax, it's spa time

ReferencesAngular Js

– https://angularjs.org/

Knockout– http://knockoutjs.com/

Aurelia– http://aurelia.io/

React– https://facebook.github.io/react/

Backbone– http://backbonejs.org/

Ember– http://emberjs.com/

John Papa– http://www.johnpapa.net/

Page 28: Relax, it's spa time

Patrocinadores “GOLD”

Twitter: @PTMicrosoft http://www.microsoft.com/portugal

Page 29: Relax, it's spa time

Patrocinadores “Silver”

Page 30: Relax, it's spa time

Patrocinadores “Bronze”

Page 31: Relax, it's spa time

http://bit.ly/netponto-aval-60

* Para quem não puder preencher durante a reunião, iremos enviar um email com o link à tarde

Page 32: Relax, it's spa time

Próximas reuniões presenciais19/03/2016 – Lisboa02/04/2016 – Porto16/04/2016 – Lisboa19/05/2016 – 21/05/2016 – TugaIT (Lisboa)Reserva estes dias na agenda! :)