SlideShare a Scribd company logo
Dreamforce 2016 - #SFLightningChess
Lightning Chess
The fun way of learning the Lightning Component Framework
Lieven Juwet
@LievenJuwet
Technical Architect @ ABSI
Samuel De Rycke
@SamuelDeRycke
Technical Architect @ ABSI
Salesforce MVP
Forward-Looking Statements
Statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any
of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking
statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or
service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for
future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts
or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our
service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth,
interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible
mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our
employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com
products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of
salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most
recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information
section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not
be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available.
Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Agenda
● Demo
● Lightning Component Framework
● Component Encapsulation
● Lightning Chess: Component Composition
● Event Driven Architecture
● Lightning Chess: Event Driven approach
● Let’s code it
● Q&A
Lightning Chess
● R&D project
● Effort: 40 hours + rework
● Chess application on the Salesforce Platform
● Real-time multiplayer game
● Built using Lightning Component framework
Lightning what?!
Application Architecture
Streaming API
Custom
Objects
Apex
Controllers
Lightning Chess
Player ClientsLightning Chess
Player Clients
ServerCall
Subscribe
Updates
Salesforce Platform
Demo: Lightning Chess
Lightning Component Framework
● Lightning Application
● Lightning Components
● Lightning Events
The Fundamentals
Lightning Component
Component Bundle
Component Bundle
Component
< markup />
Style
CSS
Renderer
Javascript
Controller
Javascript
Helper
Javascript
Design
< markup />
Documentation
< markup />
SVG File
Component Encapsulation
● Object Oriented Programming principles
● Internals are not exposed to the outside
● Public vs Private interface
What happens in the component, stays in the component
Component
Public:
● Public Attributes
● Public Methods
● Events
Private:
● HTML DOM
● CSS Style
● Private Attributes
● Controller Functions
● Helper Functions
● Apex Controller
Component Encapsulation
● Easy to reuse
Use them in different applications or other components making use of a component’s public
interface
● Open for extension
Extend the functionality of a component without impacting other components.
● Independent
A component does not rely on its consumers but on its public interface to function. This makes it
easy to use a component in any system.
● Compact
Splitting up your application/component into smaller components each with their own function
will lead to code that is small and easy to maintain.
Component can be:
“Think Component Encapsulation“
Lightning Chess: Component Architecture
Divide and conquer
Streaming API Listener
General Game Component
Chessboard
Chessboard Location
Streaming API Listener
Player List
Challenge List
Streaming API Listener
Streaming API Listener
Streaming API Listener
Subscribe to streaming
API and forward
streaming event
messages
Lightning Chess: Streaming API Listener
<aura:component>
<!-- public interface -->
<aura:attribute name=”listeners” type=”String[]” access=”public”/>
<aura:registerEvent name=”StreamingEvent” type=”c:StreamingEvent” />
<!-- private interface -->
<ltng:require scripts="<!--Required scripts -->"
afterScriptsLoaded="{!c.setupStreaming}" />
<aura:attribute name="sessionId" type="String" access="private"/>
<aura:handler name="destroy" value="{!this}" action="{!c.closeConnections}"/>
</aura:component>
Lightning Chess: Component Architecture
Mistakes were made
Chessboard
Chessboard Location
Streaming API Listener
Player List
Challenge List
Streaming API Listener
Streaming API ListenerChessboard has too much responsibility. What if
we want to extend and allow users to choose what
game they want to play?
“Single Responsibility“
Lightning Chess: Component Architecture
Divide and conquer
Streaming API Listener
General Game Component
Chessboard
Chessboard Location
Streaming API Listener
Player List
Challenge List
Streaming API Listener
Streaming API Listener
Streaming API Listener
“Single Responsibility“
Event Driven Architecture
Event types
Component Event Application Event
Send only to components in the parent
hierarchy above
Broadcast to the entire Lighting
Application.
Tighter coupling between sender and
receivers
Very loose coupling between sender
and receivers
<aura:event type=”Component” description=”Chessboard_Location_Select”>
<aura:attribute name=”location” type=”Object” />
</aura:event>
Event Driven Architecture
● Part of the public interface
● “Something happened, I don’t know what to do, so do whatever you like!”
Loosely coupled communication
<aura:component description=”Chessboard_Location”>
<!-- Chessboard Location Component Definition-->
<aura:registerEvent name=”select” type=”c:Chessboard_Location_Select” />
</aura:component>
<aura:component description=”Chessboard”>
<!-- Chessboard has a Chessboard Location component-->
<c:Chessboard_Location select=”{!c.handleLocationSelect}” />
</aura:component>
Lightning Chess: Event Driven Approach
Communication is key
Chessboard
Chessboard Location Streaming API Listener
Chess Logic
Server Call
I am selected as a
starting locationI am selected as a
target location
Locations x,y
please mark
yourself as
targetable
I received a new
move with
following details
Following piece
moved from x to
y
Click
Click
“Loose communication through Events“
Let’s Code!
Extend the Chessboard Location component by adding Drag-and-Drop support
Summary
Takeaways
“Think Component Encapsulation“
“Single Responsibility“
“Loose communication through Events“
Resources
Code @ Github!
http://bit.ly/LightningChess-Code
Read more about Lightning Chess Architecture:
http://bit.ly/LightningChess-Blog
Questions?
Reach us on twitter #SFLightningChess
Thank Y u

More Related Content

PPTX
Getting Certified - proven tips for success (French Touch Dreamin)
PPTX
Lightning chess
PPTX
Introduction to lightning out df16
PDF
Unlocking the Hidden Potential of Salesforce Live Agent
PPTX
Winter '16 Release - Overview and Highlights
PPTX
Introduction to lightning web component
PDF
Lightning Design System and Components for Visualforce Developers
PPTX
Dreamforce Developer Recap
Getting Certified - proven tips for success (French Touch Dreamin)
Lightning chess
Introduction to lightning out df16
Unlocking the Hidden Potential of Salesforce Live Agent
Winter '16 Release - Overview and Highlights
Introduction to lightning web component
Lightning Design System and Components for Visualforce Developers
Dreamforce Developer Recap

What's hot (20)

PPTX
Build Apps Visually with Lightning App Builder
PDF
Make Your App Lightning Ready with Winter '17 (December 8, 2016)
PDF
Data Democracy: Use Lightning Connect & Heroku to Visualize any Data, Anywhere
PPTX
Process Automation on Lightning Platform Workshop
PPTX
Lightning Components Introduction
PDF
Lightning Out: Components for the Rest of the World
PPTX
Elevate Madrid Essentials - Advance Track
PPTX
PPTX
Salesforce Lightning Design System
PDF
Local development with Open Source Base Components
PDF
Introducing: The Lightning Experience
PPTX
Salesforce Lightning component framework from 0 to app
PPTX
Migrating Visualforce Pages to Lightning
PDF
Advanced Lightning Components
PDF
Customizing Salesforce User Interfaces with Lightning Components
PPTX
Using Apex for REST Integration
PPTX
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
PDF
Lightning Now for Consulting Partners
PPTX
Lightning Component - Components, Actions and Events
PPTX
Introduction to Lightning for Salesforce Admins
Build Apps Visually with Lightning App Builder
Make Your App Lightning Ready with Winter '17 (December 8, 2016)
Data Democracy: Use Lightning Connect & Heroku to Visualize any Data, Anywhere
Process Automation on Lightning Platform Workshop
Lightning Components Introduction
Lightning Out: Components for the Rest of the World
Elevate Madrid Essentials - Advance Track
Salesforce Lightning Design System
Local development with Open Source Base Components
Introducing: The Lightning Experience
Salesforce Lightning component framework from 0 to app
Migrating Visualforce Pages to Lightning
Advanced Lightning Components
Customizing Salesforce User Interfaces with Lightning Components
Using Apex for REST Integration
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
Lightning Now for Consulting Partners
Lightning Component - Components, Actions and Events
Introduction to Lightning for Salesforce Admins
Ad

Viewers also liked (13)

PPTX
Salesforce World Tour Amsterdam: Guide your users through a process using path
PPTX
Lightning componentとlightning design system
PDF
Unleashing Women! Curriculum Dillonmarcus
PDF
1130 4600-1-pb
PDF
DeepTelos: Multi-level Modeling with Most General Instances
PDF
Newton AQUA advantages 2016 v2
PPTX
Big china mart presentation
PPTX
Map your catalog, template and device in Hitachi Solutions Ecommerce
PPTX
Hitachi Solutions Ecommerce with Microsoft Dynamics CRM2016
PDF
2010 - Winter simulation
PPTX
AdsBridge Partnership Opportunities
PDF
HGB- Media Pack
DOCX
TBlair Resume 3-2016 (3tj)
Salesforce World Tour Amsterdam: Guide your users through a process using path
Lightning componentとlightning design system
Unleashing Women! Curriculum Dillonmarcus
1130 4600-1-pb
DeepTelos: Multi-level Modeling with Most General Instances
Newton AQUA advantages 2016 v2
Big china mart presentation
Map your catalog, template and device in Hitachi Solutions Ecommerce
Hitachi Solutions Ecommerce with Microsoft Dynamics CRM2016
2010 - Winter simulation
AdsBridge Partnership Opportunities
HGB- Media Pack
TBlair Resume 3-2016 (3tj)
Ad

Similar to Lightning Chess, The fun way to learn the Lightning Component Framework (20)

PPTX
Building Apps Faster with Lightning and Winter '17
PPTX
Building apps faster with lightning and winter '17
PDF
Salesforce platform session 2
PDF
Building einstein analytics apps uk-compressed
PDF
Lightning Components: The Future
PDF
Building Lightning Components for ISVs (Dreamforce 2015)
PDF
Lightning web components - Episode 1 - An Introduction
PPTX
Salesforce Lightning workshop
PDF
Spring 17 ISV Release Readiness (February 16, 2017)
PDF
Lightning Reports - Dreamforce 2015
PDF
Easy REST Integrations with Lightning Components and Salesforce1
PPTX
Lightning Developer Week - Bangalore Salesforce Developer Group
PDF
ISV Lightning Webinar Series - Part 2 (December 8, 2015)
PDF
Summer '16 Lightning Update for ISVs (June 30, 2016)
PPTX
[MBF2] Plate-forme Salesforce par Peter Chittum
PPTX
Build and Package Lightning Components for Lightning Exchange
PPTX
TrailheaDX and Summer '19: Developer Highlights
PPTX
Best Practices for Lightning Apps
PPTX
AngularJS App In Two Weeks
PDF
Lightning Workshop London
Building Apps Faster with Lightning and Winter '17
Building apps faster with lightning and winter '17
Salesforce platform session 2
Building einstein analytics apps uk-compressed
Lightning Components: The Future
Building Lightning Components for ISVs (Dreamforce 2015)
Lightning web components - Episode 1 - An Introduction
Salesforce Lightning workshop
Spring 17 ISV Release Readiness (February 16, 2017)
Lightning Reports - Dreamforce 2015
Easy REST Integrations with Lightning Components and Salesforce1
Lightning Developer Week - Bangalore Salesforce Developer Group
ISV Lightning Webinar Series - Part 2 (December 8, 2015)
Summer '16 Lightning Update for ISVs (June 30, 2016)
[MBF2] Plate-forme Salesforce par Peter Chittum
Build and Package Lightning Components for Lightning Exchange
TrailheaDX and Summer '19: Developer Highlights
Best Practices for Lightning Apps
AngularJS App In Two Weeks
Lightning Workshop London

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
Teaching material agriculture food technology
PDF
Electronic commerce courselecture one. Pdf
PDF
Empathic Computing: Creating Shared Understanding
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PPTX
A Presentation on Artificial Intelligence
sap open course for s4hana steps from ECC to s4
NewMind AI Weekly Chronicles - August'25-Week II
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Teaching material agriculture food technology
Electronic commerce courselecture one. Pdf
Empathic Computing: Creating Shared Understanding
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
A Presentation on Artificial Intelligence

Lightning Chess, The fun way to learn the Lightning Component Framework

  • 1. Dreamforce 2016 - #SFLightningChess Lightning Chess The fun way of learning the Lightning Component Framework
  • 3. Samuel De Rycke @SamuelDeRycke Technical Architect @ ABSI Salesforce MVP
  • 4. Forward-Looking Statements Statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 5. Agenda ● Demo ● Lightning Component Framework ● Component Encapsulation ● Lightning Chess: Component Composition ● Event Driven Architecture ● Lightning Chess: Event Driven approach ● Let’s code it ● Q&A
  • 6. Lightning Chess ● R&D project ● Effort: 40 hours + rework ● Chess application on the Salesforce Platform ● Real-time multiplayer game ● Built using Lightning Component framework Lightning what?!
  • 7. Application Architecture Streaming API Custom Objects Apex Controllers Lightning Chess Player ClientsLightning Chess Player Clients ServerCall Subscribe Updates Salesforce Platform
  • 9. Lightning Component Framework ● Lightning Application ● Lightning Components ● Lightning Events The Fundamentals
  • 10. Lightning Component Component Bundle Component Bundle Component < markup /> Style CSS Renderer Javascript Controller Javascript Helper Javascript Design < markup /> Documentation < markup /> SVG File
  • 11. Component Encapsulation ● Object Oriented Programming principles ● Internals are not exposed to the outside ● Public vs Private interface What happens in the component, stays in the component Component Public: ● Public Attributes ● Public Methods ● Events Private: ● HTML DOM ● CSS Style ● Private Attributes ● Controller Functions ● Helper Functions ● Apex Controller
  • 12. Component Encapsulation ● Easy to reuse Use them in different applications or other components making use of a component’s public interface ● Open for extension Extend the functionality of a component without impacting other components. ● Independent A component does not rely on its consumers but on its public interface to function. This makes it easy to use a component in any system. ● Compact Splitting up your application/component into smaller components each with their own function will lead to code that is small and easy to maintain. Component can be: “Think Component Encapsulation“
  • 13. Lightning Chess: Component Architecture Divide and conquer Streaming API Listener General Game Component Chessboard Chessboard Location Streaming API Listener Player List Challenge List Streaming API Listener Streaming API Listener Streaming API Listener Subscribe to streaming API and forward streaming event messages
  • 14. Lightning Chess: Streaming API Listener <aura:component> <!-- public interface --> <aura:attribute name=”listeners” type=”String[]” access=”public”/> <aura:registerEvent name=”StreamingEvent” type=”c:StreamingEvent” /> <!-- private interface --> <ltng:require scripts="<!--Required scripts -->" afterScriptsLoaded="{!c.setupStreaming}" /> <aura:attribute name="sessionId" type="String" access="private"/> <aura:handler name="destroy" value="{!this}" action="{!c.closeConnections}"/> </aura:component>
  • 15. Lightning Chess: Component Architecture Mistakes were made Chessboard Chessboard Location Streaming API Listener Player List Challenge List Streaming API Listener Streaming API ListenerChessboard has too much responsibility. What if we want to extend and allow users to choose what game they want to play? “Single Responsibility“
  • 16. Lightning Chess: Component Architecture Divide and conquer Streaming API Listener General Game Component Chessboard Chessboard Location Streaming API Listener Player List Challenge List Streaming API Listener Streaming API Listener Streaming API Listener “Single Responsibility“
  • 17. Event Driven Architecture Event types Component Event Application Event Send only to components in the parent hierarchy above Broadcast to the entire Lighting Application. Tighter coupling between sender and receivers Very loose coupling between sender and receivers <aura:event type=”Component” description=”Chessboard_Location_Select”> <aura:attribute name=”location” type=”Object” /> </aura:event>
  • 18. Event Driven Architecture ● Part of the public interface ● “Something happened, I don’t know what to do, so do whatever you like!” Loosely coupled communication <aura:component description=”Chessboard_Location”> <!-- Chessboard Location Component Definition--> <aura:registerEvent name=”select” type=”c:Chessboard_Location_Select” /> </aura:component> <aura:component description=”Chessboard”> <!-- Chessboard has a Chessboard Location component--> <c:Chessboard_Location select=”{!c.handleLocationSelect}” /> </aura:component>
  • 19. Lightning Chess: Event Driven Approach Communication is key Chessboard Chessboard Location Streaming API Listener Chess Logic Server Call I am selected as a starting locationI am selected as a target location Locations x,y please mark yourself as targetable I received a new move with following details Following piece moved from x to y Click Click “Loose communication through Events“
  • 20. Let’s Code! Extend the Chessboard Location component by adding Drag-and-Drop support
  • 21. Summary Takeaways “Think Component Encapsulation“ “Single Responsibility“ “Loose communication through Events“
  • 22. Resources Code @ Github! http://bit.ly/LightningChess-Code Read more about Lightning Chess Architecture: http://bit.ly/LightningChess-Blog
  • 23. Questions? Reach us on twitter #SFLightningChess