no code to lighting component developer dreamforce 2016

39
From No Code to Lightning Component Developer Kerry Townsend Assoc. Manager, Accenture @KerryTownsend @bob_buzzard Keir Bowden CTO, Brightgen

Upload: kerry-townsend

Post on 08-Feb-2017

34 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: No code to lighting component developer dreamforce 2016

From No Code to Lightning Component Developer

Kerry TownsendAssoc. Manager, Accenture@KerryTownsend @bob_buzzard

Keir BowdenCTO, Brightgen

Page 2: No code to lighting component developer dreamforce 2016

No Code to Lightning Components

The peaks and troughs

@KerryTownsend

Kerry Townsend & Keir Bowden

@Bob_Buzzard

Page 3: No code to lighting component developer dreamforce 2016

Kerry Townsend

Solution Architect, Assoc. Manager, Accenture

Page 4: No code to lighting component developer dreamforce 2016

Keir Bowden

CTO, BrightGen

Page 5: No code to lighting component developer dreamforce 2016

Who will get the most from this session?

Page 6: No code to lighting component developer dreamforce 2016

Career Personal Community

★ Love to Learn★ Empathy with

Colleagues★ Join the Conversation★ Credibility

★ More developers needed

★ Find out if it is possible★ Understand the effort,

duration★ Understand the journey

steps★ Determine if repeatable

★ Important as Solution Architect

★ Coding is a valued skill★ Can’t buy practical

experience★ Lightning Components

are the future

Our MotivationMost importantly why...

Page 7: No code to lighting component developer dreamforce 2016

My Journey: Start State

10yrs using Platform

Good declarative understanding An understanding of APEX & Visualforce

I thought, I have…

Do Learning

Give PresentationI thought it would be straightforward

I was feeling confident

Page 8: No code to lighting component developer dreamforce 2016

My Journey: Actual State

Crashed & Burnt

Jumped inboth Feet

Committed to Talk

Learn APEX/ VF or LC?

Heard about LC

Learnt about LEX

Attended Meetups

Page 9: No code to lighting component developer dreamforce 2016

Why Was it So Challenging?

Page 10: No code to lighting component developer dreamforce 2016

Unfamiliar TerminologyA strange place when you don’t speak the language

Framework

Asynchronous

Name Value Pair

Model-View-Controller

Tightly Bound

AbstractionPolymorphism

HoistingEncapsulation

Block Scoping

Page 11: No code to lighting component developer dreamforce 2016

Prior Knowledge AssumedLike Googling a medical condition

“Lightning Component Framework is similar to other frameworks like React and Angular JS”

“In much the same way as Bootstrap…”

“Create objects like other OOP languages”

“Add the attribute to the tag like visualforce…”

Page 12: No code to lighting component developer dreamforce 2016

No JavaScript Experience

“It is a jackpot when you get to

know javascript can be

debugged.”

― Mussadiq Abdul Rahim

“You’re building your own maze,

in a way, and you might just get

lost in it.”

― Marijn Haverbeke,

Eloquent JavaScript

http://www.goodreads.com/quotes/tag/javascript

“Java is to JavaScript what Car is to

Carpet.”

― Chris Heilmann

“JavaScript’s global scope is like a

public toilet. You can’t avoid going in

there, but try to limit your contact

with surfaces when you do.”

― Dmitry Baranovskiy

Page 13: No code to lighting component developer dreamforce 2016

“The browser is the most hostile software development environment

ever imagined”

Douglas Crockford

Page 14: No code to lighting component developer dreamforce 2016

My Journey: Revised State

Didn’t Give Up

Asked Community

Got Reassurance

JoinedCode School

Took a JavaScript Road Trip

Re-Visited Trailhead

Page 15: No code to lighting component developer dreamforce 2016

Trailhead Unit Breakdown

Estimated Time My Time

1.Before You Start 10mins 10mins

4.Attributes and Expressions 25mins 1hr

6.Input Data Using Forms 35mins 3hrs

7.Connect to Salesforce with Server-Side Controllers 35mins 4hrs

Planning your time

Page 16: No code to lighting component developer dreamforce 2016

Nothing worth doing...

..comes too easilyhttp://jimvaglica.com/index.php/2015/12/20/what-does-it-take-to-be-an-american-ninja-warrior/

Page 17: No code to lighting component developer dreamforce 2016

Lightning ComponentsWhat is a Lightning Component?

Page 18: No code to lighting component developer dreamforce 2016

A Lightning component is a bundle

Component Controller

HelperStyle

Component Bundle

Apex Controller

Page 19: No code to lighting component developer dreamforce 2016

Components can contain other components

AppHeader

Contact List

AccountContactEdit Component

Contact Edit

http://bobbuzzard.blogspot.co.uk/2015/09/lightning-design-system-edit-parent-and.html

Page 20: No code to lighting component developer dreamforce 2016

My First Lightning ComponentIncluding actual code...

Page 21: No code to lighting component developer dreamforce 2016

Picking a first Component

Started Big → Appointment Suggestion

Function

Key Lesson - Start small for early wins

The IdeaSimplified → Email Subscription Related List

Simplified Again → Contact History Related

List

Page 22: No code to lighting component developer dreamforce 2016

Contact History Related List Component

Specifies SS Controller

Calls Init function

Displays fields

Contains styling (SLDS)

Component Controller Apex Controller

Init function

Passes Record IDQueries Contact History

Page 23: No code to lighting component developer dreamforce 2016

Server Side ControllerRequests the records to display

Page 24: No code to lighting component developer dreamforce 2016

Use Developer Workbench for Queriesworkbench.developerforce.com/query.php

Page 25: No code to lighting component developer dreamforce 2016

ContactHistory.cmp - ComponentDefines how and what displays on the page

Page 26: No code to lighting component developer dreamforce 2016

Defines a component’s actions including server calls

- No Helper in this example

ContactHistoryController.js - Client-side Controller

Page 27: No code to lighting component developer dreamforce 2016

Contact in the Lightning Experience UI - No Styling

Get Logic working before adding

Styling

Page 28: No code to lighting component developer dreamforce 2016

Contact in the Lightning Experience UI - StylingContact History in Related List

1. Find styling on

SLDS

2. Copy & Paste into

Component

3. Move code logic

into correct places

Page 29: No code to lighting component developer dreamforce 2016

Further Improvements

Develop into Subscriber

Related List

Add CountChange Field Name

Allow Multiple Field Types

Add View All

Page 30: No code to lighting component developer dreamforce 2016

Important Terminology

Page 31: No code to lighting component developer dreamforce 2016

Key TerminologySLDS - Salesforce Lightning Design System

www.lightningdesignsystem.com/

JavaScript variable scopemsdn.microsoft.com/en-us/library/bzt2dkta(v=vs.94).aspx

Asynchronous processingrowanmanning.com/posts/javascript-for-beginners-async/

Attribute Bindingdeveloper.salesforce.com/blogs/developer-relations/2015/07/lightning-components-2.html

Page 32: No code to lighting component developer dreamforce 2016

Reflecting On My ExperienceLessons learned

Page 33: No code to lighting component developer dreamforce 2016

Learn Basic JavaScriptPick a course that has practical exercises that can be checked

Familiarise yourself with HTML, SQL, CSSNot required to the same level as JS but if you have the time its worth investing

Complete Lightning Components Basics up to Input Data Using Forms UnitThe Input Challenge teaches about the server side Controller

Create a Related List ComponentDisplays data from the server, build your confidence. Improve 1 step at a time

Complete the Lightning Components Basics These may take time, continue making incremental changes to your own components

1

2

3

4

5

Suggested StepsIf I had my time again...

Page 34: No code to lighting component developer dreamforce 2016

Mindset In the Code Component Basic Trailhead

★ Remember to Save★ Be careful with Case

and Plurals★ Comment your code

with your own notes★ Change one thing at a

time★ No more than 15 mins

★ Remember Code will be refactored

★ Create the Expenses example

★ Understand which code goes in which file

★ Use Forums★ Last step is Resources

★ Expect a Challenge★ Schedule Time★ Avoid Deadlines★ Find a Buddy (physical/

virtual)

Key Advice

Page 35: No code to lighting component developer dreamforce 2016

Main Take Aways

It is possible!

Once you get the Bug you won’t stop

It is challenging & needs time but is worth it

Practise, practise, practise

Is this even possible?

1

2

3

No Experience Necessary

Journey Starts Here4

Page 36: No code to lighting component developer dreamforce 2016

Paul Battison John Stevenson Dave Carroll

Other Thank Yous

Page 38: No code to lighting component developer dreamforce 2016

Thank Y u

Page 39: No code to lighting component developer dreamforce 2016

Init FunctionThree common code sections

Define Action

Call Back

Defines the required Server Side action

Queue Action

Handles the response from the server &

should handle errors

Sends the request to the server