Salesforce announced Lightning Web Components last month at their World Tour in New York City. The LWC framework provides Salesforce developers with a brand new way to create custom UI components inside of their Salesforce orgs. It will make your apps run faster and more efficiently.
But this seems to be a story that we have heard before. Do Lightning Web Components live up to that hype? The lab coats at CRM Science spent some time with LWC recently, and this is what you will need to know about it before it goes live into Production orgs next month.
Delivering on the Promise of Lightning Fast Performance
It is almost certain that existing Salesforce users and developers are going to face deja vu when learning about LWC. The original Lightning Component framework - now being referred to by its longtime codename Aura - was introduced at Dreamforce in 2014. It was supposed to be the modern day follow up to Visualforce development, and it was built for speed and performance.
But something very different happened to web browsers in the four years since the introduction of Aura. Google began to champion a new concept known as Web Components to the internet community. The idea was to scrap the decades-old limitations of what web browsers were capable of and agree to a new set of standards that would be more flexible and powerful to web developers.
Web Components was released to Google’s Chrome browser in 2014 and then it made its way through various committees within the tech community. After some revisions and feedback from other companies such as Salesforce, the specifics were ultimately agreed upon and implemented. Now all major web browsers such as Mozilla Firefox, Apple Safari, and Microsoft Edge support the new standards, thus making the new technology widely available to the masses.
A lot of the functionality that Salesforce had built into the Aura framework could now be taken out of their processes and offloaded onto the browser itself using Web Components. Salesforce created the Lightning Web Component framework to do so. LWC are able to utilize the new standards while still having the ability to access Salesforce data and work within the existing Lightning Experience UI. This results in faster speeds and processing of Salesforce applications because the web browser has a more direct access to the processing capability of your computer. Salesforce can now focus their resources on Salesforce-specific functionality and not just creating a webpage for you.
With Lightning Web Components, Salesforce can finally deliver on the promise of faster applications it made four years ago. But will the community be ready to embrace the change?
A Smoother Upgrade for Users
There is no denying that the introduction of LWC will also stoke some very real concerns within the Salesforce community because the rollout to Aura was such a painful one.
The problem with the introduction to Aura was that there was no compatibility between the old and new systems. Aura components did not work on the Classic UI, Visualforce did not work on the new Lightning Experience UI, and many of the standard features within Salesforce had not been translated over. It took nearly four years of upgrades and improvements before consulting firms like us could recommend our clients to upgrade to Lightning.
So how will Salesforce users handle a brand new framework when it took four years to get used to the current one?
The good news is that the LWC rollout is not going to be anything like the Aura rollout. The reason for this is because there is total compatibility between the new LWC framework and the current Aura framework. LWC provides the same interfaces to admins and users that they have been using since switching to the Lightning Experience. You will be using the Lighting App Builder to drag-and-drop LWC components onto your page, and you will have the ability to set custom parameters on the page as you do so.
Developers also have the ability to seamlessly embed LWC into Aura components, so the conversation process from going to Aura to LWC can be gradual over time. The component that you ultimately see on your screen might be a combination of LWC and Aura components inside of Aura wrapping.
In the following example, we created an Aura component that holds two child components - one of them is a button written in Aura, and the other one is button written in LWC.
If you look at the highlighted area in the code, you will see that the language used to call each component is practically identical between the two types of components. And when we render this code into our Lightning experience page, it also appears that the two buttons are practically identical.
If we had not explicitly labeled them “Aura” and “LWC” in the component name or button text, you would not have been able to tell which one had come from which framework. But trust us, they are from different frameworks.
This is how Salesforce has gotten away with secretly moving over to the new framework in their “Standard Lightning Component” library for the past year or so, and we never noticed it. This allowed Salesforce to test the framework internally before releasing the tools to others. And the performance boost to switching over to LWC could also be why the Lightning Experience is in a much better state now than it was in past years. Aura developers are already embedding LWC into their components, and they will continue to do so while the rollout is happening.
However, this does not mean that everyone will be ready to dive head first into LWC when it rolls out to Production orgs next month...
A Massive Shift in Salesforce Development
Aura and LWC will look completely identical to the admin user as they use it in the Lightning Experience, and embedding LWC components into Aura will also be seamless to those developers currently working in Aura. But the same cannot be said for those Aura developers wishing to write Lightning Web Components of their own.
The original Web Components framework was created by Google and the rest of the web community in the time after the introduction of Aura, so it makes sense that Web Components and Aura share very little in common other than achieving some of the same end goals. Salesforce opted to keep Lightning Web Components as close to the original framework as possible in its design while still providing developers the tools needed to work within the Salesforce platform.
But this shift means that every part of the LWC programing language - from the type of files needed to the structure of each component to even the naming conventions that must be followed - is completely different from Aura. Many of the processes and best practices that developers have been training on for the past four years will have to be completely disregarded. Existing Salesforce developers will be starting over from scratch the moment they start their first web component.
That is not to say that the choice to move away from Aura is necessarily a bad change. The Aura framework has been heavily criticized by the development community for being unconventional in its design and unnecessarily complicated. This difficulty could be a factor into why it took so long for developers to switch over from Visualforce to Aura. In fact, some developers still refuse to make the switch.
Salesforce has also been preparing its development ecosystem for the large shake-up when it introduced Salesforce DX two years ago. In that effort, they reviewed the tools that other developer communities were working with and found a way to fit Salesforce into those standards. This often involved shedding the development tools and process that have been in place for many years. While it is a tough pill to swallow for many existing developers, it ultimately results in a development process that provides more options for its community to utilize what programmers outside of the ecosystem are already using.
LWC is now bringing that standards-based mindset into its programming language, even at the cost of scrapping the Aura framework. It can now expand its reach outside to the limited talent pool to a new demographic of developers that have never experienced Salesforce before. When the platform is more friendly to more developers, it will be rewarded with more support from the community.
What is the Verdict on LWC?
Lightning Web Components is one of the biggest improvements to be made to the Salesforce platform that will probably go unnoticed to the majority of its users. But the fact that it will go unnoticed by so many will be one of its best accomplishments.
The rollout to Aura four years ago was a painful experience to users, developers, and the platform itself. But Salesforce found relief in the new Web Components standard that would offload much of the work from the platform onto the user’s browsers. The switch resulted in a much-improved performance from the system, and this improvement can already be seen today thanks to the seamless transition within the Lightning Experience.
Lightning Web Components will be an essential skill for Salesforce developers to acquire once it becomes available in Production next month, but it will take some time for devs to learn the drastically different framework. The lab coats at CRM Science are dedicated to being there for you as your company switches over to the brand new framework.