Apex vs. C#

Apex vs .NET C#

Apex is the programming language in Force.com and is an object oriented language (similar to C# or Java).

 apex_example

Unlike .NET, where you would develop & test C# code on local IIS installations, all Force.com development – compiling, debugging and unit testing – is done on the App cloud.

 cloud_development

Just like C# – or any other OOP – your apex code will consist of classes and interface, primitive data types (e.g. Boolean, Date), flow logic (e.g. if/else, for loop), exception handling and collections (e.g. list, map).

All your apex code will be saved either as a trigger or a class.

How is Apex different from C# ?

The big difference between Apex and other OOP languages is that you don’t need to start with a thick book. With Apex, just get to know the basics in a couple of hours – and then for your use-case Google to find sample code you can use after a bit of modification. Apart from Github and StackExchange, you can find a tonne of sample code on AppExchange from the free Salesforce Labs apps.

Here are some technical differences between Apex and other OOP languages: In contrast to the traditional OOP languages, Apex is not case sensitive, uses single quotes (e.g. ‘Maria’) and – has a special data type to serve as a unique identifier for records, objects, Orgs (Id).

Most importantly, Apex has built in support for data access so you don’t have to write ADO.Net code (or JDBC prepared statements). And this tight coupling with data also ensures that Force.com platform will not let you accidentally compile code if the underlying objects do not support it – nor let you modify or delete the objects if code depends on it. All this eliminates run-time errors and dramatically speeeds up development.