Friday 10 May 2013


Introduction to Apex

Apex is a stored procedure-like language that runs entirely on the Force.com platform. It
provides object-oriented features and tight integration with the Force.com database. It’s
mainly used in custom user interfaces and in triggers, code that is executed when data is
changed in the database.
Apex is not a general-purpose programming language like Java or C. Its scope is limited
to business and consumer applications that operate on relational data and can benefit
from the feature set of the surrounding Force.com platform.
Apex programs exist in a multitenant environment.The computing infrastructure used
to execute Apex is operated by Salesforce and shared among many developers or tenants
of the system. As a result, unlike general-purpose programming languages you are familiar
with, the execution of Apex programs is closely controlled to maintain a consistently high
quality of service for all tenants.
This control is accomplished through governor limits, rules that Force.com places on
programs to keep them operating within their allotted share of system resources. Governor
limits are placed on database operations, memory and bandwidth usage, and lines of
code executed. Some governor limits vary based on the type of licensing agreement you
have in place with Salesforce or the context that the code is running in, and others are
fixed for all users and use cases.

Note

The most prevalent governor limits are discussed throughout this book, but it is not a complete
treatment of the subject. The authoritative guide to governor limits is the Force.com
Apex Code Developer’s Guide, available at http://developer.force.com. Educate yourself on
governor limits early in the development process. This education will alter the way you architect
your Apex code and prevent costly surprises. Additionally, test all of your Apex code with
production-like data volumes. This helps to expose governor-related issues prior to a production
deployment.
Here are a few important facts about Apex:
  •  It includes integrated testing features. Code coverage is monitored and must reach 75% or greater to be   deployed into a production environment.
  •  It is automatically upgraded. Salesforce executes all of its customers’ unit tests to verify that they pass before deploying a major release of the Force.com platform.Your code is always running on the latest version of Force.com and can take advantage of any and all new functionality without the hassle and risks of a traditional software upgrade process.
  •  There is no offline runtime environment for Force.com.You can edit your code on your desktop computer, but it must be sent to Force.com for execution.
  •  Apex is the only language that runs on the Force.com platform.You can integrate Apex with programs running outside of Force.com using HTTP-based techniques such as Web services.
  •  The Force.com database is the only database integrated into the Apex language. Other databases can be integrated through Web services or other technology using HTTP.


The two primary choices for developing Apex code are the Web-based App Builder Tools
and the Force.com IDE, provided as a standalone application as well as a plugin to the
standard Eclipse IDE.The Force.com IDE is the more powerful and developer-friendly of
the two, so it is used throughout this book.


No comments:

Post a Comment