You are previewing Enterprise Architecture.
O'Reilly logo Enterprise Architecture

Book Description

Blend industry best practices to architect and deliver packaged applications that cater to enterprise business needs

In Detail

Successful enterprise applications require planning, commitment, and investment in understanding the best practices, processes, tools, 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. As your development team grows, managing the development cycle with more robust application life cycle tools and using approaches such as Continuous Integration becomes increasingly important. There are many ways to build solutions on—this book cuts a logical path through the steps and considerations for building packaged solutions from start to finish, covering 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 application.

What You Will Learn

  • Learn how to package, install, test, and upgrade an application, and understand how best to license and support an application
  • Define architecture-aligning data storage and functional requirements with the platform for a consistent and integrated user experience using the platform's declarative features
  • Develop Apex code that is easy to navigate, self-documenting, testable, robust, and organic leveraging the Separation of Concerns principle
  • Leverage your application's client-agnostic Service layer backbone to support numerous platform areas such as Batch, Scheduler, Visualforce, and the latest Salesforce1 client
  • Apply querying, indexing and asynchronous best practices, guidelines, and patterns for large data volumes and complex processes covering custom indexes and Batch Apex
  • Explore approaches and tips on how to develop advanced application life cycle processes around Source Control, Continuous Integration, and testing, utilizing the Metadata and Tooling APIs from Salesforce
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Enterprise Architecture
      1. Table of Contents
      2. Enterprise Architecture
      3. Credits
      4. Foreword
      5. About the Author
      6. Acknowledgments
      7. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
          3. Instant updates on new Packt books
      9. 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. Downloading the source code
            2. Deploying the source code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      10. 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 Apex and Visualforce
            2. Extension packages
        6. Introduction to AppExchange and listings
        7. Installing and testing your package
          1. Automating package installation
        8. Becoming a Salesforce partner and benefits
          1. Security review and benefits
        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
        13. Summary
      11. 2. Leveraging Platform Features
        1. Packaging and upgradable components
          1. Custom field – picklist values
          2. Automating upgrades with the Salesforce Metadata API
        2. Understanding the custom field features
          1. Default field values
          2. Encrypted fields
          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 when naming objects and fields
        5. Localization and translation
          1. Localization
          2. Translation
        6. Building customizable user interfaces
          1. Layouts
          2. Visualforce
        7. E-mail customization with e-mail templates
        8. Workflow and Flow
        9. Social features and mobile
        10. Summary
      12. 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. 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
      13. 4. Apex Execution and Separation of Concerns
        1. Execution contexts
          1. Exploring execution contexts
          2. Execution context and state
          3. Execution context and security
          4. Execution context transaction management
        2. Apex governors and namespaces
          1. The 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. 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 Apex Commons library
        6. Unit testing versus system testing
        7. The packaging code
        8. Summary
      14. 5. Application Service Layer
        1. Introducing the Service layer pattern
        2. Implementation of design guidelines
          1. Naming conventions
          2. Bulkification
          3. Defining and passing data
            1. Considerations when using SObjects in the Service layer interface
          4. Transaction management
          5. Compound services
          6. 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
      15. 6. Application Domain Layer
        1. Introducing the Domain layer pattern
          1. Encapsulating an object's behavior in code
          2. Interpreting the Domain layer in
          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
          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
            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
      16. 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 selectSObjectsById method
            1. Security
            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 sub-select
          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. Usage and reasons for the newInstance method
            2. Writing tests and the Selector layer
          2. Mocking Selectors
            1. Step 1 – using the Application.Selector.newInstance approach
            2. Step 2 – applying virtual and @TestVisible
            3. Step 3 – creating a mock Selector class
            4. Step 4 – writing a test with Application.Selector.setMock
            5. Which type of Selector methods cannot be mocked?
        7. Updating the FormulaForce package
        8. Summary
      17. 8. User Interface
        1. What devices should you target?
        2. Leveraging the Salesforce standard UI
          1. Overriding the standard Salesforce UI
          2. Hybrid standard and Visualforce UIs
          3. Custom Buttons and Related lists
          4. Rendering the standard UI within a Visualforce page
        3. Translation and localization
        4. Client communication layers
          1. Client communication options
          2. API governors and availability
          3. Database transaction scope and client calls
        5. Visualforce
          1. What can I do within a Visualforce page?
            1. Executing the code on page load with the action attribute
            2. Caching content with the cache and the expires attributes
            3. Creating a Download button with the contentType attribute
            4. Overriding the language of the page with the language attribute
            5. HTML5 and the docType attribute
            6. Offline Visualforce pages with the manifest attribute
            7. Generating PDF content with the renderAs attribute
            8. Visualforce SOQL, iterator limits, and the readOnly attribute
          2. Field-level security
          3. Page response time and components
            1. Demonstrating a large component tree
            2. Considerations for managing large component trees
          4. Client-managed state versus server-managed state
          5. Action methods versus JavaScript Remoting
            1. Mixing the use of action methods and JavaScript Remoting
          6. Applying JavaScript Remoting to the Service layer
            1. Considerations for client-side logic and Service layer logic
          7. When should I use JavaScript Remote Objects?
          8. Client-side alternatives to Visualforce UI components
            1. Salesforce Aura
        6. Custom Publisher Actions
        7. Creating websites
        8. Mobile strategy
        9. Custom Reporting and the Analytics API
        10. Updating the FormulaForce package
        11. Summary
      18. 9. 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. 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 REST application APIs
          5. Calling your REST application APIs
          6. Versioning REST APIs
            1. Is it worth versioning Apex REST APIs?
        4. Alignment with extensibility features
        5. Extending the application logic with Apex Interfaces
        6. Summary
      19. 10. 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
          2. Skinny tables
          3. Handling large result sets
            1. Processing 50k maximum results 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 the Salesforce APIs
        3. Asynchronous execution contexts
          1. General async design considerations
          2. Running Apex in the asynchronous mode
            1. @future
            2. Batch Apex
              1. Performance of Batch Apex jobs
              2. Using external references in Apex DML
        4. Volume testing
        5. Summary
      20. 11. Source Control and Continuous Integration
        1. Development workflow and infrastructure
          1. Packaging org versus sandbox versus developer org
            1. Creating and preparing your developer orgs
          2. 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
      21. Index