This is my first post for Hatena blog, and for this post, I will share an introduction to developing Lightning Components on Salesforce.
Having at least 3 years experience creating Salesforce solutions to customers in my previous company, I joined TeamSpirit Singapore in September 2018. I am a certified Salesforce Administrator, Platform Developer and Consultant and will be more than happy to answer your questions on Salesforce development and configuration. Of course, I am constantly learning all the time, so I am open to discussions and feedback on any subject.
Alright, enough limelighting. Let's get down to business!
What are Lightning Components?
Lightning Components can be single-page apps or sections of an app (thus, components). This means an app (a Lightning Component) can be made up of multiple Lightning Components, each with its own self-contained function.
Lightning Components can also interact with other Lightning Components. They can do so by directly setting the attributes of the other Lightning Component or use calling a Lightning Event so other Lightning Components can "listen" for this event and handle it. These interaction methods are more advanced topics and will not be covered in this post.
As such, when building Lightning Components, keep in mind the design of the components and try to reuse them as much as possible.
Architecture Overview - All in A Single Diagram
In general, Salesforce Lightning Component (SFLC) is similar to a Model-View-Controller (MVC) model, except it has a view-controller and a model-controller. Below is a overview of some of the key elements (erm, components 😅) of SFLC:
A component bundle consist of all elements and resources that make up a particular Lightning Component. These include the view, controller and helper classes. However, this does not include the Apex Controller, which means a component bundle contains all the items required for the client to render the Lightning Component.
The view of a Lightning Component is the main definition resource for a Lightning Component. It contains the design of the user interface for the component. It is a markup language file consisting of HTML5 and SFLC-specific tags (e.g. aura:component). It also contains the attributes (the instance variables) of the Lightning Component. These attributes define the data to be captured and manipulated by the component.
The Apex Controller acts as the model-controller and provides access to database side functions (e.g. Create, Read, Update, Delete). These functions are remote methods for Lightning Components to call and are detoned by the @AuraEnabled header in an Apex class.
A Lighning Component is made up of various elements and resources which are similar to developing any other modern web applications. The only difference is that utilising the Salesforce Platform, functions and methods are optimised for the platform and as such, provides users with the most optimal user experience to Salesforce functions.
In addition, as Lightning Components are created as a "mobile-first" design, they are compatible with the Salesforce mobile app and does not require separate apps for mobile and web; they can be created as one app that works for all!
I hope after reading this post, you have a better understanding of Salesforce Lightning Component and feel ready to embark on the journey to create Lightning Components!