Lightning Components 101
An Apex Developer’s Guide
Salesforce Engineer,
Adam Olshansky
New Delhi Salesforce DG
• First Revival Meetup in February 2016
• Twitter: https://twitter.com/newdelhisfdcdug
• Hashtag: #ImpactSalesforceSaturday
• New Delhi Salesforce DG Trailblazer Community Group: http://bit.ly/NewDelhiCommunity
• Website: https://newdelhisfdcdug.com
Mentorship Central
• We are dedicated to matching Mentees seeking specific Salesforce goals with Mentors
• Sign up as a Mentor or Mentee and connect with other Mentors/Mentees
• http://bit.ly/SFMentorshipCentral
630 14X
Adam Olshansky
Salesforce Engineer, Google
@adam17amo
adam@adamtoarchitect.com
bit.ly/lightningmigration
Speaker Logo
धन्यवाद
Developing a fear of heights
Further up the Mountain
Front end
JavaScript
Client side
Shadow DOM
Callback hell
Front End Language Usage
Stack Overflow Developer Survey, 2019
• 72,000+ responses
7th Year in a Row for JavaScript
Quarterly Data
• JavaScript is 20%+ of all requests
Apex is 39th
JavaScript #1 in GitHub Pull Requests since 2013
A Little Overwhelming
Backend is safe
Expectations
You’re an Apex Developer
Can’t learn JavaScript in 40 mins
Understand common patterns
Gain confidence to start building components
The First Step
Agenda
1. Apex Overview
2. Components
3. VF vs. Lightning Web Components
4. Lightning Web Components
5. Summary and Step 2
Apex Overview
Review of what we know
Apex Overview
Bread and Butter
Triggers
Classes/
Controllers
Variables
Methods
Parameters
Return values
Events
Async Apex
Wait for resources
Batchable
MVC Model
HTML style tags
Bind Variables
Bind Methods
Button based UI
Visualforce
Governor limits
Button click based
Poor Performance
Hacky solutions
Limitations
Apex and VF Gaps
A New Programming Model
MVC++
Customer Driven Paradigm Shift
August 2015
September
2007
January 2019
Everything on the Server
Where We Were - MVC
Client vs. Server
Moving to client side - MVCC
What is a “Lightning Component”?
Container for multiple files
Aura
Lightning
Web
Component
UI
Controller
CSS XML Metadata
Helper
Documentation
Design
SVG
What’s Old With Components?
Many similar things
UI Components
Event based code
Bind variables
Calling methods
Multiple files used
UI Components
Old Framework
New Names
<apex>
LWC Framework <html>, <lightning>, <c>
Event Based Code
Old Framework
New Names
before insert, after update
LWC Framework onchange, onclick
Bind Variables
Old Framework
Similar Syntax
{!variable}
LWC Framework {variable}
Bind Methods
Old Framework
Similar Syntax
{!methodName}
LWC Framework {methodName} or custom
Multiple Files
Old Framework
Similar to before
VF Page, Apex Controller, Apex Helper
LWC Framework HTML, JS Controller, Apex Controller
Let’s Compare
VF vs. LWC
Visualforce
HelloWorld.page
HelloWorldController.cls
Apex Controller
Lightning Web Component
HelloWorld.html
HelloWorldController.js
JS Controller
What did we just see?
Component markup
Code running based on events
Variable and method bindings
Controller part of the bundle
No Apex
Lightning Web Components
Embrace Standards
Standards Improved
Why Change?
Salesforce’s Response
Standardize
New with Web Components!
More to Learn
Industry Standards
Logic in one spot
Multiple Apex Controllers
Decorators
DEMO TIME
Focus on Concepts
ldsCreateRecord.html
Create Record Component
viewSource.html
Child Component
viewSource.js
Child Controller
ldsCreateRecord.html
Create Record Component
ldsCreateRecord.js
Create Record Controller
ldsCreateRecord.js
Create Record Controller
apexWireMethodToProperty.html
Apex Wire Component
apexWireMethodToProperty.html
Apex Wire Component
apexWireMethodToProperty.js
Apex Wire Controller
Apex
apexWireMethodToProperty.html
Apex Wire Component
apexWireMethodToProperty.html
Apex Wire Component
What did we just see?
Component markup
Variable and Method bindings
Decorators
• @track – private + rerender
• @api – public + rerender
• @wire – wired to method
Importing from anywhere
A lot of old, a little new
Not so scary
after all
Recap
How to take Step 2
Recap
Web development already popular
Salesforce evolves to meet demands
Front end has similarities to backend
LWC are the present and future
This is Step 1
Salesforce Resources
Component Libraries
• https://developer.salesforce.com/docs/component-library
Sample Gallery
• https://trailhead.salesforce.com/sample-gallery
Lightning Web Components
• https://lwc.dev
Trailmix
• https://sfdc.co/lwc
Resources from Salesforce Instructor
• https://bit.ly/aura2lwc
Style – Lightning Design System
SLDS
• https://lightningdesignsystem.com
Add styling without writing CSS
Utilities
Icons and Classes
Step 3
@adam17amo
adam@adamtoarchitect.com
bit.ly/lightningmigration
github.com/adam17amo/lwc101
Follow & Join New Delhi Salesforce DG
• Join to know about future events and to RSVP:
https://trailblazercommunitygroups.com/delhi-in-developers-group/
• Let’s start conversations on Success Community:
http://bit.ly/NewDelhiCommunity
• Follow us on Twitter: https://twitter.com/newdelhisfdcdug
• Hashtag: #ImpactSalesforceSaturday
• Follow us on Facebook: https://www.facebook.com/newdelhisfdcdug
• For all the content: https://newdelhisfdcdug.com
#ImpactSalesforceSaturday: Lightning Components 101: An Apex Developer’s Guide

#ImpactSalesforceSaturday: Lightning Components 101: An Apex Developer’s Guide