March 22, 2010

Fast save and refresh on force.com Eclipse IDE

Force.com(Apex/Visualforce) developers spend lot of coding time waiting for file SAVE operation to finish. This is specially panic for developers working on huge force.com projects having many classes, pages, objects and components.

I recently figured out a way to boost-up the save and refresh(from server) speed on Force.com Eclipse IDE. The secret to go faster is to checkout only selective metadata components in a single force.com eclipse project. By default on creating a “New Force.com Project” in eclipse, “classes, triggers, pages, components, and static resources” are downloaded. I never need static resources locally in my eclipse workspace so why download them :-)

So the key is, if you know that you are only going to work with triggers then only checkout “triggers” while creating force.com project. This will reduce the time significantly to refresh the project and even SAVE will be faster too. I am not 100% sure why SAVE is faster, but it really seems to be with in fraction of seconds.

I will explain the approach to go faster with Force.com IDE for two kind of developers:

  1. Developers who works on SFDC “point and click” customization via SFDC Web interface and uses Force.com IDE to write Triggers and Apex Classes only.
  2. Hardcore Force.com Developers” who touch almost every piece for example they write triggers and work on Apex/Visualforce also.

Trigger developers (“Point and Click Type”)

As said earlier, these developers just use Force.com IDE to write triggers and classes and do most of the customization via force.com web interface. So we don’t need to checkout the default meta-data components i.e. “classes, triggers, pages, components, and static resources”. Instead we can limit to triggers and classes only. The way to do so is described using screen-shots below.

  1. Create a Force.com project as usual with required login details and project name etc. Hit “Next” button as usual when done.
  2. On the next screen instead of default selection “Apex and Visualforce(…)”, select second one i.e. “Selected metadata components” and hit “Choose” button next to it. image
  3. You will see a progress like this and let it complete. The IDE is preparing a list of metadata components.                          image
  4. In next view you will be presented a list of metadata components to select from. By default every thing comes unselected. Just select “classes” and “triggers” as shown below and hit “OK” button (red circles are indicating the selection):image
  5. That is all you need to do. You will get a new Force.com project with only two source components i.e. classes and triggers. The refresh and save should be relatively faster now as compared to the default force.com project settings. Enjoy !!!!image

Hardcore Force.com developers !!!

I said Hardcore because you are the ones who are doing more than just point and click customizations on force.com platform. You are the ones who create classes, visualforce pages/components and write complex triggers too. And work on big force.com projects having lot of these components.

Though there is not a big difference is approach, the only key is to create a TRIGGER+CLASS project as above. Plus, you need to create a similar PAGES+COMPONENTS Force.com project for all the UI stuff. Creating the PAGES+COMPONENTS project is pretty similar to what we did above, we only need to pick “Pages” and “Components” instead of “classes” and “triggers” in Step 4, please check the screenshot below

image

So when done you should see two projects as shown below. I created project’s Named as <Customer>  <Components> for ex. “Dell Classes + Triggers

Still if your project is huge, you are having lots of classes, pages and components in projects and you are always work on selected ones. I suggest selecting those as shown below.

In above screenshot I just selected the 5 classes I only work upon, though my Dell’s project has 100s of other classes. Similarly I can download selective pages and components. So in this kind of Force.com IDE setup, you will for sure see significant boost in “refresh from server” and “save” speeds.

The only issue with this approach comes, if you need to search some code references in all classes/pages/components/triggers, as we have downloaded even super selected metadata now, we might miss some of the classes/pages/components/triggers etc. The solution to this problem can be to checkout all components in one single project and use it for such searching reasons :)