How many ways are in salesforce through which I can write code in salesforce and deploy it ? As to my knowledge so far, there are two ways:

  1. Conventional way which is online through developer edition.

  2. Force.com IDE

Which one is the best and why ? Please suggest something.


One of the simplest way to deploy code from one environment to another is to use Change Sets. Few clicks and you're done.

Another way is to use ANT migration tool. In this you prepare package.xml file. In that you specify components which you need to deploy. Followed by some commands for retrieving them from source and then deploying it to target environment. Force.com IDE is used to retrieve Metadata.

Now coming to your question, which is best.

Above two methods have some pros and cons.

  1. Change Sets:

    pros: Can be used only within connected environments. e.g. Sandbox to sandbox, sandbox to production.

    cons: Time consuming, since you need to each component manually and it takes time.

  2. ANT:

    pros: Fast and efficient. Gives more control during deployment. Can edit metadata contents on fly. e.g. Sandbox to sandbox, sandbox to production, developer to production..

    cons: I haven't found any.

For ANT, you can refer these sample files needed for deployment using ANT


More to consider:

There is no single best - depends on your specific situation.


Primarily your question is opinion based.

But Best resource is online in trailhead module:

  1. Change Management
  2. Application Lifecycle Management

To summarize, ideally its always better to use any metadata tool instead of change sets. There are lots of advantages over it.

Adding the comparison from the module:enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.