Dreamforce 2014 Notes: Writing Apex and Visualforce Using Re-usable Patterns

Sharing is Caring

Why use patterns:

  • patterns help us be more efficient
  • patterns describe reusable solutions to common problems

Bulk Processing

  • Caching
  • create triggers w/ ability to process hundreds of lookups
  • challenge: queries, DML, memory
  • collect all keys from trigger object in Set Object
  • Query once using SOQL in clause with key set
  • cache results in map object
  • look up related values using map key

Apex Summary Rollup

  • Need to roll up from a child to a parent in a lookup relationship
  • No declarative option for rolling up in a lookup relationship
  • Identify parent IDs affected by change in child.
  • perform an aggregate query on child records
  • update parents using IDs

Configuration Abstraction

  • Manage values that change from environment to environment
  • Maintainability
  • Ease of use


  • display records one page at a time
  • performance and maintainability
  • StandardSetController

Search And Sort

  • Allows users to apply search criteria and column sort
  • challenges: Performance and maintainability
  • reusuable Apex and component framework for Search and Sort
  • Dynamic SOQL to modify Where and Order by query clauses


Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.