Force.com Enterprise Architecture

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Andrew Fawcett
Edition: 2
Year: 0

Language: English
Pages: 505

Cover......Page 1
Copyright......Page 3
Credits......Page 4
Foreword......Page 6
About the Author......Page 8
Acknowledgements......Page 9
About the Reviewers......Page 10
www.PacktPub.com......Page 12
Customer Feedback......Page 13
Table of Contents......Page 14
Preface......Page 24
Chapter 1: Building, Publishing, and Supporting Your Application......Page 34
Required organizations......Page 35
Introducing the book's sample application......Page 37
Package types and benefits......Page 38
Features and benefits of managed packages......Page 39
Setting your package namespace......Page 40
Adding components to the package......Page 42
Extension packages......Page 43
Package dependencies and uploading......Page 44
Uploading the release and beta packages......Page 45
Extension packages......Page 47
Becoming a Salesforce partner and benefits......Page 48
Security review and benefits......Page 49
Getting the best out of the Partner Community......Page 50
Introduction to AppExchange and listings......Page 52
Installing and testing your package......Page 54
Automating package installation......Page 56
Licensing......Page 57
The Licenses tab and managing customer licenses......Page 60
The Subscribers tab......Page 61
The Subscriber Overview page......Page 62
Providing support......Page 63
Trialforce and Test Drive......Page 65
Distributing Salesforce Connected Apps......Page 66
Summary......Page 67
Chapter 2: Leveraging Platform Features......Page 68
Packaging and upgradable components......Page 69
Custom field – picklist values......Page 70
Automating upgrades with the Salesforce Metadata API......Page 71
Default field values......Page 72
Encrypted fields......Page 74
Special considerations for Platform Encryption......Page 75
Lookup options, filters, and layouts......Page 76
Rollup summaries and limits......Page 80
Understanding the available security features......Page 82
Functional security......Page 83
Your code and security review considerations......Page 86
Data security......Page 87
Your code and security review considerations......Page 89
Platform APIs......Page 90
Considerations for working well with OK platforms APIs......Page 92
Localization and translation......Page 93
Translation......Page 94
Building customizable user interfaces......Page 95
Layouts......Page 96
E-mail customization with e-mail templates......Page 97
Process Builder, Workflow and Flow......Page 98
Social features and mobile......Page 99
Summary......Page 104
Chapter 3: Application Storage......Page 106
Mapping out end user storage requirements......Page 107
Understanding the different storage types......Page 108
Columns versus rows......Page 109
Visualizing your object model......Page 111
Considerations for configuration data......Page 112
Record identification, uniqueness, and auto numbering......Page 119
Auto Number fields......Page 120
Record relationships......Page 124
Reusing the existing Standard Objects......Page 125
Importing and exporting data......Page 126
Options for replicating and archiving data......Page 129
External data sources......Page 130
Summary......Page 131
Chapter 4: Apex Execution and Separation of Concerns......Page 134
Exploring execution contexts......Page 135
Execution context and state......Page 137
Platform Cache......Page 138
Execution context and security......Page 140
Execution context transaction management......Page 141
Namespaces and governor scope......Page 142
Deterministic and non-deterministic governors......Page 145
Key governors for Apex package developers......Page 146
Where is Apex used?......Page 147
Apex code evolution......Page 150
Separating concerns in Apex......Page 151
Separation of concerns in Lightning Component JavaScript......Page 152
Execution context logic versus application logic concerns......Page 153
Improving incremental code reuse......Page 155
Patterns of Enterprise Application Architecture......Page 157
The Domain Model layer......Page 158
Introducing the FinancialForce.com Apex Commons library......Page 159
Unit testing versus system testing......Page 160
Packaging the code......Page 161
Summary......Page 162
Chapter 5: Application Service Layer......Page 164
Introducing the Service layer pattern......Page 165
Naming conventions......Page 167
Bulkification......Page 170
Sharing rules enforcement......Page 171
Defining and passing data......Page 173
Considerations when using SObject in the Service layer interface......Page 175
Compound services......Page 176
A quick guideline checklist......Page 178
Handling DML with the Unit Of
Work pattern......Page 179
Without a Unit Of Work......Page 181
With Unit Of Work......Page 183
The Unit Of Work scope......Page 186
Unit Of Work special considerations......Page 187
Services calling services......Page 188
Contract Driven Development......Page 192
Calling the Service layer......Page 198
Updating the FormulaForce package......Page 200
Summary......Page 201
Chapter 6: Application Domain Layer......Page 202
Introducing the Domain layer pattern......Page 203
Interpreting the Domain layer in Force.com......Page 204
Domain classes in Apex compared to other platforms......Page 205
Naming conventions......Page 206
Bulkification......Page 208
Domain class template......Page 209
Implementing Domain Trigger logic......Page 210
Routing trigger events to Domain class methods......Page 211
Default behavior......Page 213
Apex Trigger event handling......Page 214
Validation on insert......Page 215
Validation on update......Page 216
Implementing custom Domain logic......Page 217
Creating a compliance application framework......Page 218
An Apex interface example......Page 219
Step 5 – defining a generic service......Page 220
Step 6 – implementing the domain class interface......Page 221
Step 7 – the domain class factory pattern......Page 222
Step 8 – implementing a generic service......Page 223
Step 9 – using the generic service from a generic controller......Page 224
Summarizing compliance framework implementation......Page 229
Testing the Domain layer......Page 232
Test methods using DML and SOQL......Page 233
Test methods using the Domain class methods......Page 235
Calling the Domain layer......Page 236
Service layer interactions......Page 237
Domain layer interactions......Page 238
Updating the FormulaForce package......Page 240
Summary......Page 241
Chapter 7: Application Selector Layer......Page 244
Introducing the Selector layer pattern......Page 245
Implementing design guidelines......Page 246
Naming conventions......Page 247
Querying fields consistently......Page 248
The Selector class template......Page 250
Implementing the standard query logic......Page 252
Enforcing object and field security......Page 253
Ordering......Page 255
Field Sets......Page 256
Multi-Currency......Page 257
Implementing custom query logic......Page 258
A custom Selector method with subselect......Page 259
A custom Selector method with related fields......Page 261
A custom Selector method with a custom data set......Page 263
Combining Apex data types with SObject types......Page 266
SOSL and Aggregate SOQL queries......Page 267
Introducing the Selector factory......Page 268
SelectorFactory methods......Page 269
Updating the FormulaForce package......Page 270
Summary......Page 271
Chapter 8: User Interface......Page 272
Which devices should you target?......Page 273
Introducing Salesforce Standard UIs and Lightning......Page 274
Leveraging the Salesforce standard UIs......Page 276
Overriding standard Salesforce UI actions......Page 277
Embedding a custom UI in a standard UI......Page 278
Embedding a standard UI in a custom UI......Page 282
Visualforce Pages......Page 283
Generating downloadable content......Page 284
Generating printable content......Page 286
Overriding the page language......Page 287
Client communication options......Page 288
API governors and availability......Page 290
Offline support......Page 291
Managing limits......Page 292
Enforcing security in Visualforce......Page 293
Managing performance and response times......Page 298
Lightning tools to monitor size and response times......Page 299
Considerations for managing large component trees......Page 300
Using the Service layer and database access......Page 301
Considerations for client-side logic and Service layer logic......Page 302
When should I use JavaScript for database access?......Page 303
Considerations for using JavaScript libraries......Page 304
Custom Publisher Actions......Page 305
Mobile application strategy......Page 306
Updating the FormulaForce package......Page 307
Summary......Page 308
Chapter 9: Lightning......Page 310
Building a basic Lightning user interface......Page 311
Introduction to Lightning Design System......Page 312
Building your first component......Page 314
How does Lightning differ from other UI frameworks?......Page 315
Containers......Page 316
Introducing the Racing Overview Lightning app......Page 318
Components......Page 319
Encapsulation during development......Page 320
Expressing behavior......Page 326
Platform namespaces......Page 328
Base components......Page 329
Object-oriented programming......Page 330
FormulaForce Lightning Components......Page 331
RaceStandings component......Page 332
RaceCalendar component......Page 335
RaceResults component......Page 338
RaceSetup component......Page 340
Making components customizable......Page 342
Integrating with Lightning Experience......Page 343
Using Components on Lightning Pages and Tabs......Page 346
Integrating with communities......Page 347
Summary......Page 348
Chapter 10: Providing Integration
and Extensibility......Page 350
Defining the Developer X persona......Page 351
Versioning the API definition......Page 352
Versioning application access through the Salesforce APIs......Page 353
Translation and localization......Page 354
Terminology and platform alignment......Page 356
Developer X calling your APIs on-platform......Page 357
Developer X calling your APIs off-platform......Page 358
What are your applications extensibility needs?......Page 359
Force.com platform APIs for integration......Page 360
Providing Apex application APIs......Page 362
Calling an application API from Apex......Page 364
Versioning Apex API definitions......Page 366
Versioning Apex API behavior......Page 369
Providing RESTful application APIs......Page 370
Key aspects of being RESTful......Page 371
What are your application resources?......Page 372
Mapping HTTP methods......Page 373
Providing Apex REST application APIs......Page 374
Calling your Apex REST application APIs......Page 375
Definition versioning......Page 376
Extending Process Builder and Visualflow......Page 378
Versioning Invocable Methods......Page 380
Alignment with Force.com extensibility features......Page 381
Extending the application logic with Apex interfaces......Page 382
Summary......Page 386
Chapter 11: Asynchronous Processing and Big Data Volumes......Page 388
Creating test data for volume testing......Page 389
Using the Apex script to create the Race Data object......Page 390
Standard and custom indexes......Page 392
Ensuring queries leverage indexes......Page 394
Factors affecting the use of indexes......Page 395
Profiling queries......Page 396
Skinny tables......Page 403
Processing 50k maximum result sets in Apex......Page 404
Processing unlimited result sets in Apex......Page 405
Asynchronous execution contexts......Page 409
General async design considerations......Page 410
Running Apex in the asynchronous mode......Page 412
@future......Page 413
Queueables......Page 414
Batch Apex......Page 415
Volume testing......Page 419
Summary......Page 421
Chapter 12: Unit Testing......Page 422
Comparing Unit testing and Integration Testing......Page 423
Introducing Unit Testing......Page 425
Dependency Injection, Mocking, and Unit Testing......Page 427
Deciding what to test and what not to test for in a Unit test......Page 430
Constructor Dependency Injection......Page 432
Implementing Unit tests with CDI and Mocking......Page 433
Other Dependency Injection approaches......Page 437
Writing Unit Tests with the Apex Stub API......Page 439
Implementing Mock classes using Test.StubProvider......Page 440
Mocking Examples with the Apex Stub API......Page 441
Considerations when using the Apex Stub API......Page 444
Using Apex Stub API with Mocking Frameworks......Page 445
Understanding how ApexMocks works......Page 446
ApexMocks Matchers......Page 449
Unit Testing a Controller Method......Page 450
Unit Testing a Service Method......Page 451
Unit Testing a Domain method......Page 453
Summary......Page 454
Chapter 13: Source Control and Continuous Integration......Page 456
Salesforce Developer Experience (DX)......Page 457
Packaging org versus sandbox versus developer org......Page 458
Creating and preparing your developer orgs......Page 459
The developer workflow......Page 460
Developing with Source Control......Page 463
Populating your Source Control repository......Page 464
The Ant build script to clean and build your application......Page 469
Developing in developer orgs versus packaging orgs......Page 471
Leveraging the Metadata API and Tooling APIs from Ant......Page 472
Updating your Source Control repository......Page 474
Browser-based development and Source Control......Page 475
Desktop-based development and Source Control......Page 476
Hooking up Continuous Integration......Page 479
The Continuous Integration process......Page 480
Updating the Ant build script for CI......Page 481
Installing, configuring, and testing the Jenkins CI server......Page 482
Exploring Jenkins and CI further......Page 484
Releasing from Source Control......Page 486
Automated regression testing......Page 487
Summary......Page 488
Index......Page 490