Skip to main content

Posts

Showing posts from June, 2013

Five things to do while writing an apex code to prevent pulling your hair out later.

A new intern joined the team excited to learn about Salesforce. She had a little Java background and thought that Salesforce was very easy compared to Java. In her eagerness, she wrote a 20 lines of code to prove her skills and grasp on Salesforce. The problem was, the code could be written in just 3 lines. When you are coding on Salesforce, you have to keep in mind the following things: i) If you can save some lines of code, save it, you can use those lines later.  If you can write a code in 5 lines, don't waste a 6th one. That one line you saved could be the difference between spending a weekend in office optimizing the code or going to a party at the weekend. ii) Write like the code will run forever. Yes, your Sales team has taken in writing that there will only be three records in the system. Yes, you have written a good code for that. But when you are dealing with Salesforce, remember that data is going to increase over a period of time. Today you may be processing