Separation of concerns in Lightning Components

Like the Visualforce use of the Model View Controller (MVC), Lightning Components also support SOC by splitting up the implementation of the component into several distinct source files that each have their own concerns. As Lightning Components are implemented on the client side, a component's various source files represent a way to implement separation of concerns within the HTML, CSS, and JavaScript code you write.

Lightning Components can be developed using two frameworks, the original Aura-based framework and the latest HTML5 web standard base framework. These are known as Lightning Web Components (LWC) and Lightning Aura Components.

LWCs offer greater alignment with the modern web programming standards that have emerged since the Aura-based framework was first created by Salesforce. They are recommended as they provide broader access to existing skills and thus existing knowledge. The following sections include a summary of both in terms of SOC, though further samples throughout the book will focus on the latest LWC framework.

In either framework, the Lightning Components client-side controllers can communicate with an Apex Controller class via the @AuraMethod annotation, and thus access classes implementing your share application business logic, as shown in the preceding diagram.

LWC have better rendering performance than those based on the Aura framework, since they leverage more of the browser's technology, which is more optimized as it works closer to the hosting operating system. Salesforce does allow you to build with both frameworks and combine components (with some restrictions) on the same page. I recommend you review carefully which components you want to port over to the new framework and do so incrementally in a prioritized way, based on performance and the likelihood of changes going forward.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.38.176