Force.com Enterprise Architecture - Second Edition

Book description

Architect and deliver packaged Force.com applications that cater to enterprise business needs

About This Book

  • Explore the lightning framework, advanced application life cycle processes, and testing
  • Use the Force.com platform to build truly integrated, scalable, and robustly engineered applications focused on enterprise-level customer demands
  • Using the Lightning technology to deliver modern and responsive user experiences targeting multiple devices through Lightning Experience and Salesforce1 Mobile.
  • Step-by-step, work on examples to get you building your own ready-to-install packaged application

Who This Book Is For

This book is for advanced Force.com developers and architects who need to understand the Salesforce platform from the perspective of enterprise-level requirements. A prior understanding of Apex and Visualforce is a must. Those familiar with other enterprise software ecosystems will also find this book ideal as they adopt Force.com.

What You Will Learn

  • Package, install, test, and upgrade an application
  • Define architecture-aligning data storage and functional requirements
  • Develop Apex code that is easy to navigate, self-documenting, testable, robust, and organic
  • Leverage your application’s clientagnostic Service layer backbone to support numerous platform areas
  • Get the most from hosting your application within the Lightning Experience and Salesforce1 Mobile clients
  • Apply querying, indexing, and asynchronous best practices
  • Leverage mocking and dependency injection in your Apex tests
  • Explore tips for developing advanced applications

In Detail

Companies of all sizes have seen the need for Force.com's architectural strategy focused on enabling their business objectives. Successful enterprise applications require planning, commitment, and investment in the best tools, processes, and features available.

This book will teach you how to architect and support enduring applications for enterprise clients with Salesforce by exploring how to identify architecture needs and design solutions based on industry standard patterns. There are several ways to build solutions on Force.com, and this book will guide you through a logical path and show you the steps and considerations required to build packaged solutions from start to finish. It covers all aspects, from engineering to getting your application into the hands of your customers, and ensuring that they get the best value possible from your Force.com application. You will get acquainted with extending tools such as Lightning App Builder, Process Builder, and Flow with your own application logic. In addition to building your own application API, you will learn the techniques required to leverage the latest Lightning technologies on desktop and mobile platforms.

Style and approach

The book takes a straightforward approach, taking apart the Force.com architecture for you to gain a deep understanding of how you can implement the Salesforce platform based on enterprise-level requirements.

Table of contents

  1. Force.com Enterprise Architecture - Second Edition
    1. Table of Contents
    2. Force.com Enterprise Architecture - Second Edition
    3. Credits
    4. Foreword
    5. About the Author
    6. Acknowledgements
    7. About the Reviewers
    8. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
        2. Instant updates on new Packt books
    9. Customer Feedback
    10. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
          1. Deploying the source code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    11. 1. Building, Publishing, and Supporting Your Application
      1. Required organizations
      2. Introducing the book's sample application
      3. Package types and benefits
        1. Features and benefits of managed packages
      4. Creating your first managed package
        1. Setting your package namespace
        2. Creating the package and assigning it to the namespace
        3. Adding components to the package
        4. Extension packages
      5. Package dependencies and uploading
        1. Uploading the release and beta packages
        2. Optional package dependencies
          1. Dynamic bindings
          2. Extension packages
      6. Becoming a Salesforce partner and benefits
        1. Security review and benefits
        2. Getting the best out of the Partner Community
        3. Creating test and developer orgs via Environment Hub
      7. Introduction to AppExchange and listings
      8. Installing and testing your package
        1. Automating package installation
      9. Licensing
        1. The Licenses tab and managing customer licenses
        2. The Subscribers tab
        3. The Subscriber Overview page
        4. How licensing is enforced in the subscriber org
      10. Providing support
      11. Customer metrics
      12. Trialforce and Test Drive
        1. Distributing Salesforce Connected Apps
      13. Summary
    12. 2. Leveraging Platform Features
      1. Packaging and upgradable components
        1. Custom field – picklist values
        2. Global Picklists
        3. Automating upgrades with the Salesforce Metadata API
      2. Understanding the 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 OK platforms APIs
      5. Localization and translation
        1. Localization
        2. Translation
      6. Building customizable user interfaces
        1. Layouts
        2. Visualforce
        3. Lightning App Builder and Components
      7. E-mail customization with e-mail templates
      8. Process Builder, Workflow and Flow
      9. Social features and mobile
      10. Summary
    13. 3. 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
        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
      5. Options for replicating and archiving data
      6. External data sources
      7. Summary
    14. 4. 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
          1. Separation of concerns in Lightning Component JavaScript
        3. Execution context logic versus application logic concerns
        4. 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
    15. 5. 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. Updating the FormulaForce package
      8. Summary
    16. 6. Application Domain Layer
      1. Introducing the Domain layer pattern
        1. Encapsulating an object's behavior in code
        2. Interpreting the Domain layer in Force.com
        3. Domain classes in Apex compared to other platforms
      2. Implementation 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 Visualforce
            2. Generic Compliance Verification UI with a Lightning Component
          6. Summarizing compliance framework implementation
      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
    17. 7. Application Selector Layer
      1. Introducing the Selector layer pattern
      2. Implementing design guidelines
        1. Naming conventions
        2. Bulkification
        3. Record order consistency
        4. 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 security
            1. Default behavior
            2. Overriding the default behavior
          2. Ordering
          3. Field Sets
          4. Multi-Currency
      5. Implementing 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 data set
          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
    18. 8. User Interface
      1. Which devices should you target?
      2. Introducing Salesforce Standard UIs and Lightning
        1. Why consider Visualforce over the Lightning Framework?
      3. Leveraging the Salesforce standard UIs
        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. Visualforce Pages
          2. Lightning Components
      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 Visualforce
      9. Managing performance and response times
        1. Lightning tools to monitor size and response times
        2. Visualforce Viewstate size
        3. 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
    19. 9. Lightning
      1. Building a basic Lightning user interface
        1. Introduction to 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 Salesforce1
        2. Components
          1. Separation of concerns
          2. Encapsulation during development
            1. Component markup (.cmp)
            2. Component controller (…Controller.js)
            3. Component Helper (…Helper.js)
            4. Component CSS (.css)
            5. Component Render (…Renderer.js)
            6. Component Design (.design) and Component SVG (.svg)
            7. Component Documentation (.auradoc)
          3. Enforcing encapsulation and security at runtime
          4. Expressing behavior
            1. Access Control
            2. Methods, events and interfaces
        3. Platform namespaces
        4. Base components
        5. Data services
        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. Lightning Out and Visualforce
      7. Integrating with communities
      8. Testing
      9. Updating the FormulaForce package
      10. Summary
    20. 10. Providing Integration and Extensibility
      1. Reviewing your integration and extensibility needs
        1. Defining the Developer X persona
        2. Versioning
          1. Versioning the API definition
          2. Versioning application access through the Salesforce APIs
          3. Versioning the API functionality
        3. Translation and localization
        4. Terminology and platform alignment
        5. What are your application's integration needs?
          1. Developer X calling your APIs on-platform
          2. Developer X calling your APIs off-platform
            1. SOAP versus REST
        6. What are your applications extensibility needs?
      2. Force.com platform APIs for integration
      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 Lightning Components
      5. Extending Process Builder and Visualflow
        1. Versioning Invocable Methods
      6. Alignment with Force.com extensibility features
      7. Extending the application logic with Apex interfaces
      8. Summary
    21. 11. Asynchronous Processing and Big Data Volumes
      1. Creating test data for volume testing
        1. Using the Apex script to create the Race Data object
      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
      3. Skinny tables
        1. 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 the Apex read-only mode
            3. Processing unlimited result sets using Salesforce APIs
      4. Asynchronous execution contexts
        1. General async design considerations
        2. Running Apex in the asynchronous mode
          1. @future
          2. Queueables
          3. Batch Apex
            1. Performance of Batch Apex jobs
            2. Using external references in Apex DML
      5. Volume testing
      6. Summary
    22. 12. Unit Testing
      1. Comparing Unit testing and Integration Testing
        1. Introducing Unit Testing
      2. Dependency Injection, Mocking, and Unit Testing
        1. Deciding what to test 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 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. Summary
    23. 13. Source Control and Continuous Integration
      1. Development workflow and infrastructure
        1. Salesforce Developer Experience (DX)
        2. Packaging org versus sandbox versus developer org
          1. Creating and preparing your developer orgs
        3. The developer workflow
      2. Developing with Source Control
        1. Populating your Source Control repository
        2. The Ant build script to clean and build your application
          1. Developing in developer orgs versus packaging orgs
          2. Leveraging the Metadata API and Tooling APIs from Ant
        3. Updating your Source Control repository
          1. Browser-based development and Source Control
          2. Desktop-based development and Source Control
      3. Hooking up Continuous Integration
        1. The Continuous Integration process
        2. Updating the Ant build script for CI
        3. Installing, configuring, and testing the Jenkins CI server
          1. Exploring Jenkins and CI further
      4. Releasing from Source Control
      5. Automated regression testing
      6. Summary
    24. Index

Product information

  • Title: Force.com Enterprise Architecture - Second Edition
  • Author(s): Andrew Fawcett
  • Release date: March 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781786463685