SlideShare a Scribd company logo
1 of 22
Download to read offline
Lightning Chess
The fun way of learning the Lightning Component Framework
Sri Lanka Salesforce Developer Group 2016-12-8 #SFLightningChess #SalesforceDevs
1
Who am I?
2
Samuel De Rycke
Technical Architect
Talent Management
4.5 years SF experience
Salesforce MVP
Belgium User Group
Leader
Belgium Developer
Group Leader
Salesforce.Stackexchange
Moderator
Dreamforce Speaker
}ABSI
@SamuelDeRycke
Implementation
Partner
@absi_nv
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
3
Lightning Chess
● R&D project
● Effort: 40 hours + rework
● Chess application on the Salesforce Platform
● Realtime multiplayer game
● Built using Lightning Component framework
Lightning what?!
4
Application Architecture
Streaming API
Custom
Objects
Apex
Controllers
Lightning Chess
Player ClientsLightning Chess
Player Clients
ServerCall
Subscribe
Updates
Salesforce Platform
5
Time for a demo
Demo: Lightning Chess
6
Lightning Component Framework
● Lightning Application
● Lightning Components
● Lightning Events
The Fundamentals
7
Component Bundle
Lightning Component
Component Bundle
Component
< markup />
Style
CSS
Renderer
Javascript
Controller
Javascript
Helper
Javascript
Design
< markup />
Documentation
< markup />
SVG File
8
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
9
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. Less bugs.
● 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 or application.
● Compact
Separation of Concerns will lead to code that is small and easy to maintain, debug and test.
Components can be:
“Think Component Encapsulation“
10
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
Subscribe to streaming
API and forward
streaming event
messages
Streaming API Listener
11
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>
12
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“
13
Lightning Chess: Component architecture
Mistakes were made
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
14
“Single Responsibility“
Event Driven Architecture
Event types
<aura:event type=”Component” description=”Chessboard_Location_Select”>
<aura:attribute name=”location” type=”Object” />
</aura:event>
15
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
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 -->
!-- Public Interface-->
<aura:registerEvent name=”select” type=”c:Chessboard_Location_Select” />
</aura:component>
<aura:component description=”Chessboard”>
<!-- Chessboard component Definition -->
<!-- Chessboard has a Chessboard Location component and subscribes a handler to the
select component event-->
<c:Chessboard_Location select=”{!c.handleLocationSelect}” />
</aura:component>
16
Lightning Chess: Event Driven Approach
Communication is key
Chessboard
Chessboard Location Streaming API Listener
Chess Logic
Server Call
I am selected as
a starting
location
I 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“ 17
Let’s Code !
Extend the Chessboard Location component by adding drag-and-drop
support.
18
Summary
Takeaways
“Think Component Encapsulation“
“Single Responsibility“
“Loose communication through Events“
19
Resources
Code @ Github!
http://bit.ly/LightningChess-Code
Read more about Lightning Chess Architecture:
http://bit.ly/LightningChess-Blog
20
Questions ?
Reach me on twitter @SamuelDeRycke #SFLightningChess
21
thank y u
22

More Related Content

What's hot

Spring Boot Authentication...and More!
Spring Boot Authentication...and More! Spring Boot Authentication...and More!
Spring Boot Authentication...and More! Stormpath
 
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...johannes_fiala
 
Nakal think test_2015
Nakal think test_2015Nakal think test_2015
Nakal think test_2015Rajdeep Varma
 
What is IBM Bluemix , Une nouvelle façon de coder , dans le cloud
What is IBM Bluemix , Une nouvelle façon de coder , dans le cloudWhat is IBM Bluemix , Une nouvelle façon de coder , dans le cloud
What is IBM Bluemix , Une nouvelle façon de coder , dans le cloudPatrick Bouillaud
 
Azure cloud for the web frontend developers
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developersMaxim Salnikov
 
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...Apigee | Google Cloud
 
Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...
Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...
Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...Atlassian
 
Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS
Building Enterprise Apps with Sencha ExtJS/Touch & DeftJSBuilding Enterprise Apps with Sencha ExtJS/Touch & DeftJS
Building Enterprise Apps with Sencha ExtJS/Touch & DeftJSFITC
 
Document your rest api using swagger - Devoxx 2015
Document your rest api using swagger - Devoxx 2015Document your rest api using swagger - Devoxx 2015
Document your rest api using swagger - Devoxx 2015johannes_fiala
 
Practical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version AppPractical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version AppAtlassian
 
Building Secure Apps in the Cloud
Building Secure Apps in the CloudBuilding Secure Apps in the Cloud
Building Secure Apps in the CloudAtlassian
 
Lwc presentation
Lwc presentationLwc presentation
Lwc presentationNithesh N
 
API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...SmartBear
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description LanguagesAkana
 
Api gateway : To be or not to be
Api gateway : To be or not to beApi gateway : To be or not to be
Api gateway : To be or not to beJaewoo Ahn
 
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud AppsFrom AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud AppsAtlassian
 
Designing and Running a GraphQL API
Designing and Running a GraphQL APIDesigning and Running a GraphQL API
Designing and Running a GraphQL APIAtlassian
 
Stormpath 101: Spring Boot + Spring Security
Stormpath 101: Spring Boot + Spring SecurityStormpath 101: Spring Boot + Spring Security
Stormpath 101: Spring Boot + Spring SecurityStormpath
 

What's hot (20)

Spring Boot Authentication...and More!
Spring Boot Authentication...and More! Spring Boot Authentication...and More!
Spring Boot Authentication...and More!
 
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...Enhance existing REST APIs  (e.g. Facebook Graph API) with code completion us...
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
 
Nakal think test_2015
Nakal think test_2015Nakal think test_2015
Nakal think test_2015
 
What is IBM Bluemix , Une nouvelle façon de coder , dans le cloud
What is IBM Bluemix , Une nouvelle façon de coder , dans le cloudWhat is IBM Bluemix , Une nouvelle façon de coder , dans le cloud
What is IBM Bluemix , Une nouvelle façon de coder , dans le cloud
 
Azure cloud for the web frontend developers
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developers
 
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...
I Love APIs 2015: Advanced Security Extensions in Apigee Edge - HMAC and http...
 
Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...
Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...
Building a Cerberus App Without Losing Our Heads: The Passage to a Cross-Plat...
 
Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS
Building Enterprise Apps with Sencha ExtJS/Touch & DeftJSBuilding Enterprise Apps with Sencha ExtJS/Touch & DeftJS
Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS
 
Document your rest api using swagger - Devoxx 2015
Document your rest api using swagger - Devoxx 2015Document your rest api using swagger - Devoxx 2015
Document your rest api using swagger - Devoxx 2015
 
Let's Jira do the work
Let's Jira do the workLet's Jira do the work
Let's Jira do the work
 
Practical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version AppPractical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version App
 
Building Secure Apps in the Cloud
Building Secure Apps in the CloudBuilding Secure Apps in the Cloud
Building Secure Apps in the Cloud
 
Lwc presentation
Lwc presentationLwc presentation
Lwc presentation
 
API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...API Developer Experience: Why it Matters, and How Documenting Your API with S...
API Developer Experience: Why it Matters, and How Documenting Your API with S...
 
API Description Languages
API Description LanguagesAPI Description Languages
API Description Languages
 
Api Design
Api DesignApi Design
Api Design
 
Api gateway : To be or not to be
Api gateway : To be or not to beApi gateway : To be or not to be
Api gateway : To be or not to be
 
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud AppsFrom AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
From AUI to Atlaskit - Streamlining Development for Server & Cloud Apps
 
Designing and Running a GraphQL API
Designing and Running a GraphQL APIDesigning and Running a GraphQL API
Designing and Running a GraphQL API
 
Stormpath 101: Spring Boot + Spring Security
Stormpath 101: Spring Boot + Spring SecurityStormpath 101: Spring Boot + Spring Security
Stormpath 101: Spring Boot + Spring Security
 

Viewers also liked

Getting Certified - proven tips for success (French Touch Dreamin)
Getting Certified - proven tips for success (French Touch Dreamin)Getting Certified - proven tips for success (French Touch Dreamin)
Getting Certified - proven tips for success (French Touch Dreamin)Samuel De Rycke
 
Spring '16 release belgium salesforce user group samuel de rycke
Spring '16 release belgium salesforce user group samuel de ryckeSpring '16 release belgium salesforce user group samuel de rycke
Spring '16 release belgium salesforce user group samuel de ryckeSamuel De Rycke
 
Salesforce1 API Overview
Salesforce1 API OverviewSalesforce1 API Overview
Salesforce1 API OverviewSamuel De Rycke
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Samuel De Rycke
 
Integration with the Salesforce App Cloud - Amsterdam 2016
Integration with the Salesforce App Cloud - Amsterdam 2016Integration with the Salesforce App Cloud - Amsterdam 2016
Integration with the Salesforce App Cloud - Amsterdam 2016Samuel De Rycke
 
Salesforce Flexible Pages
Salesforce Flexible PagesSalesforce Flexible Pages
Salesforce Flexible PagesSamuel De Rycke
 
Banish The Buzzwords
Banish The BuzzwordsBanish The Buzzwords
Banish The BuzzwordsLinkedIn
 
A Taste of Lightning in Action
A Taste of Lightning in ActionA Taste of Lightning in Action
A Taste of Lightning in ActionSteven Hugo
 

Viewers also liked (9)

Getting Certified - proven tips for success (French Touch Dreamin)
Getting Certified - proven tips for success (French Touch Dreamin)Getting Certified - proven tips for success (French Touch Dreamin)
Getting Certified - proven tips for success (French Touch Dreamin)
 
Spring '16 release belgium salesforce user group samuel de rycke
Spring '16 release belgium salesforce user group samuel de ryckeSpring '16 release belgium salesforce user group samuel de rycke
Spring '16 release belgium salesforce user group samuel de rycke
 
Salesforce APIs
Salesforce APIsSalesforce APIs
Salesforce APIs
 
Salesforce1 API Overview
Salesforce1 API OverviewSalesforce1 API Overview
Salesforce1 API Overview
 
Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015Asynchronous Apex Salesforce World Tour Paris 2015
Asynchronous Apex Salesforce World Tour Paris 2015
 
Integration with the Salesforce App Cloud - Amsterdam 2016
Integration with the Salesforce App Cloud - Amsterdam 2016Integration with the Salesforce App Cloud - Amsterdam 2016
Integration with the Salesforce App Cloud - Amsterdam 2016
 
Salesforce Flexible Pages
Salesforce Flexible PagesSalesforce Flexible Pages
Salesforce Flexible Pages
 
Banish The Buzzwords
Banish The BuzzwordsBanish The Buzzwords
Banish The Buzzwords
 
A Taste of Lightning in Action
A Taste of Lightning in ActionA Taste of Lightning in Action
A Taste of Lightning in Action
 

Similar to Lightning Chess at the Sri Sanka Salesforce Developer Group

Flash skills for silverlight design and development (30 Abr 2010)
Flash skills for silverlight design and development (30 Abr 2010)Flash skills for silverlight design and development (30 Abr 2010)
Flash skills for silverlight design and development (30 Abr 2010)Ricardo Castelhano
 
SharePoint and Office Development Workshop
SharePoint and Office Development WorkshopSharePoint and Office Development Workshop
SharePoint and Office Development WorkshopEric Shupps
 
Developing Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptxDeveloping Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptxDmitry Vinnik
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRight IT Services
 
Project Darkstar
Project DarkstarProject Darkstar
Project DarkstarAhmed Saeed
 
Going FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at NetflixGoing FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at NetflixYunong Xiao
 
SharePoint and Office 365 Development Workshop
SharePoint and Office 365 Development WorkshopSharePoint and Office 365 Development Workshop
SharePoint and Office 365 Development WorkshopEric Shupps
 
Salesforce Developer Toolkit - Salesforce Impact Hackathon
Salesforce Developer Toolkit - Salesforce Impact HackathonSalesforce Developer Toolkit - Salesforce Impact Hackathon
Salesforce Developer Toolkit - Salesforce Impact Hackathonrohitasare71
 
harePoint Framework Webinar Series: Consume Graph APIs in SharePoint Framework
harePoint Framework Webinar Series: Consume Graph APIs in SharePoint FrameworkharePoint Framework Webinar Series: Consume Graph APIs in SharePoint Framework
harePoint Framework Webinar Series: Consume Graph APIs in SharePoint FrameworkJenkins NS
 
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIsSalesforce Marketing Cloud
 
Real World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure ServicesReal World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure ServicesBrian Culver
 
Introduction to Microsoft Silverlight
Introduction to Microsoft SilverlightIntroduction to Microsoft Silverlight
Introduction to Microsoft SilverlightGlen Gordon
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar SlidesDuraSpace
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsApigee | Google Cloud
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopJimmy Guerrero
 
SharePoint for the .NET Developer
SharePoint for the .NET DeveloperSharePoint for the .NET Developer
SharePoint for the .NET DeveloperJohn Calvert
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hourConvert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hourBrian Culver
 
Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?Robert MacLean
 
CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...
CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...
CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...Louis Göhl
 

Similar to Lightning Chess at the Sri Sanka Salesforce Developer Group (20)

Flash skills for silverlight design and development (30 Abr 2010)
Flash skills for silverlight design and development (30 Abr 2010)Flash skills for silverlight design and development (30 Abr 2010)
Flash skills for silverlight design and development (30 Abr 2010)
 
SharePoint and Office Development Workshop
SharePoint and Office Development WorkshopSharePoint and Office Development Workshop
SharePoint and Office Development Workshop
 
Developing Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptxDeveloping Lightning Components for Communities.pptx
Developing Lightning Components for Communities.pptx
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce Lightning
 
Project Darkstar
Project DarkstarProject Darkstar
Project Darkstar
 
Going FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at NetflixGoing FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at Netflix
 
SharePoint and Office 365 Development Workshop
SharePoint and Office 365 Development WorkshopSharePoint and Office 365 Development Workshop
SharePoint and Office 365 Development Workshop
 
Salesforce Developer Toolkit - Salesforce Impact Hackathon
Salesforce Developer Toolkit - Salesforce Impact HackathonSalesforce Developer Toolkit - Salesforce Impact Hackathon
Salesforce Developer Toolkit - Salesforce Impact Hackathon
 
harePoint Framework Webinar Series: Consume Graph APIs in SharePoint Framework
harePoint Framework Webinar Series: Consume Graph APIs in SharePoint FrameworkharePoint Framework Webinar Series: Consume Graph APIs in SharePoint Framework
harePoint Framework Webinar Series: Consume Graph APIs in SharePoint Framework
 
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs#CNX14 - Dive Deep into the ExactTarget Fuel APIs
#CNX14 - Dive Deep into the ExactTarget Fuel APIs
 
Real World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure ServicesReal World SharePoint Framework and Azure Services
Real World SharePoint Framework and Azure Services
 
Introduction to Microsoft Silverlight
Introduction to Microsoft SilverlightIntroduction to Microsoft Silverlight
Introduction to Microsoft Silverlight
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js Workshop
 
SharePoint for the .NET Developer
SharePoint for the .NET DeveloperSharePoint for the .NET Developer
SharePoint for the .NET Developer
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hourConvert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
 
Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?
 
CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...
CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...
CLI319 Microsoft Desktop Optimization Pack: Planning the Deployment of Micros...
 

Recently uploaded

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceIES VE
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 

Recently uploaded (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 

Lightning Chess at the Sri Sanka Salesforce Developer Group

  • 1. Lightning Chess The fun way of learning the Lightning Component Framework Sri Lanka Salesforce Developer Group 2016-12-8 #SFLightningChess #SalesforceDevs 1
  • 2. Who am I? 2 Samuel De Rycke Technical Architect Talent Management 4.5 years SF experience Salesforce MVP Belgium User Group Leader Belgium Developer Group Leader Salesforce.Stackexchange Moderator Dreamforce Speaker }ABSI @SamuelDeRycke Implementation Partner @absi_nv
  • 3. 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 3
  • 4. Lightning Chess ● R&D project ● Effort: 40 hours + rework ● Chess application on the Salesforce Platform ● Realtime multiplayer game ● Built using Lightning Component framework Lightning what?! 4
  • 5. Application Architecture Streaming API Custom Objects Apex Controllers Lightning Chess Player ClientsLightning Chess Player Clients ServerCall Subscribe Updates Salesforce Platform 5
  • 6. Time for a demo Demo: Lightning Chess 6
  • 7. Lightning Component Framework ● Lightning Application ● Lightning Components ● Lightning Events The Fundamentals 7
  • 8. Component Bundle Lightning Component Component Bundle Component < markup /> Style CSS Renderer Javascript Controller Javascript Helper Javascript Design < markup /> Documentation < markup /> SVG File 8
  • 9. 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 9
  • 10. 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. Less bugs. ● 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 or application. ● Compact Separation of Concerns will lead to code that is small and easy to maintain, debug and test. Components can be: “Think Component Encapsulation“ 10
  • 11. 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 Subscribe to streaming API and forward streaming event messages Streaming API Listener 11
  • 12. 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> 12
  • 13. 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“ 13
  • 14. Lightning Chess: Component architecture Mistakes were made 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 14 “Single Responsibility“
  • 15. Event Driven Architecture Event types <aura:event type=”Component” description=”Chessboard_Location_Select”> <aura:attribute name=”location” type=”Object” /> </aura:event> 15 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
  • 16. 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 --> !-- Public Interface--> <aura:registerEvent name=”select” type=”c:Chessboard_Location_Select” /> </aura:component> <aura:component description=”Chessboard”> <!-- Chessboard component Definition --> <!-- Chessboard has a Chessboard Location component and subscribes a handler to the select component event--> <c:Chessboard_Location select=”{!c.handleLocationSelect}” /> </aura:component> 16
  • 17. Lightning Chess: Event Driven Approach Communication is key Chessboard Chessboard Location Streaming API Listener Chess Logic Server Call I am selected as a starting location I 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“ 17
  • 18. Let’s Code ! Extend the Chessboard Location component by adding drag-and-drop support. 18
  • 19. Summary Takeaways “Think Component Encapsulation“ “Single Responsibility“ “Loose communication through Events“ 19
  • 20. Resources Code @ Github! http://bit.ly/LightningChess-Code Read more about Lightning Chess Architecture: http://bit.ly/LightningChess-Blog 20
  • 21. Questions ? Reach me on twitter @SamuelDeRycke #SFLightningChess 21