You are previewing Mastering Application Development with
O'Reilly logo
Mastering Application Development with

Book Description

Design and develop state-of-the-art applications using's powerful development platform

About This Book

  • Flaunt your skillsets by developing complex applications that include demanding concepts such as triggers, Visualforce controllers, batch jobs, and Lightning components

  • Earn the gratitude of your colleagues by structuring a project so that multiple developers can work independently of each other

  • Kevin Poorman, the author of the book and a MVP, shares his years of knowledge and experience with you through the medium of telling examples

  • Who This Book Is For

    If you're a developer with a fundamental understanding of Apex and JavaScript but now want to enhance your skills with tips, tricks, and guidance on the best architectural and engineering practices, then this book is for you.

    What You Will Learn

  • Creating triggers, and the best practices for writing them

  • Developing a number of Visualforce controllers and extensions

  • Integrating third-party web APIs into your Apex code

  • Writing unit tests that cover testing bulk safety, user and profile settings, and negative tests

  • Creating a Lightning component for use in Salesforce1

  • Getting acquainted with various methods for deploying metadata between orgs

  • Using the Rest sObject API for access to Salesforce objects and data using the REST methodology

  • Learning about overarching architectural considerations such as naming conventions, testing practices, and data modeling practices

  • In Detail is an extremely powerful, scalable, and secure cloud platform, delivering a complete technology stack, ranging from databases and security to workflow and the user interface. With's cloud platform, you can build any business application and run it on your servers.

    The book will help you enhance your skillset and develop complex applications using It gets you started with a quick refresher of's development tools and methodologies, and moves to an in-depth discussion of triggers, bulkification, DML order of operations, and trigger frameworks. Next, you will learn to use batchable and schedulable interfaces to process massive amounts of information asynchronously. You will also be introduced to Salesforce Lightning and cover components—including backend (apex) controllers, frontend (JavaScript) controllers, events, and attributes—in detail.

    Moving on, the book will focus on testing various apex components: what to test, when to write the tests, and—most importantly—how to test. Next, you will develop a changeset and use it to migrate your code from one org to another, and learn what other tools are out there for deploying metadata. You will also use command-line tools to authenticate and access the Rest sObject API and the Bulk sObject API; additionally, you will write a custom Rest endpoint, and learn how to structure a project so that multiple developers can work independently of each other without causing metadata conflicts.

    Finally, you will take an in-depth look at the overarching best practices for architecture (structure) and engineering (code) applications on the platform.

    Style and approach

    A step-by-step tutorial, with plenty of tips and tricks that will help you develop complex applications.

    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 code file.

    Table of Contents

    1. Mastering Application Development with
      1. Table of Contents
      2. Mastering Application Development with
      3. Credits
      4. About the Author
      5. 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
      7. 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
          2. Errata
          3. Piracy
          4. Questions
      8. 1. A Conceptual Overview of Application Development on the Salesforce1 Platform
        1. Developing for the cloud
          1. Identifying the development tools
          2. Object-oriented building blocks of development
          3. Learning to master Salesforce1 development
        2. Using the Salesforce developer console
          1. Opening and creating metadata
          2. Running SOQL and SOSL queries
          3. Running unit tests
          4. Creating and opening Lightning Components
          5. Opening and reading debug logs and adjusting log levels
          6. An anonymous Apex execution
          7. Addressing problems
        3. Developer console exercises
        4. Summary
      9. 2. Architecting Sustainable Triggers Using a Trigger Framework
        1. An overview of triggers
          1. Context is king
          2. Trigger variables
          3. An example trigger
        2. Safety in numbers
        3. Infinite cosmic power, itty bitty safety rope
        4. The SFDC-trigger-framework
          1. A cautionary note
        5. Using the framework
        6. Summary
      10. 3. Asynchronous Apex for Fun and Profit
        1. Using batchable classes
          1. Additional extensions
        2. Schedulable classes
          1. Monitoring
          2. Scheduling from Apex
          3. Testing schedulable classes
        3. Exploring @future annotated methods
          1. When to use the @future annotation on methods
        4. Queueable classes
          1. Testing Queueable classes
        5. Knowing when to use what
        6. Summary
      11. 4. Lightning Concepts
        1. The Lightning Process Builder
          1. The @InvocableActions interface
          2. Other caveats
          3. Process Builder wrap up
        2. Lightning Connect
          1. Limitations
          2. Example use cases
        3. Lightning Components
          1. Component files
            1. @auraEnabled Apex
            2. Lightning future
        4. Lightning App Builder
        5. Summary
      12. 5. Writing Efficient and Useful Unit Tests
        1. Why do we write unit tests?
          1. Proving functionality
          2. Reducing the cost of change
          3. Encouraging modular, reusable code
          4. Identifying engineering bugs you didn't write
          5. Documenting expected behavior
          6. Tests + code = less likely to produce bugs
        2. What not to test?
          1. Managed package code
          2. Standard platform features
        3. When to write unit tests
        4. Structuring unit tests
          1. Using your own data
        5. Starting and stopping your tests
        6. Executing your code
          1. Positive tests
          2. Negative tests
          3. Permissions-based tests
        7. Assertions
          1. Creating your own assertion methods
        8. Mocking
        9. Tips and tricks for efficient testing
        10. Summary
      13. 6. Deploying Your Code
        1. What does it mean to deploy?
        2. The Ant migration toolkit
        3. Targets, macros, and built-ins
        4. Build properties
        5. Choosing metadata
          1. Alas, I have become destructiveChanges.xml, destroyer of orgs
          2. The IDE deployments
          3. Change is good
        6. Summary
      14. 7. Using, Extending, and Creating API Integrations
        1. In the beginning, we physically moved tapes around
          1. SOAP then REST – the evolution of modern APIs
          2. I oAuth, therefore I am
          3. Achievement unlocked – access token
            1. Putting it all together
          4. Bulk data for everyone! Look under your seat!
            1. All good things have their limits
            2. Use cases for the bulk API
        2. Creating your own API
          1. Let there be new records!
            1. Updating all that data
          2. Another one bites the dust
            1. The other way
          3. Heavy lifting
        3. Putting it all together
        4. Summary
      15. 8. Team Development with the Salesforce1 Platform
        1. But we've always done it that way!
        2. Exacerbating the issues
          1. Technology to the rescue – caveat audiens
            1. The moving parts
            2. A high-level narrative overview
            3. Making it all work
            4. Impressionism versus Cubism
            5. All for one, and one for all
        3. Summary
      16. 9. My Way – A Prescriptive Discussion of Application Development on Salesforce1
        1. Keep it simple
        2. Code reviews – pointed questions for Apex code review
        3. I've said it before, and I'll say it again—tests help you
        4. Make tools, and compose applications
        5. Work as a team
        6. Level up
        7. Model your data
        8. Using and abusing the platform – hic sunt dracones (here be dragons)
        9. Summary
        10. Where to go from here
          1. Podcasts
          2. Online help, training, and chat
      17. Index