What is SFDX?
As a developer, you must have worked on building an application in a sandbox and it has passed through various test and UAT sandboxes before making its way to Production (WIN!).
In this traditional way of development, we consider org (sandbox OR production) as a source of truth. Regardless of what feature is been worked upon, everything goes into one package.xml. We can setup continuous integration using external SCM tools but that requires a significant amount of time, effort and expertise. Along with that, as you develop, you need to track down all the changes, so that right set of code gets push to production. If you use source control in this process, it reflects all such updates.
SFDX (Salesforce Developer Experience) introduces a new way of development, which has come up with many exciting features. It has improved development process and helps managing complex org with multiple teams.
Few highlights about SFDX:
1. With SFDX, we consider SCM as a source of truth. What does this mean? So instead of pushing an unrelated set of code from lower environment to production, let’s bundle a set of related code and push it using SCM.
2. It comes with improved version control system (VCM) synchronization through change-tracking.
3. Ability to create new scratch org by executing quick commands.
4. Deploy/retrieve metadata from SF org.
5. Ability to convert standard Salesforce development pattern to SFDX pattern.
SFDX comes with a VERY powerful tool – CLI. It has many commands available to improve development experience.
What is scratch org?
If you are a big team and sharing a common development environment, there is a high chance that things may mess up. Scratch org is dedicated, configurable and temporary org which can be set up in a just few minutes. It can be used for any purpose like development, testing, POC etc. A developer can create as many scratch orgs as he wants. It let you develop a defined set of code, so-called – Feature, in a dedicated environment. You can spin up new org quickly to test your feature in new org. If you have come across a concept of feature branch in SCM (Source Control Management), you can better relate what scratch org is meant for.
While scratch org is helping a lot in improving development experience, sandboxes still play a major role in entire development process. We still use them for full fledges UAT.
What’s new in the toolbox?
With SFDX generally available now, developers can make wonder by using a combination of tools.
1. SFDX CLI – It has many capabilities from various Salesforce APIs. In addition to this, it also has many exciting features which have been inherited from tools like migration tool,
workbench, data loader. Developers can use it to manage their Salesforce DX projects, create (development) scratch orgs, push and pull source and metadata to and from a scratch org, and run unit tests.
2. Salesforce extensions for VSCode – VSCode with Salesforce extension makes a makes a great development setup. It let you interact with various metadata type from Salesforce. Along with that, it has pre-integrated git, which tracks down all code updates been made as part of feature development. It also has interactive commands from CLI available in command pallets.
3. VCS (Version control system) – Considering the artifact-based model, VCS play a major role in maintaining a version of the source. With SFDX, your local project is tied to a local repository. You always have the liberty to tie your workspace with source control to maintain a version of source remotely.
Get above tools installed on your machine and get hands on. Finish at least following Trailhead modules to make yourself comfortable with a new weapon in your arsenal.