SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
Building Strong Foundations
Apex Enterprise Patterns
Andrew Fawcett, FinancialForce.com, CTO
@andyinthecloud
All about FinancialForce.com
Revolutionizing the Back Office
#1 Accounting, Billing and PSA Apps on the Salesforce platform

▪ Native apps
▪ San Francisco HQ, 595 Market St
▪ R&D in San Francisco, Harrogate UK, and Granada ES
▪ We are hiring! Meet us at Rehab!
What's wrong with this picture?
What's wrong with this picture?

public with sharing class MyController
{
public String theId;

public MyController(ApexPages.StandardController standardController)
{
theId = (String) ApexPages.currentPage().getParameters().get('id');
}
public PageReference actionCheckInvoices()
{
// Read the Account record
Account accountRecord = [select Id, Name from Account where Id = :theId];
// Do some processing on the Account record ... then update it
update accountRecord;
return null;
}
}
public with sharing class MyBatchJob implements Database.Batchable<SObject>
{
public void execute(Database.batchableContext info, List<Account> accounts)
{
for(Account account : accounts)
{
MyController myController = new MyController(new ApexPages.StandardController(account));
myController.actionCheckInvoices();
}
}
public Database.QueryLocator start(Database.BatchableContext info) { ... }
public void finish(Database.batchableContext info) { ... }
}

Developer “A” writes an
Apex Controller first

Developer “B” writes an
Apex Batch job later.
So what was wrong with that picture?
MyController
MyController

Issue

Use of ApexPages.currentPage()

Unnecessary and fragile, utilize instead
stdController.getId() method

Error handling

No try/catch error handling on controller
method

Developer “A”

MyBatchJob

Issue

Use of ApexPages.currentPage()

Is not available in a Batch Apex context, the constructor
code will give an exception.

SOQL Query and DML Governors

Calling the controller method in a loop will cause a SOQL
query and DML governor issues.

Error Handling

No try/catch error handling in the the execute method

Separation of Concerns

Developer A did not originally develop the controller logic
expecting or anticipating Developer B’s would in the future
try to reuse it from a Batch Context as well.
They did not consider correct Separation of Concerns…

Developer “B”
Pattern Checklist
Separation of Concerns
Service Layer
Domain Layer
Selector Layer

☐
☐
☐
☐
So what is “Separation of Concerns” then?
“The goal is to design systems so that functions can be
optimized independently of other functions, so that failure of one
function does not cause other functions to fail, and in general to
make it easier to understand, design and manage complex
interdependent systems”
Wikipedia, “Separation of Concerns”
So what is “DRY” then?
Don’t Repeat Yourself
“Every piece of knowledge must have a single, unambiguous,
authoritative representation within a system.”
Wikipedia, “Don’t repeat yourself (DRY)”
Design Patterns for SOC & Force.com Best Practice
Service Layer
Domain Layer
▪ Yet another Wrapper / Trigger pattern!

Selector Layer
Reference Martin Fowler
▪

http://martinfowler.com/eaaCatalog/

▪

Author of “Patterns of Enterprise
Application Architecture”

Reference
▪

http://wiki.developerforce.com/page/Apex_Enterprise_Patterns_-_Separation_of_Concerns
Demo! “takeaway” a Sample Force.com Application!

GitHub: financialforcedev/fflib-apex-common-samplecode
Sample Application, what’s on the menu?
Platform Feature

Patterns Used

Custom Buttons

Building UI logic and calling Service Layer code
from Controllers

Batch Apex

Reusing Service and Selector Layer code from
with a Batch context

Integration API

Exposing an Integration API via Service Layer
using Apex and REST

Apex Triggers

Factoring your Apex Trigger logic via the Domain
Layer (wrappers)

VisualForce Remoting

Exposing Service Layer code to HTML5 /
JavaScript libraries such as JQuery

GitHub: financialforcedev/fflib-apex-common-samplecode
Pattern Checklist
Separation of Concerns
Service Layer
Domain Layer
Selector Layer

☑
☐
☐
☐
Introducing the Service Layer
Introducing the Service Layer
Naming Convention
▪ Suffix with ‘Service’, e.g. OpportunitiesService
▪ Methods named by purpose not usage, e.g. applyDiscounts
Introducing the Service Layer
Clear Code Factoring
▪ Encapsulates Processes / Tasks
▪ Caller Context Agnostic
Introducing the Service Layer
Defined Responsibilities
▪ Supports Bulkifcation
▪ Transaction management
Developing and calling a Service Layer

public with sharing class AccountService
{
public static void checkOutstandingInvoices(Set<Id> accountIds)
{
// Read the Account records
List<Account> accountRecords = [select Id, Name from Account where Id in :accountIds];
// Do some processing on the Account and Invoice records ... then update them.
update accountRecords;
}
}

Developer “A”
follows Service
Layer pattern.

AccountService.cls
Service Contract
public PageReference actionCheckInvoices()
{
try {
// Process the Account record
AccountService.checkOutstandingInvoices(new Set<Id> { theId });
} catch (Exception e) { ApexPage.addMessages(e); }
return null;
}

Developer “A”
writes Controller
code to consume
the Service.

MyController.cls
public void execute(Database.batchableContext info, List<Account> accounts)
{
try {
// Process Account records
Set<Id> accountIds = new Map<Id, Account>(accounts).keySet();
AccountService.checkOutstandingInvoices(accountIds);
} catch (Exception e) { emailError(e); }
}

MyBatch.cls

Developer “B”
then reuses the
Developer “A”
code safely.
Code Walkthrough : Sample Services
Managing DML and Transactions
▪ Unit of Work Pattern

Classes
OpportunitiesService.cls
Code Walkthrough : Custom Buttons
Custom Buttons
▪

Detail and List View

▪

Calling Visualforce Controller Code

Visualforce Controllers and Pages
▪

Error Handling

▪

Interacts with Service Layer
•

Utilize bulkified methods

•

Assume transaction containment

•

Catch exceptions and display them on the page

Classes and Pages
OpportunityApplyDiscountController.cls
• opportunityapplydiscount.page
• opportunityapplydiscounts.page
OpportunityCreateInvoiceController.cls
• opportunitycreateinvoice.page
• opportunitycreateinvoices.page
CodeHandling
Walkthrough : Batch Apex
▪ Error

Classes

▪ Interacts with Service Layer

CreatesInvoicesJob.cls

• Utilize bulkified methods
• Assume transaction containment
• Catch exceptions and logs them for later notificaiton
CodeHandling
Walkthrough : Exposing an Integration API
▪ Error
Classes

• Pass business logic exceptions to caller to handle
• Assume transaction containment

OpportunitiesResource.cls
OpportunitiesService.cls

▪ Exposing the API
• To Apex Developers > Mark Service class and methods as global!
–

Package to apply Apex versioning of the API

• To Web / Mobile Developers > Create RESTful API around Service layer
Code Walkthrough : Visualforce Remoting
An “Opportunities Discount Console”

Classes
OpportunityConsoleController.cls

▪ Developer uses a Rich HTML5 Client Library, such as JQuery
• Is not using traditional Visualforce markup or action functions on the controller

▪ Utilizing static “remote” methods on the controller (stateless controller)
• Able to consume the Service layer functions also!
• Assumes transactional integrity
• Assumes the caller (JavaScript client) to handle exceptions
Pattern Checklist
Separation of Concerns
Service Layer
Domain Layer
Selector Layer

☑
☑
☐
☐
Introducing the Domain Layer
Introducing the Domain Layer
Naming Convention
▪ Name uses plural name of object, e.g. Opportunities
Introducing the Domain Layer
Clear Code Factoring
▪ Encapsulates Validation
/ Defaulting of Fields
▪ Wraps Apex Trigger Logic
in Apex Class
(Trigger/Wrapper Pattern)
Introducing the Domain Layer
Defined Responsibilities
▪ Enforces Bulkifcation for logic
▪ Platform security best practice
(honors Users profile)
▪ Encapsulates ALL logic / behavior
for each object
• e.g. onValidate, onBeforeInsert and
applyDiscount
Introducing the Domain Layer : Apex Trigger Flow
Code Walkthrough : Domain Layer : Apex Triggers
What no code?!? ☺

Triggers
OpportunitiesTrigger.trigger
OpportunityLineItemsTrigger.trigger
Code Walkthrough : Domain Layer : Domain Classes
Bulkified Wrappers

▪ Base class fflib_SObjectDomain
▪ Apex Trigger Callers
▪ Support for DML Free Testing
▪ Able to apply Object Orientated Programming

Apex Classes
Opportunities.cls
OpportunityLineItems.cls
Accounts.cls
Code Walkthrough : Domain Layer : Service Callers
Apex Service Callers

▪ Create Domain Instances
▪ Bulkified Calls
Apex Classes
OpportunitiesService.cls
Code Walkthrough : Domain : Extends vs Interfaces
Extending Apex Domain Classes
▪ Extend or adjust existing behavior of classes of a similar nature
• Base class Chargeable ensures cost is recalculated on insert and update
• DeveloperWorkItems Domain Class extends to provide its own calc logic

Implementing Apex Domain Interfaces
▪ Good for applying behavior to different types of classes
• Interface InvoiceService.ISupportInvoicing
• Implemented by Opportunities Domain Class
Code Walkthrough : Domain Class Extension
Chargeable Base Class
▪ Apply to Custom Objects recording Work
▪ Require hours and cost calculations
▪ Performs recalculation on insert and update
Pattern Checklist
Separation of Concerns
Service Layer
Domain Layer
Selector Layer

☑
☑
☑
☐
Introducing the Selector Layer
Introducing the Selector Layer
Naming Convention
▪ Plural object name suffixed by Selector
• e.g. OpportunitiesSelector
Introducing the Selector Layer
Clear Code Factoring
▪ Encapsulates Query Logic
Introducing the Selector Layer
Defined Responsibilities
▪ Consistency over queried fields
▪ Platform security best practice
▪ Encapsulates ALL query logic
Code Walkthrough : Selector Layer
Encapsulate Query Fields and Logic
▪ Base class fflib_SObjectSelector
▪ Defines Common Fields
▪ Default SOQL Helpers, FieldSet Support

Apex Classes
OpportunitiesSelector.cls
OpportunityLineItemsSelector.cls
ProductsSelector.cls
PricebooksSelector.cls
PricebookEntriesSelector.cls
Code Walkthrough : Selector Layer : Callers

Service Layer Logic : OpportunitiesSelector.selectByIdWithProducts

Apex Class
OpportunitiesService.cls

Domain Layer Logic : AccountsSelector.selectByOpportunity

Apex Class
Opportunities.cls
Code Walkthrough : Selector Layer : Callers
Batch Apex : OpportunitiesSelector.queryLocatorReadyToInvoice

Apex Class
CreatesInvoicesJob.cls
Pattern Checklist
Separation of Concerns
Service Layer
Domain Layer
Selector Layer

☑
☑
☑
☑
Summary
Summary
When is SOC / DRY appropriate (a rough guide)?
Solution / Code
Base Size

Developers

Requirements Scope

Number of Client Types
and Interactions

SOC/DRY
Appropriate?

Small

1 to 2

•

Well known and unlikely to
change
One off solutions
Limited number of objects

•
•
•
•
•

Standard UI
Simple VF / Triggers
No Batch Mode
No API
No Mobile

Typically not

Well known but may need to
evolve rapidly
Growing number objects and
processes interacting
Product deliverable or larger
duration projects

•
•
•
•
•

Standard UI
Advanced VF / JQuery
Batch Mode
API (on roadmap)
Mobile (on roadmap)

Worth
considering

Scope driven by multiple
customers and user types
Large number of objects
Generic product or solution
aimed at Mid to Enterprise
market with Customer or
Partner Integrations.
Growing development team!

•
•
•
•
•
•

Standard UI
Advanced VF / JQuery
Batch Mode
Developer / Partner API
Mobile Clients
New Platform Feature
Ready, Chatter Actions!

•
•
Small to Medium

1 to 6

•
•
•

Large

>6

•
•
•

•

Definite benifits
Other Design Patterns Helping with SOC/DRY
Alternative Domain Layer Patterns
▪ ‘Apex Trigger Pattern’ (Tony Scott)
• http://developer.force.com/cookbook/recipe/trigger-pattern-for-tidy-streamlined-bulkified-triggers

▪ ‘Salesforce Apex Wrapper Class’ (Mike Leach)
• http://www.embracingthecloud.com/2013/09/06/SalesforceApexWrapperClass.aspx

▪ ‘Trigger Architecture Framework’ (Hari Krishnan)
• http://krishhari.wordpress.com/category/technology/salesforce/apex-triggers/
Andrew Fawcett
CTO,
@andyinthecloud
Apex Enterprise Patterns: Building Strong Foundations

Mais conteúdo relacionado

Mais procurados

Oracle Core HR with Screen Shots
Oracle Core HR with Screen ShotsOracle Core HR with Screen Shots
Oracle Core HR with Screen Shotsrunjithrocking
 
Real Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsReal Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsSalesforce Developers
 
SOQL in salesforce || Salesforce Object Query Language || Salesforce
SOQL in salesforce || Salesforce Object Query Language || SalesforceSOQL in salesforce || Salesforce Object Query Language || Salesforce
SOQL in salesforce || Salesforce Object Query Language || SalesforceAmit Singh
 
Data Management and Migration in Salesforce
Data Management and Migration in SalesforceData Management and Migration in Salesforce
Data Management and Migration in SalesforceSunil kumar
 
Two-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsTwo-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsSalesforce Developers
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforceMark Adcock
 
Salesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewSalesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewDhanik Sahni
 
Salesforce Development Best Practices
Salesforce Development Best PracticesSalesforce Development Best Practices
Salesforce Development Best PracticesVivek Chawla
 
Automate All The Things with Flow
Automate All The Things with FlowAutomate All The Things with Flow
Automate All The Things with FlowSalesforce Admins
 
Salesforce Basic Development
Salesforce Basic DevelopmentSalesforce Basic Development
Salesforce Basic DevelopmentNaveen Dhanaraj
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patternsusolutions
 
Build Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable ApexBuild Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable ApexSalesforce Developers
 
SFDC Organization Setup
SFDC Organization SetupSFDC Organization Setup
SFDC Organization SetupSimeon Tzanev
 
Apex Trigger in Salesforce
Apex Trigger in SalesforceApex Trigger in Salesforce
Apex Trigger in SalesforceCloud Analogy
 
Salesforce Lightning Process builder
Salesforce Lightning Process builderSalesforce Lightning Process builder
Salesforce Lightning Process builderThinqloud
 

Mais procurados (20)

Oracle Core HR with Screen Shots
Oracle Core HR with Screen ShotsOracle Core HR with Screen Shots
Oracle Core HR with Screen Shots
 
Real Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsReal Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform Events
 
Introduction to Apex for Developers
Introduction to Apex for DevelopersIntroduction to Apex for Developers
Introduction to Apex for Developers
 
SOQL in salesforce || Salesforce Object Query Language || Salesforce
SOQL in salesforce || Salesforce Object Query Language || SalesforceSOQL in salesforce || Salesforce Object Query Language || Salesforce
SOQL in salesforce || Salesforce Object Query Language || Salesforce
 
Data Management and Migration in Salesforce
Data Management and Migration in SalesforceData Management and Migration in Salesforce
Data Management and Migration in Salesforce
 
Two-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsTwo-Way Integration with Writable External Objects
Two-Way Integration with Writable External Objects
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Salesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewSalesforce Integration Pattern Overview
Salesforce Integration Pattern Overview
 
SOQL & SOSL for Admins
SOQL & SOSL for AdminsSOQL & SOSL for Admins
SOQL & SOSL for Admins
 
Apex Design Patterns
Apex Design PatternsApex Design Patterns
Apex Design Patterns
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
Salesforce Development Best Practices
Salesforce Development Best PracticesSalesforce Development Best Practices
Salesforce Development Best Practices
 
Automate All The Things with Flow
Automate All The Things with FlowAutomate All The Things with Flow
Automate All The Things with Flow
 
Salesforce Basic Development
Salesforce Basic DevelopmentSalesforce Basic Development
Salesforce Basic Development
 
Salesforce Integration Patterns
Salesforce Integration PatternsSalesforce Integration Patterns
Salesforce Integration Patterns
 
Build Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable ApexBuild Reliable Asynchronous Code with Queueable Apex
Build Reliable Asynchronous Code with Queueable Apex
 
SFDC Organization Setup
SFDC Organization SetupSFDC Organization Setup
SFDC Organization Setup
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Apex Trigger in Salesforce
Apex Trigger in SalesforceApex Trigger in Salesforce
Apex Trigger in Salesforce
 
Salesforce Lightning Process builder
Salesforce Lightning Process builderSalesforce Lightning Process builder
Salesforce Lightning Process builder
 

Destaque

Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)Roy Gilad
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementSalesforce Developers
 
Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Mark Adcock
 
Advanced Apex Development - Asynchronous Processes
Advanced Apex Development - Asynchronous ProcessesAdvanced Apex Development - Asynchronous Processes
Advanced Apex Development - Asynchronous ProcessesSalesforce Developers
 
Salesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for DeploymentSalesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for DeploymentSalesforce Developers
 
Secure Development on the Salesforce Platform - Part I
Secure Development on the Salesforce Platform - Part ISecure Development on the Salesforce Platform - Part I
Secure Development on the Salesforce Platform - Part ISalesforce Developers
 
The Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development LifecycleThe Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development LifecycleJoshua Hoskins
 
Salesforce.com process map (from lead to opportunity)
Salesforce.com process map (from lead to opportunity)Salesforce.com process map (from lead to opportunity)
Salesforce.com process map (from lead to opportunity)Roger Borges Grilo
 
Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Salesforce Developers
 
Enterprise Architecture Salesforce
Enterprise Architecture SalesforceEnterprise Architecture Salesforce
Enterprise Architecture SalesforcePeter Doolan
 
Introduction to Campaigns in Salesforce - Create, Manage, Launch, and Measure
Introduction to Campaigns in Salesforce - Create, Manage, Launch, and MeasureIntroduction to Campaigns in Salesforce - Create, Manage, Launch, and Measure
Introduction to Campaigns in Salesforce - Create, Manage, Launch, and MeasureShell Black
 
Salesforce com-architecture
Salesforce com-architectureSalesforce com-architecture
Salesforce com-architecturedrewz lin
 
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 minsBuild Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 minsKashi Ahmed
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce PresentationChetna Purohit
 
Salesforce CRM 7 domains of Success
Salesforce CRM 7 domains of SuccessSalesforce CRM 7 domains of Success
Salesforce CRM 7 domains of SuccessKevin Sherman
 

Destaque (20)

Development lifecycle guide (part 1)
Development lifecycle guide (part 1)Development lifecycle guide (part 1)
Development lifecycle guide (part 1)
 
Apex collection patterns
Apex collection patternsApex collection patterns
Apex collection patterns
 
Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)Salesforce Coding techniques that keep your admins happy (DF13)
Salesforce Coding techniques that keep your admins happy (DF13)
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release Management
 
Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3
 
Advanced Apex Development - Asynchronous Processes
Advanced Apex Development - Asynchronous ProcessesAdvanced Apex Development - Asynchronous Processes
Advanced Apex Development - Asynchronous Processes
 
Salesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for DeploymentSalesforce Release Management - Best Practices and Tools for Deployment
Salesforce Release Management - Best Practices and Tools for Deployment
 
Secure Development on the Salesforce Platform - Part I
Secure Development on the Salesforce Platform - Part ISecure Development on the Salesforce Platform - Part I
Secure Development on the Salesforce Platform - Part I
 
The Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development LifecycleThe Ideal Salesforce Development Lifecycle
The Ideal Salesforce Development Lifecycle
 
Salesforce Data Structures
Salesforce Data StructuresSalesforce Data Structures
Salesforce Data Structures
 
Salesforce.com process map (from lead to opportunity)
Salesforce.com process map (from lead to opportunity)Salesforce.com process map (from lead to opportunity)
Salesforce.com process map (from lead to opportunity)
 
Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2Secure Development on the Salesforce Platform - Part 2
Secure Development on the Salesforce Platform - Part 2
 
Enterprise Architecture Salesforce
Enterprise Architecture SalesforceEnterprise Architecture Salesforce
Enterprise Architecture Salesforce
 
Introduction to Campaigns in Salesforce - Create, Manage, Launch, and Measure
Introduction to Campaigns in Salesforce - Create, Manage, Launch, and MeasureIntroduction to Campaigns in Salesforce - Create, Manage, Launch, and Measure
Introduction to Campaigns in Salesforce - Create, Manage, Launch, and Measure
 
Data model in salesforce
Data model in salesforceData model in salesforce
Data model in salesforce
 
Salesforce com-architecture
Salesforce com-architectureSalesforce com-architecture
Salesforce com-architecture
 
Top 10 Checklist For Successful Salesforce Implementation
Top 10 Checklist For Successful Salesforce ImplementationTop 10 Checklist For Successful Salesforce Implementation
Top 10 Checklist For Successful Salesforce Implementation
 
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 minsBuild Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce Presentation
 
Salesforce CRM 7 domains of Success
Salesforce CRM 7 domains of SuccessSalesforce CRM 7 domains of Success
Salesforce CRM 7 domains of Success
 

Semelhante a Apex Enterprise Patterns: Building Strong Foundations

Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationMark Gu
 
Evolutionary db development
Evolutionary db development Evolutionary db development
Evolutionary db development Open Party
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on RailsMark Menard
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2Hammad Rajjoub
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2Hammad Rajjoub
 
CQRS / ES & DDD Demystified
CQRS / ES & DDD DemystifiedCQRS / ES & DDD Demystified
CQRS / ES & DDD DemystifiedVic Metcalfe
 
Apex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and CanvasApex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and CanvasSalesforce Developers
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 
Hands-On Workshop: Introduction to Development on Force.com for Developers
Hands-On Workshop: Introduction to Development on Force.com for DevelopersHands-On Workshop: Introduction to Development on Force.com for Developers
Hands-On Workshop: Introduction to Development on Force.com for DevelopersSalesforce Developers
 
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Salesforce Developers
 
Summer '16 Realease notes
Summer '16 Realease notesSummer '16 Realease notes
Summer '16 Realease notesaggopal1011
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfoliocummings49
 
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...CodeMill digital skills
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseSpeedment, Inc.
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSpeedment, Inc.
 

Semelhante a Apex Enterprise Patterns: Building Strong Foundations (20)

Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 
Evolutionary db development
Evolutionary db development Evolutionary db development
Evolutionary db development
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
 
Intro to Ruby on Rails
Intro to Ruby on RailsIntro to Ruby on Rails
Intro to Ruby on Rails
 
Intro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUGIntro to ColdBox MVC at Japan CFUG
Intro to ColdBox MVC at Japan CFUG
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
 
Coding Naked 2023
Coding Naked 2023Coding Naked 2023
Coding Naked 2023
 
CQRS / ES & DDD Demystified
CQRS / ES & DDD DemystifiedCQRS / ES & DDD Demystified
CQRS / ES & DDD Demystified
 
Apex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and CanvasApex Code Analysis Using the Tooling API and Canvas
Apex Code Analysis Using the Tooling API and Canvas
 
Appengine Nljug
Appengine NljugAppengine Nljug
Appengine Nljug
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 
Hands-On Workshop: Introduction to Development on Force.com for Developers
Hands-On Workshop: Introduction to Development on Force.com for DevelopersHands-On Workshop: Introduction to Development on Force.com for Developers
Hands-On Workshop: Introduction to Development on Force.com for Developers
 
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
Hands-On Workshop: Introduction to Coding for on Force.com for Admins and Non...
 
Summer '16 Realease notes
Summer '16 Realease notesSummer '16 Realease notes
Summer '16 Realease notes
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
 
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
#CNX14 - Intro to Force
#CNX14 - Intro to Force#CNX14 - Intro to Force
#CNX14 - Intro to Force
 

Mais de Salesforce Developers

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base ComponentsSalesforce Developers
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsSalesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaSalesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentSalesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsSalesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsSalesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsSalesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and TestingSalesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilitySalesforce Developers
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce dataSalesforce Developers
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionSalesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPSalesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceSalesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureSalesforce Developers
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DXSalesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectSalesforce Developers
 

Mais de Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Apex Enterprise Patterns: Building Strong Foundations

  • 1. Building Strong Foundations Apex Enterprise Patterns Andrew Fawcett, FinancialForce.com, CTO @andyinthecloud
  • 2. All about FinancialForce.com Revolutionizing the Back Office #1 Accounting, Billing and PSA Apps on the Salesforce platform ▪ Native apps ▪ San Francisco HQ, 595 Market St ▪ R&D in San Francisco, Harrogate UK, and Granada ES ▪ We are hiring! Meet us at Rehab!
  • 3. What's wrong with this picture?
  • 4. What's wrong with this picture? public with sharing class MyController { public String theId; public MyController(ApexPages.StandardController standardController) { theId = (String) ApexPages.currentPage().getParameters().get('id'); } public PageReference actionCheckInvoices() { // Read the Account record Account accountRecord = [select Id, Name from Account where Id = :theId]; // Do some processing on the Account record ... then update it update accountRecord; return null; } } public with sharing class MyBatchJob implements Database.Batchable<SObject> { public void execute(Database.batchableContext info, List<Account> accounts) { for(Account account : accounts) { MyController myController = new MyController(new ApexPages.StandardController(account)); myController.actionCheckInvoices(); } } public Database.QueryLocator start(Database.BatchableContext info) { ... } public void finish(Database.batchableContext info) { ... } } Developer “A” writes an Apex Controller first Developer “B” writes an Apex Batch job later.
  • 5. So what was wrong with that picture? MyController MyController Issue Use of ApexPages.currentPage() Unnecessary and fragile, utilize instead stdController.getId() method Error handling No try/catch error handling on controller method Developer “A” MyBatchJob Issue Use of ApexPages.currentPage() Is not available in a Batch Apex context, the constructor code will give an exception. SOQL Query and DML Governors Calling the controller method in a loop will cause a SOQL query and DML governor issues. Error Handling No try/catch error handling in the the execute method Separation of Concerns Developer A did not originally develop the controller logic expecting or anticipating Developer B’s would in the future try to reuse it from a Batch Context as well. They did not consider correct Separation of Concerns… Developer “B”
  • 6. Pattern Checklist Separation of Concerns Service Layer Domain Layer Selector Layer ☐ ☐ ☐ ☐
  • 7. So what is “Separation of Concerns” then? “The goal is to design systems so that functions can be optimized independently of other functions, so that failure of one function does not cause other functions to fail, and in general to make it easier to understand, design and manage complex interdependent systems” Wikipedia, “Separation of Concerns”
  • 8. So what is “DRY” then? Don’t Repeat Yourself “Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.” Wikipedia, “Don’t repeat yourself (DRY)”
  • 9. Design Patterns for SOC & Force.com Best Practice Service Layer Domain Layer ▪ Yet another Wrapper / Trigger pattern! Selector Layer Reference Martin Fowler ▪ http://martinfowler.com/eaaCatalog/ ▪ Author of “Patterns of Enterprise Application Architecture” Reference ▪ http://wiki.developerforce.com/page/Apex_Enterprise_Patterns_-_Separation_of_Concerns
  • 10. Demo! “takeaway” a Sample Force.com Application! GitHub: financialforcedev/fflib-apex-common-samplecode
  • 11. Sample Application, what’s on the menu? Platform Feature Patterns Used Custom Buttons Building UI logic and calling Service Layer code from Controllers Batch Apex Reusing Service and Selector Layer code from with a Batch context Integration API Exposing an Integration API via Service Layer using Apex and REST Apex Triggers Factoring your Apex Trigger logic via the Domain Layer (wrappers) VisualForce Remoting Exposing Service Layer code to HTML5 / JavaScript libraries such as JQuery GitHub: financialforcedev/fflib-apex-common-samplecode
  • 12. Pattern Checklist Separation of Concerns Service Layer Domain Layer Selector Layer ☑ ☐ ☐ ☐
  • 14. Introducing the Service Layer Naming Convention ▪ Suffix with ‘Service’, e.g. OpportunitiesService ▪ Methods named by purpose not usage, e.g. applyDiscounts
  • 15. Introducing the Service Layer Clear Code Factoring ▪ Encapsulates Processes / Tasks ▪ Caller Context Agnostic
  • 16. Introducing the Service Layer Defined Responsibilities ▪ Supports Bulkifcation ▪ Transaction management
  • 17. Developing and calling a Service Layer public with sharing class AccountService { public static void checkOutstandingInvoices(Set<Id> accountIds) { // Read the Account records List<Account> accountRecords = [select Id, Name from Account where Id in :accountIds]; // Do some processing on the Account and Invoice records ... then update them. update accountRecords; } } Developer “A” follows Service Layer pattern. AccountService.cls Service Contract public PageReference actionCheckInvoices() { try { // Process the Account record AccountService.checkOutstandingInvoices(new Set<Id> { theId }); } catch (Exception e) { ApexPage.addMessages(e); } return null; } Developer “A” writes Controller code to consume the Service. MyController.cls public void execute(Database.batchableContext info, List<Account> accounts) { try { // Process Account records Set<Id> accountIds = new Map<Id, Account>(accounts).keySet(); AccountService.checkOutstandingInvoices(accountIds); } catch (Exception e) { emailError(e); } } MyBatch.cls Developer “B” then reuses the Developer “A” code safely.
  • 18. Code Walkthrough : Sample Services Managing DML and Transactions ▪ Unit of Work Pattern Classes OpportunitiesService.cls
  • 19. Code Walkthrough : Custom Buttons Custom Buttons ▪ Detail and List View ▪ Calling Visualforce Controller Code Visualforce Controllers and Pages ▪ Error Handling ▪ Interacts with Service Layer • Utilize bulkified methods • Assume transaction containment • Catch exceptions and display them on the page Classes and Pages OpportunityApplyDiscountController.cls • opportunityapplydiscount.page • opportunityapplydiscounts.page OpportunityCreateInvoiceController.cls • opportunitycreateinvoice.page • opportunitycreateinvoices.page
  • 20. CodeHandling Walkthrough : Batch Apex ▪ Error Classes ▪ Interacts with Service Layer CreatesInvoicesJob.cls • Utilize bulkified methods • Assume transaction containment • Catch exceptions and logs them for later notificaiton
  • 21. CodeHandling Walkthrough : Exposing an Integration API ▪ Error Classes • Pass business logic exceptions to caller to handle • Assume transaction containment OpportunitiesResource.cls OpportunitiesService.cls ▪ Exposing the API • To Apex Developers > Mark Service class and methods as global! – Package to apply Apex versioning of the API • To Web / Mobile Developers > Create RESTful API around Service layer
  • 22. Code Walkthrough : Visualforce Remoting An “Opportunities Discount Console” Classes OpportunityConsoleController.cls ▪ Developer uses a Rich HTML5 Client Library, such as JQuery • Is not using traditional Visualforce markup or action functions on the controller ▪ Utilizing static “remote” methods on the controller (stateless controller) • Able to consume the Service layer functions also! • Assumes transactional integrity • Assumes the caller (JavaScript client) to handle exceptions
  • 23. Pattern Checklist Separation of Concerns Service Layer Domain Layer Selector Layer ☑ ☑ ☐ ☐
  • 25. Introducing the Domain Layer Naming Convention ▪ Name uses plural name of object, e.g. Opportunities
  • 26. Introducing the Domain Layer Clear Code Factoring ▪ Encapsulates Validation / Defaulting of Fields ▪ Wraps Apex Trigger Logic in Apex Class (Trigger/Wrapper Pattern)
  • 27. Introducing the Domain Layer Defined Responsibilities ▪ Enforces Bulkifcation for logic ▪ Platform security best practice (honors Users profile) ▪ Encapsulates ALL logic / behavior for each object • e.g. onValidate, onBeforeInsert and applyDiscount
  • 28. Introducing the Domain Layer : Apex Trigger Flow
  • 29. Code Walkthrough : Domain Layer : Apex Triggers What no code?!? ☺ Triggers OpportunitiesTrigger.trigger OpportunityLineItemsTrigger.trigger
  • 30. Code Walkthrough : Domain Layer : Domain Classes Bulkified Wrappers ▪ Base class fflib_SObjectDomain ▪ Apex Trigger Callers ▪ Support for DML Free Testing ▪ Able to apply Object Orientated Programming Apex Classes Opportunities.cls OpportunityLineItems.cls Accounts.cls
  • 31. Code Walkthrough : Domain Layer : Service Callers Apex Service Callers ▪ Create Domain Instances ▪ Bulkified Calls Apex Classes OpportunitiesService.cls
  • 32. Code Walkthrough : Domain : Extends vs Interfaces Extending Apex Domain Classes ▪ Extend or adjust existing behavior of classes of a similar nature • Base class Chargeable ensures cost is recalculated on insert and update • DeveloperWorkItems Domain Class extends to provide its own calc logic Implementing Apex Domain Interfaces ▪ Good for applying behavior to different types of classes • Interface InvoiceService.ISupportInvoicing • Implemented by Opportunities Domain Class
  • 33. Code Walkthrough : Domain Class Extension Chargeable Base Class ▪ Apply to Custom Objects recording Work ▪ Require hours and cost calculations ▪ Performs recalculation on insert and update
  • 34. Pattern Checklist Separation of Concerns Service Layer Domain Layer Selector Layer ☑ ☑ ☑ ☐
  • 36. Introducing the Selector Layer Naming Convention ▪ Plural object name suffixed by Selector • e.g. OpportunitiesSelector
  • 37. Introducing the Selector Layer Clear Code Factoring ▪ Encapsulates Query Logic
  • 38. Introducing the Selector Layer Defined Responsibilities ▪ Consistency over queried fields ▪ Platform security best practice ▪ Encapsulates ALL query logic
  • 39. Code Walkthrough : Selector Layer Encapsulate Query Fields and Logic ▪ Base class fflib_SObjectSelector ▪ Defines Common Fields ▪ Default SOQL Helpers, FieldSet Support Apex Classes OpportunitiesSelector.cls OpportunityLineItemsSelector.cls ProductsSelector.cls PricebooksSelector.cls PricebookEntriesSelector.cls
  • 40. Code Walkthrough : Selector Layer : Callers Service Layer Logic : OpportunitiesSelector.selectByIdWithProducts Apex Class OpportunitiesService.cls Domain Layer Logic : AccountsSelector.selectByOpportunity Apex Class Opportunities.cls
  • 41. Code Walkthrough : Selector Layer : Callers Batch Apex : OpportunitiesSelector.queryLocatorReadyToInvoice Apex Class CreatesInvoicesJob.cls
  • 42. Pattern Checklist Separation of Concerns Service Layer Domain Layer Selector Layer ☑ ☑ ☑ ☑
  • 45. When is SOC / DRY appropriate (a rough guide)? Solution / Code Base Size Developers Requirements Scope Number of Client Types and Interactions SOC/DRY Appropriate? Small 1 to 2 • Well known and unlikely to change One off solutions Limited number of objects • • • • • Standard UI Simple VF / Triggers No Batch Mode No API No Mobile Typically not Well known but may need to evolve rapidly Growing number objects and processes interacting Product deliverable or larger duration projects • • • • • Standard UI Advanced VF / JQuery Batch Mode API (on roadmap) Mobile (on roadmap) Worth considering Scope driven by multiple customers and user types Large number of objects Generic product or solution aimed at Mid to Enterprise market with Customer or Partner Integrations. Growing development team! • • • • • • Standard UI Advanced VF / JQuery Batch Mode Developer / Partner API Mobile Clients New Platform Feature Ready, Chatter Actions! • • Small to Medium 1 to 6 • • • Large >6 • • • • Definite benifits
  • 46. Other Design Patterns Helping with SOC/DRY Alternative Domain Layer Patterns ▪ ‘Apex Trigger Pattern’ (Tony Scott) • http://developer.force.com/cookbook/recipe/trigger-pattern-for-tidy-streamlined-bulkified-triggers ▪ ‘Salesforce Apex Wrapper Class’ (Mike Leach) • http://www.embracingthecloud.com/2013/09/06/SalesforceApexWrapperClass.aspx ▪ ‘Trigger Architecture Framework’ (Hari Krishnan) • http://krishhari.wordpress.com/category/technology/salesforce/apex-triggers/