Tuesday 20 December 2016

5 #Lightning Tips for Visualforce Devs!

Most of us Salesforce Developers have started our development in Salesforce Classic. Now that the Lightning Experience is out there, we're starting to migrate our skillset from Visualforce to Lightning.

If you're in the process of starting your journey from Visualforce to Lightning, please keep reading, as I've got 5 tips for you! I hope you find them useful.

#1 - JavaScript Understanding

When I was more involved in Java projects I used to build apps with the DOJO framework. This is a JavaScript toolkit that provides multiple elements and UI components to help with Web App development.
When I moved to Lightning, I found this skillset very useful. I kept finding similarities between the Lightning and the DOJO framework.
So my #1 recommendation when it comes to starting with #Lightning is to have some JavaScript understanding. Any of the other popular frameworks (jQuery, ...) can do to help you understand the underlying JavaScript architecture.

#2 - Embedded #Lightning Components

The Lightning Experience provides a beautiful environment, and it's a very user-friendly one. But those who have been working on Salesforce Classic for a while (as is my case) may find it difficult to adjust to the new approach; and changing the look and feel of the platform, as well as the underlying technology, all at once, may be a bit disconcerting.
That's why I'd recommend starting by embedding your first #Lightning Components inside a Visualforce page that you can hook anywhere in Salesforce Classic.


The image above is an example of a Visualforce page that embeds the NewContactDataInput Lightning component. Note the use of the  < apex:includeLightning />  tag. Also be aware that not all the Lightning events are supported in Classic, but it's a good start to create something in #Lightning within your comfort zone of Salesforce Classic and Visualforce pages. 

#3 - Read the #Lightning Documentation

A good start point to understand the new Lightning Framework is the Official Documentation, where you can find the principles of the new technology, based on the open source Aura Framework.
I also find very useful the style documentation available in the SLDS (Salesforce Lightning Design System), where you find examples of the CSS classes used in the #Lightning Experience, and you can learn how to use them for your own custom components.

#4 - Explore your Developer Tools

One of my favourite tools is the MavensMate IDE. I use it together with Sublime Text 3 and it's really easy to use. The Lightning Component Bundles are made of a number of files; I find it quite difficult to navigate through the different elements from the Salesforce Developer Console.


Luckily, the IDE groups the files in the Bundle in the same folder, making it very easy to switch from the component to the controller, as shown in the image on top of these lines.

#5 - Test is a must!

When you work with Lightning Components, you find yourself in the wonderful world of a great UI experience; this is great because you "see your work" making progress!
However, sometimes this can distruct you from your Unit Tests, which will become a nightmare at deployment phase...

Trust me, I've found myself spending a whole day adding little bits and pieces to make my component look stunning, because the SLDS is so beautiful and easy to customise that your creativity gets boosted, but you can't forget about your component's controller; your controller is still an Apex class, and it needs to be Unit Tested to make it to Production!

And that's all for now. I hope you find this post useful.
Happy coding!  

No comments:

Post a Comment