Copyright © 2018 AutoRABIT.
Design Patterns for
Using Second Generation Packaging (2GP)
Speakers Prashanth Samudrala
@samudrala153
Practice Architect, Customer Success
Abhilash Murali
@
Sr. Customer Success Engineer
www.autorabit.com Copyright © 2018 AutoRABIT.
Copyright © 2018 AutoRABIT.
Forward Looking
Statement
This presentation is provided on an “as-is” and “as available” basis, and company (and our
suppliers) expressly disclaim any and all warranties and conditions of any kind, whether
express, implied, or statutory, including all warranties or conditions of merchantability,
fitness for a particular purpose, title, quiet enjoyment, accuracy, or non-infringement. We
(and our suppliers) make no warranty that the information presented here will meet your
requirements, will be available on an uninterrupted, timely, secure, or error-free basis, or
will be accurate, reliable, free of viruses or other harmful code, complete, legal, or safe.
Some jurisdictions do not allow the exclusion of implied warranties, so the above exclusion
may not apply to you. Some jurisdictions do not allow limitations on how long an implied
warranty lasts, so the above limitation may not apply to you.
This presentation may contain forward-looking statements that involve uncertainties,
assumptions and risks. If any such uncertainties materialize or if any of the assumptions
proves incorrect, the results of AutoRABIT Pvt. Ltd. could differ materially from the results
expressed or implied by the forward-looking statements we make. Since AutoRABIT has no
control over such uncertainties, assumptions and risks
All statements other than statements of historical fact could be deemed forward-looking,
including any projections of AutoRABIT as a 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 customers who purchase a subscription to
our product or services should make the purchase decisions based upon features that are
currently available.
Copyright © 2018 AutoRABIT.
Agenda
• Traditional Software Design Patterns
• Salesforce Application Decomposition for Packaging
• Modular Development in Salesforce
• AutoRABIT Offering
Copyright © 2018 AutoRABIT.
What are Design Patterns?
 Reusable solution to common problems.
 Not a finished entity
 Path to great maintainability
Problem
Consequences Context
Benefits Causes
Dependencies
Relationships
Templates
Namespaces
Specification
Containers
Ancestry
Copyright © 2018 AutoRABIT.
Types of Design Patterns
Creational Behavioural Structural Concurrency
How can this be applied to Salesforce Development ?
Patterns used in traditional Software development.
A pattern used to construct objects such that
they can be decoupled from their implementing
system
A largely used pattern to form large complex
object structures between many disparate
objects
The new age algorithms, relationships,
responsibilities between objects managed
through event behaviors.
A choice of patterns that impact the design and
performance of applications
Ex- Active Object, Monitor Object,
Leaders/Followers, etc..
Copyright © 2018 AutoRABIT.
Feature 1 Feature 2 Feature 3 Feature 4
Service Logic
Domain Logic Utility Logic
Schema
Design Patterns for Salesforce Applications
Enterprise Design Patterns
Copyright © 2018 AutoRABIT.
Declarative: Custom Objects, Fields, Relationships
Coding: Apex Triggers
Declarative: Dataloader
Coding: SOQL and SOSL, Salesforce APIs
Declarative: Formula, Validation, Workflow, Sharing Rules
Coding: Apex
Declarative: Layouts, RecordTypes, Formula,
Reports, Lightning Interface, Dashboards
Coding: Visualforce and Apex
Application Packaging Model in Salesforce – The Materialized path
Copyright © 2018 AutoRABIT.
Packaging – Patterns and Antipatterns
• Apps that are built inside of your Salesforce Env. | New Development
• Metadata that extends the standard functionality of Salesforce – Sales Cloud, Service Cloud
• Any customizations that are done on top of App Exchange apps
• Any newly created Metadata (Lightning Pages, Apex Classes)
• Stories that can be released independently
• Atomicity, Consistency, Isolation, Durability (ACID mantra)
Patterns
• Don’t export entire org as a single project | Modularize
• Avoid cross component references
• Favor Immutability
• Eventual Consistency
• Look out for shared schema and decompose Apps based of it
• Watch out for Standard Objects which are heavily shared.
• Add shared objects to a common schema
• Always update shared schema as you go
Anti - Patterns
Copyright © 2018 AutoRABIT.
Salesforce Development Pre 2GP
Dev
Sandbox 1
Dev
Sandbox 2
Dev
Sandbox 3
Dev
Sandbox X SIT QA UAT Prod
Version Control
Pull/Push Metadata Packaging & Deploy
Org differences are
tracked manually
Org differences are
version controlled
All phases of the Development
process are executed
via metadata API
Releases are specific to
a Production Org
Copyright © 2018 AutoRABIT.
Modular Development in Salesforce – The DX Way
• Release schedule for
each package
• Release Artifacts are
new package version
• Flexible Packaging Model
• Containers for transporting
entire modules of Metadata
• Add/edit/remove
components
• Iterate using versions
• Source Driven
Development
• Collaboration of teams for
Development
• Metadata and Code are
modular
• Environments are easily
created and disposable
AKA Scratch Orgs
Copyright © 2018 AutoRABIT.
Salesforce Development Post 2GP
Scratch
Org 1
Scratch
Org 2
Scratch
Org 3
Scratch
Org 4 SIT QA UAT Prod
Version Control
Legend text here Legend text here
Copyright © 2018 AutoRABIT.
Copyright © 2018 AutoRABIT.
AutoRABIT
seamlessly integrates
the three Silos
Drives efficient
application development
best practices in
three categories
Salesforce DX
ALM
Feature
Branches
Provisioning
Development
Release
Copyright © 2018 AutoRABIT.
Where to Start
• Draw a blueprint around your monolithic org to identify your
Applications
• Start small by extrapolate your base package for an App
• Create base packages with shared schema
• Work with your ALM/ Scrum master to identify user stories that
can modularized
• Identify Metadata that can modularize into packages using
Patterns and Anti Patterns
• Use Org Shape to create your Scratch Orgs based on your user
story
• Understand Dependencies and Import Modules to your Scratch
Orgs which will lead to “Smart Packages”.
Copyright © 2018 AutoRABIT.
AutoRABIT Dependency Analyser
BugsBunny
Copyright © 2018 AutoRABIT.
Org Specific Templates
Copyright © 2018 AutoRABIT.
Create DCP
Development ReleaseProvisioning
Scratch Org Developer Pro Sandbox Partial Copy Sandbox
Full Copy Sandbox Production Version Control Packaging
Dependency Analyzer*
Workflow of 2GP using AutoRABIT
Copyright © 2018 AutoRABIT.
DX Evolution with AutoRABIT
• Register the DevHub [ Prod Org or Business Org or Trial Org]
• Create Scratch Orgs for the work items in the sprint
• Create Scratch Orgs with all the supported features [Org Shape] as well as
preferences inline with SFDX
• Populate Scratch Orgs with Metadata [ From Sandbox or Version Control ] using
Dependency Analyzer and saving them as Module specific templates
• Populate Scratch Orgs with required Data
• Create features branches for Scratch Orgs
• Login to Scratch Orgs directly from AutoRABIT
• Validate Scratch Org and perform code review
• Run Static Code Analysis and security scan on Scratch Org
• Check-in changes from Scratch Org to feature branch [ Source control] with
Developer Controlled Packages (2GP)
• Merge the changes directly between source control branches
• Perform automated pre-post deployment steps [ unsupported metadata ]
• CI Deploy / Selective Deployment from Source control to any release sandbox /
Prod environment
• Repeat the process for a perfect Packaging
Copyright © 2018 AutoRABIT.
• Verify the code/configuration is deployable without
missing dependencies
• Run automated units tests and verify code coverage
• Check for Static code analysis, security scans
• Complete the code review with peers
• Defects exponentially reduced at each stage of release
process
• Produce high quality software
• Higher release velocity
DX End state with AutoRABIT
Copyright © 2018 AutoRABIT.
Copyright © 2018 AutoRABIT.
Copyright © 2018 AutoRABIT.
Visit us @ Booth No. 18
Copyright © 2018 AutoRABIT.
IF YOU WISH TO KNOW
MORE ON HOW
AUTORABIT
CAN HELP YOU WITH
RELEASE AUTOMATION
WRITE TO US ON
info@autorabit.com

Design patterns for salesforce app decomposition

  • 1.
    Copyright © 2018AutoRABIT. Design Patterns for Using Second Generation Packaging (2GP) Speakers Prashanth Samudrala @samudrala153 Practice Architect, Customer Success Abhilash Murali @ Sr. Customer Success Engineer www.autorabit.com Copyright © 2018 AutoRABIT.
  • 2.
    Copyright © 2018AutoRABIT. Forward Looking Statement This presentation is provided on an “as-is” and “as available” basis, and company (and our suppliers) expressly disclaim any and all warranties and conditions of any kind, whether express, implied, or statutory, including all warranties or conditions of merchantability, fitness for a particular purpose, title, quiet enjoyment, accuracy, or non-infringement. We (and our suppliers) make no warranty that the information presented here will meet your requirements, will be available on an uninterrupted, timely, secure, or error-free basis, or will be accurate, reliable, free of viruses or other harmful code, complete, legal, or safe. Some jurisdictions do not allow the exclusion of implied warranties, so the above exclusion may not apply to you. Some jurisdictions do not allow limitations on how long an implied warranty lasts, so the above limitation may not apply to you. This presentation may contain forward-looking statements that involve uncertainties, assumptions and risks. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of AutoRABIT Pvt. Ltd. could differ materially from the results expressed or implied by the forward-looking statements we make. Since AutoRABIT has no control over such uncertainties, assumptions and risks All statements other than statements of historical fact could be deemed forward-looking, including any projections of AutoRABIT as a 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 customers who purchase a subscription to our product or services should make the purchase decisions based upon features that are currently available.
  • 3.
    Copyright © 2018AutoRABIT. Agenda • Traditional Software Design Patterns • Salesforce Application Decomposition for Packaging • Modular Development in Salesforce • AutoRABIT Offering
  • 4.
    Copyright © 2018AutoRABIT. What are Design Patterns?  Reusable solution to common problems.  Not a finished entity  Path to great maintainability Problem Consequences Context Benefits Causes Dependencies Relationships Templates Namespaces Specification Containers Ancestry
  • 5.
    Copyright © 2018AutoRABIT. Types of Design Patterns Creational Behavioural Structural Concurrency How can this be applied to Salesforce Development ? Patterns used in traditional Software development. A pattern used to construct objects such that they can be decoupled from their implementing system A largely used pattern to form large complex object structures between many disparate objects The new age algorithms, relationships, responsibilities between objects managed through event behaviors. A choice of patterns that impact the design and performance of applications Ex- Active Object, Monitor Object, Leaders/Followers, etc..
  • 6.
    Copyright © 2018AutoRABIT. Feature 1 Feature 2 Feature 3 Feature 4 Service Logic Domain Logic Utility Logic Schema Design Patterns for Salesforce Applications Enterprise Design Patterns
  • 7.
    Copyright © 2018AutoRABIT. Declarative: Custom Objects, Fields, Relationships Coding: Apex Triggers Declarative: Dataloader Coding: SOQL and SOSL, Salesforce APIs Declarative: Formula, Validation, Workflow, Sharing Rules Coding: Apex Declarative: Layouts, RecordTypes, Formula, Reports, Lightning Interface, Dashboards Coding: Visualforce and Apex Application Packaging Model in Salesforce – The Materialized path
  • 8.
    Copyright © 2018AutoRABIT. Packaging – Patterns and Antipatterns • Apps that are built inside of your Salesforce Env. | New Development • Metadata that extends the standard functionality of Salesforce – Sales Cloud, Service Cloud • Any customizations that are done on top of App Exchange apps • Any newly created Metadata (Lightning Pages, Apex Classes) • Stories that can be released independently • Atomicity, Consistency, Isolation, Durability (ACID mantra) Patterns • Don’t export entire org as a single project | Modularize • Avoid cross component references • Favor Immutability • Eventual Consistency • Look out for shared schema and decompose Apps based of it • Watch out for Standard Objects which are heavily shared. • Add shared objects to a common schema • Always update shared schema as you go Anti - Patterns
  • 9.
    Copyright © 2018AutoRABIT. Salesforce Development Pre 2GP Dev Sandbox 1 Dev Sandbox 2 Dev Sandbox 3 Dev Sandbox X SIT QA UAT Prod Version Control Pull/Push Metadata Packaging & Deploy Org differences are tracked manually Org differences are version controlled All phases of the Development process are executed via metadata API Releases are specific to a Production Org
  • 10.
    Copyright © 2018AutoRABIT. Modular Development in Salesforce – The DX Way • Release schedule for each package • Release Artifacts are new package version • Flexible Packaging Model • Containers for transporting entire modules of Metadata • Add/edit/remove components • Iterate using versions • Source Driven Development • Collaboration of teams for Development • Metadata and Code are modular • Environments are easily created and disposable AKA Scratch Orgs
  • 11.
    Copyright © 2018AutoRABIT. Salesforce Development Post 2GP Scratch Org 1 Scratch Org 2 Scratch Org 3 Scratch Org 4 SIT QA UAT Prod Version Control Legend text here Legend text here
  • 12.
  • 13.
    Copyright © 2018AutoRABIT. AutoRABIT seamlessly integrates the three Silos Drives efficient application development best practices in three categories Salesforce DX ALM Feature Branches Provisioning Development Release
  • 14.
    Copyright © 2018AutoRABIT. Where to Start • Draw a blueprint around your monolithic org to identify your Applications • Start small by extrapolate your base package for an App • Create base packages with shared schema • Work with your ALM/ Scrum master to identify user stories that can modularized • Identify Metadata that can modularize into packages using Patterns and Anti Patterns • Use Org Shape to create your Scratch Orgs based on your user story • Understand Dependencies and Import Modules to your Scratch Orgs which will lead to “Smart Packages”.
  • 15.
    Copyright © 2018AutoRABIT. AutoRABIT Dependency Analyser BugsBunny
  • 16.
    Copyright © 2018AutoRABIT. Org Specific Templates
  • 17.
    Copyright © 2018AutoRABIT. Create DCP Development ReleaseProvisioning Scratch Org Developer Pro Sandbox Partial Copy Sandbox Full Copy Sandbox Production Version Control Packaging Dependency Analyzer* Workflow of 2GP using AutoRABIT
  • 18.
    Copyright © 2018AutoRABIT. DX Evolution with AutoRABIT • Register the DevHub [ Prod Org or Business Org or Trial Org] • Create Scratch Orgs for the work items in the sprint • Create Scratch Orgs with all the supported features [Org Shape] as well as preferences inline with SFDX • Populate Scratch Orgs with Metadata [ From Sandbox or Version Control ] using Dependency Analyzer and saving them as Module specific templates • Populate Scratch Orgs with required Data • Create features branches for Scratch Orgs • Login to Scratch Orgs directly from AutoRABIT • Validate Scratch Org and perform code review • Run Static Code Analysis and security scan on Scratch Org • Check-in changes from Scratch Org to feature branch [ Source control] with Developer Controlled Packages (2GP) • Merge the changes directly between source control branches • Perform automated pre-post deployment steps [ unsupported metadata ] • CI Deploy / Selective Deployment from Source control to any release sandbox / Prod environment • Repeat the process for a perfect Packaging
  • 19.
    Copyright © 2018AutoRABIT. • Verify the code/configuration is deployable without missing dependencies • Run automated units tests and verify code coverage • Check for Static code analysis, security scans • Complete the code review with peers • Defects exponentially reduced at each stage of release process • Produce high quality software • Higher release velocity DX End state with AutoRABIT
  • 20.
  • 21.
  • 22.
    Copyright © 2018AutoRABIT. Visit us @ Booth No. 18
  • 23.
    Copyright © 2018AutoRABIT. IF YOU WISH TO KNOW MORE ON HOW AUTORABIT CAN HELP YOU WITH RELEASE AUTOMATION WRITE TO US ON info@autorabit.com