https://cdnjs.cloudflare.com/ajax/libs/SyntaxHighlighter/3.0.83/scripts/shAutoloader.js

Tuesday, 24 March 2015

Lightning Strikes the Trails

Lightning Strikes the Trails

Lightning london

Overview

Just in time for Lightning Developer Week around the globe, new Lightning modules were released for Trailhead including one for Lighting Components. Up until now, most of the content on Trailhead has been subjects that i’m very familiar with (although that hasn’t stopped me dropping points through not reading the challenges properly :) 

The Lightning Components was a different experience - as these have not long made it into beta, and more importantly still don’t play nicely with canvas apps, I’d been dabbling at best, mainly around follow along tutorials where I didn’t have to concentrate too hard.  The Trailhead challenges get you to write real code against a set of requirements and then automatically validates whether you’ve succeeded.

We’re not in Kansas any more

This is really useful as Lightning Components present a different programming challenge to the Apex/Visualforce paradigm we’ve used in the past:

  • The majority of the code is in JavaScript. This will no doubt scare a few old school developers who think anything not related to presentation should be handled by the server, but its the future - of that I have no doubt.
  • The Apex that you do use is stateless - if you don’t send information from the front end as a parameter, the controller won’t have access to it.
  • Communication between components is via JavaScript events.  This is awesome.  Previously to communicate between Visualforce components you had to pass instances of a parent page or component controller around so that they could know there was something there to communicate with. Where this is really powerful is in the Lightning App Builder, as I demonstrated at the London Lightning Developer week by dropping two components into the app builder which were able to communicate with each other without any further wiring up. 

The Lighting module has a guide time of four hours, which is a pretty good estimate.  This isn’t something you’ll want to dip into for 5 minutes here and there. Its also a good idea to have the Lighting Components Developer’s Guide open while you are working it, so that you can read more around the various concepts.

Debugging JavaScript - oh the humanity

There are currently 9 steps in the Lightning Components module. In addition to the steps that cover the points I’ve made above, there’s one that I’d like to particularly draw attention to: Debugging Your Components - this will stand you in good stead when you apply the learning from the module to build your own components when they inevitably don’t work.

Douglas Crockford described browsers as “the most hostile software development environment imaginable” and he should know!  Knowing the tools that are available and how to use them will make things a little easier on you.

So what’s keeping you?

As Columbo would say, just one more thing: if you haven’t tried Trailhead yet,consider how much content is now available and hazard a guess at how much you’d have to pay for that sort of training elsewhere. If that isn’t a reason to get started straight away I don’t know what is.

Related Posts