0%

Book Description

A comprehensive guide filled with best practices and tailor-made examples - a must-read for all Lightning Platform architects!

Key Features

  • Use the Lightning Platform to build integrated, scalable, and robust apps focused on enterprise-level customer demands
  • Use the Lightning Component framework to deliver modern and responsive user experiences targeting multiple devices through Lightning Experience and Salesforce Mobile
  • Extend your application with access to external services and AI

Book Description

Salesforce Lightning provides a secure and scalable platform to build, deploy, customize, and upgrade applications. This book will take you through the architecture of building an application on the Lightning platform to help you understand its features and best practices, and ensure that your app keeps up with your customers' increasing needs as well as the innovations on the platform.

This book guides you in working with the popular aPaaS offering from Salesforce, the Lightning Platform. You'll see how to build and ship enterprise-grade apps that not only leverage the platform's many productivity features, but also prepare your app to harness its extensibility and customization capabilities. You'll even get to grips with advanced application architectural design patterns such as Separation of Concerns, Unit Testing and Dependency Integration. You will learn to use Apex and JavaScript with Lightning Web Components, Platform Events, among others, with the help of a sample app illustrating patterns that will ensure your own applications endure and evolve with the platform. Finally, you will become familiar with using Salesforce DX to develop, publish, and monitor a sample app and experience standard application life cycle processes along with tools such as Jenkins to implement CI/CD.

By the end of this book, you will have learned how to develop effective business apps and be ready to explore innovative ways to meet customer demands.

What you will learn

  • Create and deploy AppExchange packages and manage upgrades
  • Understand Enterprise Application Architecture patterns
  • Customize mobile and desktop user experience with Lightning Web Components
  • Manage large data volumes with asynchronous processing and big data strategies
  • Implement Source Control and Continuous Integration
  • Add AI to your application with Einstein
  • Use Lightning External Services to integrate external code and data with your Lightning Application

Who this book is for

This book is for Lightning platform developers who want to discover the true potential of the platform to develop complex scalable applications for use in enterprise businesses.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Salesforce Lightning Platform Enterprise Architecture Third Edition
  3. About Packt
    1. Why subscribe?
  4. Foreword
  5. Contributors
    1. About the author
    2. About the reviewers
    3. Searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Author disclosure
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    5. Get in touch
      1. Reviews
  7. Building and Publishing Your Application
    1. Introducing Salesforce DX
    2. Required organizations
    3. Introducing the book's sample application
    4. Package types and benefits
      1. The features and benefits of managed packages
    5. Creating your first managed package
      1. Setting and registering your package namespace
      2. Creating the package and assigning it to the namespace
      3. Adding components to the package
      4. Extension packages
    6. Package platform feature dependencies
      1. Release and beta packages
      2. Optional package dependencies
        1. Dynamic bindings
        2. Extension packages
    7. Supporting package upgradability
      1. Managing package ancestry
      2. Developing in scratch orgs containing ancestry information
    8. Becoming a Salesforce partner and the benefits of doing so
      1. Security review and benefits
      2. Getting the best out of the Partner Community
      3. Creating test and demo orgs via the Environment Hub
    9. Introduction to AppExchange and listings
    10. Installing and testing your package
      1. Automating package installation
    11. Understanding how to license your package
      1. The Licenses tab and managing customer licenses
      2. The Feature Parameters tab and managing features
      3. The Subscribers tab
      4. The Subscriber Overview page
      5. How licensing is enforced in the subscriber org
    12. Providing support
    13. Customer metrics
    14. Trialforce and Test Drive
      1. Distributing Salesforce Connected Apps
    15. Summary
  8. Leveraging Platform Features
    1. Packaging and upgradable components
      1. Custom Fields – picklist values
      2. Global picklists
      3. Automating upgrade tasks with the Metadata API
    2. Understanding Custom Field features
      1. Default field values
      2. Encrypted fields
        1. Special considerations for Platform Encryption
      3. Lookup options, filters, and layouts
      4. Rollup summaries and limits
    3. Understanding the available security features
      1. Functional security
        1. Your code and security review considerations
      2. Data security
        1. Your code and security review considerations
    4. Platform APIs
      1. Considerations for working well with the platform's APIs
    5. Localization and translation
      1. Localization
      2. Translation
    6. Building customizable user interfaces
      1. Layouts
      2. Customizing Lightning Components and Visualforce pages 
      3. Lightning App Builder and Components
    7. Email customization with email templates
    8. Process Builder, Workflow, and Flow
    9. Social features and mobile
    10. Creating and testing a new package version
    11. Summary
  9. Application Storage
    1. Mapping out end user storage requirements
    2. Understanding the different storage types
      1. Data storage
        1. Columns versus rows
        2. Visualizing your object model
        3. Considerations for configuration data
          1. Custom Metadata Type storage
          2. Custom Settings storage
          3. Big Objects storage
      2. File storage
      3. Record identification, uniqueness, and auto numbering
        1. Unique and external ID fields
        2. Auto Number fields
          1. Subscribers customizing the Auto Number Display Format
      4. Record relationships
    3. Reusing the existing Standard Objects
    4. Importing and exporting data
      1. Salesforce DX CLI Data Import and Export
      2. Salesforce Data Import Wizard
    5. Options for replicating data
    6. External data sources
    7. Creating a new FormulaForce package version
    8. Summary
  10. Apex Execution and Separation of Concerns
    1. Execution contexts
      1. Exploring execution contexts
      2. Execution context and state
        1. Platform Cache
      3. Execution context and security
      4. Execution context transaction management
    2. Apex governors and namespaces
      1. Namespaces and governor scope
      2. Deterministic and non-deterministic governors
      3. Key governors for Apex package developers
    3. Where is Apex used?
    4. Separation of concerns
      1. Apex code evolution
      2. Separating concerns in Apex
      3. Separation of concerns in Lightning Components
        1. Separation of concerns in an LWC
        2. Separation of concerns in a Lightning Aura Component
      4. Execution context logic versus application logic concerns
      5. Improving incremental code reuse
    5. Patterns of Enterprise Application Architecture
      1. The Service layer
      2. The domain model layer
      3. The Data Mapper (selector) layer
        1. Introducing the FinancialForce.com Apex Commons library
    6. Unit testing versus system testing
    7. Packaging the code
    8. Summary
  11. Application Service Layer
    1. Introducing the Service layer pattern
    2. Implementation of design guidelines
      1. Naming conventions
      2. Bulkification
      3. Sharing rules enforcement
      4. Defining and passing data
        1. Considerations when using SObject in the Service layer interface
      5. Transaction management
      6. Compound services
      7. A quick guideline checklist
    3. Handling DML with the Unit Of Work pattern
      1. Without a Unit Of Work
      2. With Unit Of Work
      3. The Unit Of Work scope
      4. Unit Of Work special considerations
    4. Services calling services
    5. Contract-Driven Development
    6. Testing the Service layer
      1. Mocking the Service layer
    7. Calling the Service layer
      1. From Lightning Component Apex Controllers
      2. From Visualforce Apex Controllers
      3. From the Apex Scheduler
      4. Updating the FormulaForce package
    8. Summary
  12. Application Domain Layer
    1. Introducing the Domain layer pattern
      1. Encapsulating an object's behavior in code
      2. Interpreting the Domain layer
      3. Domain classes in Apex compared to other platforms
    2. Implementing design guidelines
      1. Naming conventions
      2. Bulkification
      3. Defining and passing data
      4. Transaction management
    3. Domain class template
    4. Implementing Domain Trigger logic
      1. Routing trigger events to Domain class methods
      2. Enforcing object security
        1. Default behavior
        2. Overriding the default behavior
      3. Apex Trigger event handling
        1. Defaulting field values on insert
        2. Validation on insert
        3. Validation on update
    5. Implementing custom Domain logic
    6. Object-oriented programming
      1. Creating a compliance application framework
      2. An Apex Interface example
        1. Step 5 – Defining a generic service
        2. Step 6 – Implementing the Domain class interface
        3. Step 7 – The Domain class Factory pattern
        4. Step 8 – Implementing a generic service
        5. Step 9 – Using the generic service from a generic controller
          1. Generic Compliance Verification UI with a Lightning Component
          2. Generic Compliance Verification UI with Visualforce
        6. Summarizing the implementation of the compliance framework
    7. Testing the Domain layer
      1. Unit testing
      2. Test methods using DML and SOQL
      3. Test methods using the Domain class methods
    8. Calling the Domain layer
      1. Service layer interactions
      2. Domain layer interactions
    9. Updating the FormulaForce package
    10. Summary
  13. Application Selector Layer
    1. Introducing the Selector layer pattern
    2. Implementing design guidelines
      1. Sharing conventions
      2. Naming conventions
      3. Bulkification
      4. Record order consistency
      5. Querying fields consistently
    3. The Selector class template
    4. Implementing the standard query logic
      1. Standard features of the Selector base class
        1. Enforcing object and field-level security
          1. Default behavior
          2. Overriding the default behavior
        2. Ordering
        3. Field Sets
        4. Multi-Currency
    5. Implementing the custom query logic
      1. A basic custom Selector method
      2. A custom Selector method with subselect
      3. A custom Selector method with related fields
      4. A custom Selector method with a custom dataset
        1. Combining Apex data types with SObject types
      5. SOSL and aggregate SOQL queries
    6. Introducing the Selector factory
      1. SelectorFactory methods
        1. Writing tests and the Selector layer
    7. Updating the FormulaForce package
    8. Summary
  14. Building User Interfaces
    1. What devices should you target?
    2. Leveraging standard UIs and custom UIs
      1. Why consider Visualforce over Lightning Framework?
      2. Lightning Component programming frameworks
    3. Leveraging the Salesforce standard UIs and tools
      1. Overriding standard Salesforce UI actions
      2. Combining standard UIs with custom UIs
        1. Embedding a custom UI in a standard UI
        2. Embedding a standard UI in a custom UI
      3. Extending the Salesforce standard UIs
        1. Lightning Components
        2. Visualforce pages
    4. Generating downloadable content
    5. Generating printable content
      1. Overriding the page language
    6. Client-server communication
      1. Client communication options
      2. API governors and availability
      3. Database transaction scope and client calls
      4. Offline support
    7. Managing limits
    8. Object- and field-level security
      1. Enforcing security in Lightning Web Components
      2. Enforcing security in Visualforce
    9. Managing performance and response times
      1. Lightning Tools to monitor size and response times
      2. Lightning Tools to monitor locker service performance
      3. Visualforce view state size
      4. Considerations for managing large component trees
    10. Using the Service layer and database access
      1. Considerations for client-side logic and Service layer logic
      2. When should I use JavaScript for database access?
    11. Considerations for using JavaScript libraries
    12. Custom Publisher Actions
    13. Creating websites and communities
    14. Mobile application strategy
    15. Custom reporting and the Analytics API
    16. Updating the FormulaForce package
    17. Summary
  15. User Interfaces with Lightning Framework
    1. Building a basic Lightning UI
      1. Introduction to the Lightning Design System
      2. Building your first component
      3. How does Lightning differ from other UI frameworks?
    2. Lightning architecture
      1. Containers
        1. Introducing the Racing Overview Lightning app
        2. Lightning Experience and Salesforce Mobile
      2. Components
        1. Separation of concerns
        2. Encapsulation during development
          1. Component markup (.html)
          2. Component controller (.js)
          3. Component CSS (.css)
          4. Component metadata (.js-meta.xml) and component SVG (.svg) files
          5. Component documentation (.auradoc)
          6. Component tests (test subfolder)
          7. Sharing JavaScript Code between components
        3. Enforcing encapsulation and security at runtime
        4. Expressing behavior
          1. Access control
          2. Methods
          3. Child component events
          4. Inter-component events
      3. Platform namespaces
      4. Base components
      5. Data Service
      6. Object-oriented programming
      7. Object-level and field-level security
    3. FormulaForce Lightning components
      1. RaceStandings component
      2. RaceCalendar component
      3. RaceResults component
      4. RaceSetup component
    4. Making components customizable
    5. Integrating with Lightning Experience
      1. Using components on Lightning pages and tabs
    6. Integrating with Lightning Flow
    7. Integrating with Lightning Communities
    8. Exposing components with Lightning Out
    9. Updating the FormulaForce package
    10. Summary
  16. Providing Integration and Extensibility
    1. Reviewing your integration and extensibility needs
      1. Defining the Developer X persona
      2. Understanding and managing versioning
        1. Versioning the API definition
        2. Versioning the API definition of the Salesforce APIs
        3. Versioning the API functionality
      3. Translation and localization
      4. Terminology and platform alignment
      5. What are your integration use cases?
        1. Developer X calling your APIs on-platform
        2. Developer X calling your APIs off-platform
          1. SOAP versus REST
          2. The OpenAPI Specification and Swagger
        3. Developer X calling your APIs asynchronously through platform events
      6. What are your application's extensibility use cases?
    2. Standard platform APIs for integration
      1. Apex Callable interface API
    3. Application integration APIs
      1. Providing Apex application APIs
        1. Calling an application API from Apex
        2. Modifying and depreciating the application API
        3. Versioning Apex API definitions
        4. Versioning Apex API behavior
      2. Providing RESTful application APIs
      3. Key aspects of being RESTful
        1. What are your application resources?
        2. Mapping HTTP methods
      4. Providing Apex REST application APIs
      5. Calling your Apex REST application APIs
      6. Versioning Apex REST application APIs
        1. Behavior versioning
        2. Definition versioning
    4. Exposing platform events
    5. Exposing Lightning Components
    6. Extending Process Builder and Flow
      1. Versioning invocable methods
    7. Alignment with platform extensibility features
    8. Extending application logic with Apex interfaces
    9. The MuleSoft platform
    10. Summary
  17. Asynchronous Processing and Big Data Volumes
    1. Creating a RaceData object with data
      1. Using Apex to generate synthetic Race Data
    2. Indexes, being selective, and query optimization
      1. Standard and custom indexes
        1. Ensuring queries leverage indexes
        2. Factors affecting the use of indexes
        3. Profiling queries
      2. Skinny tables
      3. Handling large result sets
        1. Processing 50k maximum result sets in Apex
        2. Processing unlimited result sets in Apex
          1. Generating more Race Data
          2. Leveraging Visualforce and Apex read-only mode
        3. Processing unlimited result sets using the Salesforce APIs
    3. Handling billions of records with big objects
      1. Salesforce and NoSQL stores
      2. Using a big object for race lap history
      3. Importing big object data
        1. Using Data Loader to import data into a big object
      4. Options to query big object data
        1. Synchronous big object SOQL queries
        2. Asynchronous big object SOQL queries
    4. Asynchronous processing
      1. Asynchronous user experience design considerations
      2. Asynchronous processing with workers and jobs
        1. Implementing a worker with @future
        2. Implementing a worker with Queueables
        3. Implementing a job with Batch Apex
          1. Performance of Batch Apex jobs
          2. Using external references in Apex DML
      3. Asynchronous processing with platform events
        1. Using high-scale platform events to stream data ingestion
        2. Using Change Data Capture platform events to compute data
        3. Sending race data telemetry events through the Salesforce DX CLI
    5. Volume testing
    6. Summary
  18. Unit Testing
    1. Comparing unit testing and integration testing
      1. The testing pyramid on the Lightning Platform
      2. Introducing unit testing
    2. Introduction to unit testing with Apex
      1. Deciding what to test for and what not to test for in a unit test
      2. Constructor dependency injection
      3. Implementing unit tests with CDI and mocking
      4. Other dependency injection approaches
      5. Benefits of dependency injection frameworks
    3. Writing unit tests with the Apex Stub API
      1. Implementing mock classes using Test.StubProvider
      2. Creating dynamic stubs for mocking classes
      3. Mocking examples with the Apex Stub API
      4. Considerations when using the Apex Stub API
      5. Using the Apex Stub API with mocking frameworks
        1. Understanding how ApexMocks works
        2. ApexMocks Matchers
    4. ApexMocks and Apex Enterprise Patterns
      1. Unit testing a controller method
      2. Unit testing a Service method
      3. Unit testing a Domain method
      4. Unit testing a Selector method
    5. Unit testing with Lightning Web Components
      1. Introduction to unit testing with Lightning Web Components
        1. Validating that the driver list is correctly bound to the table
        2. Validating that the selected drivers are sent to the server
    6. Summary
  19. Source Control and Continuous Integration
    1. Development workflow and infrastructure
      1. Creating and preparing your scratch orgs
      2. Understanding the developer workflow
    2. Developing with source control
      1. Populating your source control repository
      2. Deploying the code from source control
        1. Developing in scratch orgs with a namespace
        2. Leveraging the Salesforce REST APIs from the SFDX CLI and custom plugins
      3. Updating your source control repository
        1. Controlling what gets pulled down locally from your org
        2. Managing local files and committing to source control
    3. Hooking up continuous integration
      1. Using continuous integration to maintain code health
      2. Introducing the Jenkinsfile for CI
        1. Installing, configuring, and testing a Jenkins CI server
        2. Exploring Jenkins and CI further
    4. Releasing from source control
    5. Automated regression testing
    6. Summary
  20. Integrating with External Services
    1. Understanding inbound and outbound integrations
    2. Managing inbound integrations
      1. Introducing Salesforce Connected Apps
        1. Node.js application using a Connected App
    3. Understanding options for outbound integrations
      1. Managing outbound connections with Named Credentials
        1. Calling outbound connections from Apex
        2. Using per-user Named Credentials
      2. Accessing external services via External Services
      3. Accessing external data seamlessly via External Objects
    4. Summary
  21. Adding AI with Einstein
    1. Understanding Salesforce Einstein services and products
    2. Understanding Einstein Prediction Builder
    3. Understanding Einstein Discovery
      1. Discovering insights from Formula 1 race results
    4. Understanding Einstein Platform Services
    5. Summary
    6. Further reading
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.118.0.240