Salesforce <PAD>


An Apex microframework

PAD stands for "Parallel Apex Development". The historical intend was to avoid conflicts when developing concurrently in a team on the same org. A "bypass" mechanism has been implemented to avoid running a code that is under construction by another developer. The benefit has been extended to manage governor limits and performance.
A typical use case is for integration : code behavior should be different than for an end user. Sometimes, an administrator should also bypass some restrictions that have been set up in the configuration or in the code. To make this possible, we define at the user level, through 3 custom fields, the bypass capability. With 1 checkbox we can enable or disable Validation Rules for that user. With another checkbox we will enable Workflow Rules (and Process Builder).
All validation rules require just a complementary test: "$User.BypassVR__c = false && ....". It couldn't be more easy (assumption : checkbox API name is BypassVR__c). Same principle for workflows.

How could it be done for Apex code? The logic needs to be refined; we cannot avoid all code, sometimes we have some parts that are mandatory for all. That's why we will use a multi-picklist. Each value will match a code logic. We will do the tests from within triggers. Example: "if(PAD.canTrigger('AP01')){..." where AP01 is a reference for a business logic. That's it, very simple.
PAD framework is very lightweight and offers other features; capability to bypass temporarily all the logic, capability to run part of the code only once (useful when you have multiple update triggers), capability to benchmark duration in Visualforce pages and to display limits, retrieve in one go various user information...

A design methodology

PAD is a way to improve productivity and efficiency too. It is matching Project Managers needs to grow/shrink the team, reduce ramp up duration, have efficient documentation. It allows consultants to start in short term on a new or existing project. It allows customers to manage handover through a standard way to design and build.
PAD Design framework allows to increase productivity and quality of Salesforce projects, and reduce costs (reducing duration).

If you are interested in using PAD, getting the design template, the Apex class and Visualforce component, just send an email to "pad at" with the keyword PAD in the subject or the body of the email. An automated reply will send you a zip file with the latest version of the files and all the documentation.

You can find another related blog with some examples here.