Yet Another Language: Apex

By Jeff Cogswell  |  Posted 2010-02-03 Print this article Print

Yet Another Language: Apex

Development for requires programmers to use a new language called Apex, which runs on top of the Apex framework. The Apex framework is fundamental to the servers and is not new to's been part of for several years. At first, I was a little concerned when I heard that the development would require the use of a new language. Fortunately, the language has traditional C-style syntax and looks very similar to Java and C#, so I felt quite at home using it.

However, Apex does differ from C# and Java in certain respects, as conceptually it behaves similar to a database language, such as T-SQL or PL/SQL. Apex includes database constructs such as data select statements, transaction support and triggers. Salesforce has done a beautiful job of integrating data access right into the language, which is something I've longed for more than once in my programming career. Take a look at the Apex developer site for more information.

Because Apex code runs on multitenant servers that are in the cloud, it's vital that the code doesn't get out of control, thereby hogging resources and causing other problems on the platform. With that in mind, the Apex language was built to be monitored by what Salesforce calls a "governor." If you're familiar with .NET managed code or the Java run-time, think of either of those on steroids. The governor carefully manages and monitors the running code-not just its data aspects, but all aspects, including loops and other control structures, to keep it within isolated boundaries. The documentation refers to Apex as a "virtual, virtual machine," which seems fitting.

Other Features

The Eclipse plug-in is certainly full-featured. One particularly cool feature is for running "anonymous" code right on the remote server, on the fly. Most developers have probably done this kind of thing before in other languages (albeit in a locally run debugger) when the developer inspects an object, calls a member function right in the inspector, and watches the code run right then and there. Similarly, with the "Execute Anonymous" pane that the plug-in provides for Eclipse, I could execute code on the fly on the server and see the results right in a Results text box.

The Apex language includes support for unit testing, and the Eclipse plug-in supports this as well. By creating unit tests right in my classes, I could easily test out my classes on the remote server from within Eclipse. Another interesting feature is the Schema Explorer, which allows developers to browse and inspect their database model on the server, graphically, right from within Eclipse.

The development site is huge, and the Eclipse plug-in is only one small piece of it. For those who aren't keen on writing code, the site makes available various designers that can be used to piece together an entire application right on the Website. The resulting application will run on the cloud as a set of Web pages. There are other design tools available for building applications that run inside Adobe Flash or Adobe Air run-times.

What's more, applications can be readily integrated with other cloud services providers, including Amazon's Web Services, Google's App Engine and Facebook. There are tool kits that work together with Java, as well as .NET. And there are plenty of developer-contributed libraries (such as AJAX support), as well as stand-alone tools such as a data explorer.

Jeff Cogswell can be reached at

Jeff Cogswell is the author of Designing Highly Useable Software ( among other books and is the owner/operator of CogsMedia Training and Consulting.Currently Jeff is a senior editor with Ziff Davis Enterprise. Prior to joining Ziff, he spent about 15 years as a software engineer, working on Windows and Unix systems, mastering C++, PHP, and ASP.NET development. He has written over a dozen books.

Submit a Comment

Loading Comments...
Manage your Newsletters: Login   Register My Newsletters

Rocket Fuel