It would be difficult to talk about the cloud’s brief history without mentioning Salesforce, the company that helped usher in a new era of hosted services. Salesforce hit the big time with its innovative customer relationship management (CRM) product and has been going strong ever since. So successful has the product been, in fact, that it’s easy to view Salesforce as nothing but a CRM service, riding out its comfortable niche in cyberspace, but providing little more in the way of services.
Yet Salesforce has been quietly pushing the cloud envelope with its acquisitions and ever-expanding line of offerings. One in particular that’s had a surprisingly positive reaction is its platform-as-a-service (PaaS) Force.com, a suite of point-and-click tools for creating and deploying custom employee apps. Force.com has made developing and implementing cloud-based solutions faster and easier than ever, and in the process has changed the way we think about application development.
At Home in the Cloud with Force.com
Over the past few years, the PaaS movement has made significant inroads into the “as a service” landscape, providing managed platforms for building, deploying, and maintaining web-based and mobile applications. CloudBees, AppFog, Apprenda, OpenStack, Engine Yard, and Red Hat OpenShift are but a few of the PaaS vendors now available, with Salesforce running at the front of the pack.
Force.com offers an environment for a wide range of developers-not just seasoned programmers-so they can build and deploy hosted applications on a secure, intuitive platform. Rather than purchase and maintain pricey servers and software in-house, organizations can funnel their resources into creating the apps they need and getting them out there as soon as possible, without all the setup headaches that normally come with such efforts.
The Force.com platform is built on a multitenant architecture in which all users and their apps share a single infrastructure and code base. Although this approach means developers must work within the platform’s confines, it eliminates having to maintain individual environments and be concerned with such issues as upgrading and patching software, processes that grow in complexity as the number of developers rise.
Force.com apps are data-centric and adhere to a metadata-driven development model. Each app is built around a structured database, which is defined as part of the development process. In addition, the app’s basic functionality is stored as metadata within the database, rather than being hardcoded in the programming language. When a user accesses an app deployed on the Force.com platform, the app’s metadata is rendered in the user interface, similar to how a browser renders HTML to display a web page.
Force.com also provides a number of REST and SOAP APIs to allow developers to integrate third-party services into their applications. The APIs can be called from any programming language that supports web services-including C#, Java, Ruby, and PHP-so that third-party programs can access and manipulate Force.com apps from other server locations. In addition, Force.com provides off-the-shelf native ERP connectors as well as other interception points such as syndication feeds.
As part of its platform, Force.com also offers security and sharing features that restrict application and data access. You can, for example, control what information specific users can view and update-at the object, field, or record level. Figure 1 shows an example of how easy it is to configure a permission set on a specific object. In this case, the user accounts assigned to the permission set can read, add, modify, or delete data associated with that object.
Force.com also includes workflow and approval services for defining rules that trigger actions such as assigning tasks, sending email alerts, or updating field values. In this way, you can define processes to carry out specific business logic based on your customized rules. Plus, Force.com provides the ability to create dashboards and generate reports that include such features as filters, charts, aggregated data, and conditional highlighting.
The Magical World of Point-and-Click Development
Salesforce is certainly not the only company to offer a platform for developing and deploying apps in the cloud; however, Force.com provides a level of usability not found in most platforms, one that appeals to a wide range of developers and developer wannabes.
In his piece “The Salesforce Platform: The Return of the Citizen Programmer,” Dan Appleman claims that Force.com is “so insanely productive and effective that large numbers of citizen programmers have been turning to it to build all kinds of amazing solutions, without needing to turn to professionals at all.”
That’s not to say there isn’t a place for the professional developer at Force.com. It’s just that the platform tries to appeal to all levels of users. Best of all, you don’t have to be a Salesforce customer to try out the platform. You can get the Developer Edition for free simply by registering at the Salesforce website. Once registered, you’re ready to go-even if you’ve never instantiated an object in your life.
Even if you haven’t, you’ll quickly learn that objects are a way of life at Force.com, with development built around the concept of the custom object. For each application, you define one or more custom objects that determine how and what data is displayed as well as provide the structure for the underlying database and much of the security model.
When you build a Force.com app, you’re essentially assembling a collection of custom objects and controlling how data is presented within those objects. For example, your solution might include objects for employees, sales orders, invoices, and merchandise. Each object represents a collection of related information, just like tables in a database, and brings with it the full complement of Force.com features, such as sharing, security, workflow, and ultimately the user interface.
Creating a Force.com object is a very straightforward process. On the platform’s Setup page (which you access through your browser), you simply expand the Create node in the left-hand menu, click Objects, and then click the New Custom Object button on the Custom Objects page. You’ll then be presented with a fill-in-the-blanks form that defines your object’s basic properties, as shown in Figure 2.
At this point, you’re defining only the main properties, such as Label, Object Name, and Description, along with several standard settings. There are a couple of items worth noting, however, that point to the object-centric nature of a Force.com app.
The first of these is the Enter Record Name Label and Format section. As you’ll recall, an app’s objects help to define the underlying database. In fact, Salesforce documentation often refers to an object as a table when referencing the object in context with the underlying data. Of course, an object is much more than that, but the notion of a table is inextricably tied to that of an object.
Conceptually, you might say that all data modeling occurs at the object level and is then propagated to the data tier. In this sense, an object is also a table, a field is a column, and a record is a row of data. Fortunately, you don’t have to worry about where one definition ends and the other begins. You create the objects and Force.com does the rest, using your input along the way. You can then define relationships between objects, like you can between tables, or add logic such as triggers or data validation rules.
In the Enter Record Name Label and Format section, you define your object’s first field, which is similar to defining a natural key in a relational database. The column might be used for such data as invoice numbers, product names, case IDs, or other types of data that identify the records associated with the object. For this section, you need only provide a field name and select a data type.
The other option worth noting on the Custom Object Info form is the last one: Launch New Custom Tab Wizard after saving this custom object. When you select this option, the wizard runs after you’ve finished creating your object. For any object you create, you can define an associated tab that is displayed to the user in the app’s interface. The tab serves as an entry point to the object in order to interact with its data. There, users can read or edit the information, depending on their level of permissions.
For example, Figure 3 shows the objects I created for a practice app named Warehouse. (The Warehouse app is based on the tutorials in the Force.com Workbook.)
Now take a look at Figure 4. Notice that the app displays tabs only for the Merchandise and Invoice objects. I did not create a tab for the Line Item object. (The other tabs are added by default when you first create the app.) In this case, the Merchandise tab is active and shows a list of products. These products are records that I added to the Merchandise object.
The point of all this is not to provide you with a manual on how to build a Force.com app (refer to the workbook for that), but rather to stress the object-centric nature of application development in that environment. Only after you’ve created your custom objects can you add the necessary functionality.
Let’s look at an example. Figure 5 shows part of the Custom Object Definition Detail page for the Merchandise object. Here you can edit the object’s basic properties as well as add custom fields, define relationships, create triggers, and perform a number of other actions, all at the object level.
No doubt one of the first things you’ll want to do is to add the necessary custom fields (columns). In this case, I’ve already added the Price and Quantity fields. However, you can add more fields by clicking the New button and following the steps in the wizard.
The first screen in the wizard asks you to select a data type, as shown in Figure 6. Force.com supports a number of types, including Geolocation, URL, Phone and Percent, so be sure to pick the most appropriate type for your particular situation. (Note that Figure 6 shows only a partial list of the supported types.)
The next screen of the wizard, shown in Figure 7, let’s you configure several of the field’s property settings. Some of the displayed options, such as Length and Decimal Places, are included only for certain data types.
The wizard includes a couple other screens, but you get the point. For each object, you can create a set of fields to display the data associated with that object.
When defining your app’s objects and fields, you want to be sure to group data logically. For example, you would not want to create a single object that merges sales and inventory data. At the very least, you should separate such data into two objects. When planning your custom objects, think in terms of a relational data model, and then build on that.
Once you’ve created your objects, you can define relationships between them to tie the data together. For example, in the Warehouse app, I created two relationships on the Line Item object, one pointing to the Invoice object and the other pointing to the Merchandise object. Essentially, I’ve created two foreign key relationships on the Line Item table. Figure 8 shows what these relationships look like in Schema Builder, a built-in tool that displays your objects, as well as their fields and relationships, in a standard entity-relationship diagram.
There is much more to building an app, of course, but what we’ve looked at here should give you a glimpse into the Force.com environment and its point-and-click, object-centric nature. Now let’s look at what else you can do in Force.com.
A Place for the Pros in the Development Console
Seasoned developers will quickly realize that no click-and-point interface, no matter how robust and mature it has become, will be able to cover all scenarios. Custom components will need to be created to meet an app’s unique requirements. Even developers who have not dismissed Force.com outright will find little value in a platform that cannot accommodate the wide spectrum of business logic necessary to support their applications.
Fortunately, Force.com also provides the Developer Console, an integrated development environment chock-full of tools for creating, debugging, and testing custom application code. You can access the Developer Console from within the Force.com environment; however, it runs in a window separate from the basic interface. Figure 9 shows the Developer Console as it appears when you first launch it.
From the Developer Console, you can create, view, or edit classes and triggers, as well as view your custom objects. You can also view and edit Visualforce pages. Visualforce is a component-based feature available in Force.com for customizing the user interface.
In addition, the Developer Console lets you edit and run queries written in the Salesforce Object Query Language (SOQL) or the Salesforce Object Search Language (SOSL). You can then view your query results in a grid that lets you read and modify record data. In addition, you can use the Developer Console to set checkpoints, view debug logs, and run unit tests against your code.
At the heart of custom development in Force.com is the Apex programming language, a strongly typed, object-oriented language with a Java-like syntax. You can use Apex to incorporate custom business logic in your applications as well as write database triggers and add program controllers to the user interface. Apex is tightly integrated with the SOQL and SOSL query languages, supports web services, and includes features specific to a multitenant environment.
To give you a taste of Apex, let’s look at an example from the Force.com Workbook. As you’ll recall, I created the Invoice and Line Item objects, based on the workbook’s tutorials. For each record in the Invoice table, there can be one or more associated child records in the Line Item table. Suppose I now want to incorporate business logic into my app so that an invoice’s line items can be numbered consecutively, starting with 1 and incremented by 1. I can achieve this by using Apex to create a class and method in the Development Console, as shown in Figure 10.
I won’t go into all the code details, but if you’re familiar with Java or C#, most of the elements should look fairly familiar. Basically, I’m creating the InvoiceUtilities class and the RenumberLineItems method. You can find details about the class elements, along with other language components, in the Apex Code Developer’s Guide.
Once you’ve created components such as classes and methods, you can incorporate them into your application. For example, I can add a custom button to the Invoice object that calls the RenumberLineItems method when the button is clicked.
On the Move with SalesForce1
Force.com is a cloud-based platform. As such, the apps you create are available in the cloud, either through a browser (as you saw in Figure 4) or through the Salesforce1 mobile app, available for free to Android and iOS devices. Like the browser-based app, the mobile app exposes object functionality through tabs. Figure 11 shows the Salesforce1 app as it appears on an iPad, with the Merchandise tab selected.
Like the browser-based app, Salesforce1 provides a number of tabs by default, in addition to those associated with custom objects (in this case, Merchandise and Invoice). With the mobile app, however, you get lots more tabs (which I won’t go into here). What’s worth noting, however, is how simple it is to get an app built, deployed, and made available to a mobile device. You can, in fact, get a basic application up and running in a matter of minutes.
Best of all, the Salesforce1 app is already fully interactive. In the case of the Merchandise tab, users can view existing records (only those they have permission to view) and add new records. With a little more effort, we can build in features to let users edit existing records as well. The point is, all this comes as part of Force.com, which might explain why the platform has caught on to the degree it has.
One other item worth noting. The Salesforce1 moniker also applies to the Salesforce1 Platform, an umbrella system that includes the full spectrum of the Salesforce cloud development services. Not only does the platform offer Force.com and the Salesforce1 app, but also the Heroku platform (acquired in 2010), a set of app and user management controls, and a extensive collection of APIs for integrating applications and services. Salesforce also appears poised to release its Lightning technologies into the Salesforce1 Platform, which promise to streamline app development even further and bring point-and-click app-building to a whole new level.
A Salesforce to be Reckoned with
Force.com’s growing popularity should come as no surprise given the significant progress the platform has made in reducing the complexities of app development. Salesforce also has a growing developer community behind it, with available resources such as discussion forums and developer user groups, we well as development tools, documentation, and a set of workbooks that are clear and concise and a welcomed relief when compared to the resources available to other platforms and services. Salesforce also supports AppExchange, a marketplace of business apps and consulting partners. Here you can install and evaluate solutions, as well as market your own.
Force.com has plenty to offer, whether you’re a neophyte programmer or someone who’s been around the block a time or two. That’s not to say the platform is an ideal fit for every scenario or type of cloud application. You’re dealing with a proprietary programming language and an environment not as mature as other development platforms out there.
Even so, Force.com is worth serious consideration if you want to get a cloud app up and running in days, rather than weeks or months. For smaller organizations without the resources necessary to support a more sophisticated development environment, a platform such as Force.com could prove an ideal solution. But do your homework first. You have little to lose by first giving the platform a test ride. Once you do, you might find you have a great deal to gain.