Moving to the Client – Writing Full Applications in JavaScript

Tuesday, October 21st, 2014

Presenters

  • Chad Killingsworth – Missouri State University

Location: Pavilion Ballroom East

JavaScript has moved from providing minor interaction to a full scale development platform. Major application such as Gmail and Google Calendar have hundreds of thousands of lines of code all written in JavaScript. Mobile browsers have full featured browsers but performance and memory constraints become major considerations. And then there is the whole world of single page applications. This session will look at how to write code that can be maintained as well as developing build processes to catch common errors before deploying to production.

Notes

  • https://developers.google.com/closure/compiler/
  • Found himself working more and more on the client side of things
    • would love to use node.js on server (not there yet)
  • What is a JS App?
    • More JS than server-side business logic
    • Single page application
    • Large portion on front-end
  • ProblemĀ  – people end up with huge, single JS libs.
    • We put up with client code that we would never stand for on the server.

Maintainable JS methodologies

  • Namespaced code. Aliases are evil ($ is an example).
  • A well structured class hierarchy.
  • Keep each class in own file. Keep them small.
  • Decouple code (MVC on client code)
  • Use dependency management (require JS)
    • all of them have tools to unwind multi-files.
  • LargeScripr application require build systems
  • Unit testing?
  • Moving beyond linters and compressors.
    • JS compiled into better js!
    • Uglify.js is a good start
  • Run type errors are preventable.

Search site

  • has 3000 lines of code
  • Ave lines per code has 216 lines
  • Uncompiled: 590 KB
  • Gzip 129 KB
  • Closure 91 KB, 32 KB gzip!

Closure compiler

  • WS only (unwind)
  • Simple optimizations (compressor)
  • Advanced (dictated coding style, and assume certain things)
    • Will throw away any code you are not using
    • Type safety
    • Significance performance boosts
  • Can’t use jQuery (unless you use extern to leave jQuery alone)
  • Challenges:
    • Debugging…
    • You must write code in a specific style

Book – Closure : the Definitive Gide, Michael Bolin

Which compilation level is right for me?

Leave a Reply

You know you want to...