We have seen what cloud computing is and how it is different than the normal software development. We have seen the different types of models, SaaS, PaaS, and IaaS used with cloud computing.
This chapter will introduce you to the Force.com platform. We will understand the life cycle of an application build using Force.com. We will define the multi-tenant architecture and understand how it will impact the data of the organization stored on the cloud. And finally, we will build our first application on Force.com.
The agenda for this chapter is as follows:
The cloud computing model of Force.com
Understand the PaaS model of Force.com
Application development on Force.com
Maintenance and releases
Types of Force.com applications
When to use point-and-click and when to use code
So let's get started and step into the cloud...
Force.com provides a 100 percent cloud computing model for enterprise application. The end-user does not have to worry about networks, hardware, software licenses, and so on. Everything is done on the cloud. The following features of Force.com make it a 100 percent cloud-based system:
Multi-tenant architecture: The multi-tenant architecture is a way of serving multiple clients on the single software instance. Each client gets their own full version of the software configuration and data. They cannot utilize the other instance resources. The software is virtually partitioned into different instances. The basic structure of the multi-tenant architecture is as shown in the following image:
Just like tenants in a single building share the resources of electricity and water, the multi-tenant system shares common resources. Separate programs are written to ensure that a single instance does not monopolize the resources.
Automatic upgrades: The newer version of the application is released automatically with all the users. Any developments or customizations made during the previous version are automatically updated to the latest version without any manual modification to the code.
Subscription model: Force.com is distributed under the subscription model. The user can purchase a few licenses and build the system. After the system is up and successful, further user licenses can be purchased from Salesforce. This model ensures that there no large start-up fee and we pay as we go, which adds fixed, predictable costs in the future.
The subscription model can be visualized like the electricity distribution system. We pay for whatever electricity we use and not the complete generator and the infrastructure.
Scalability: The multi-tenant kernel is already tested and running for many users simultaneously. If the organization is growing, there is always room for scaling the application with new users without worrying about the load balancing and data limitation. Force.com provides data storage per user, which means that the data storage increases with the number of users added to the organization.
Upgrades and maintenance : Force.com releases three updated versions every year. The new releases consist of feature updates to Salesforce.com and the Force.com platform with selected top ideas from IdeaExchange. IdeaExchange is the community of Salesforce users where the users submit ideas and the community votes for them. The most popular ideas are considered by Salesforce in their next release.
All the instances hosted on the servers are upgraded with no additional cost. The sandboxes are upgraded early so there can be testing for compatibility to the new release. The new releases are backward compatible with previous releases, thus the old code will work with new versions. The upgrades are taken care of by Force.com and the end-user gets the latest version running application.
Force.com offers a platform for development of business applications on the cloud. The platform is offered as a service, where we pay for only those things that are used and not for the entire server and hardware stack. The platform offers many built-in and point-and-click tools for rapid development of applications.
Let's take a detailed look at the services forming the platform offered by Force.com. The following section provides us with an overview of the Force.com platform.
Force.com is the world's first platform, where end-users can build, share and run an application on the cloud. The Force.com platform runs in a hosted multi-tenant environment, which gives the end-users freedom to build their custom application without hardware purchases, database maintenance and maintaining a software license. Salesforce.com provides three default applications built and hosted on Force.com. They include:
Salesforce Automation, Sales Cloud
Service and Support Center, Service Cloud
Collaboration Center, Chatter
The following figure shows the Force.com platform:
The application built on Force.com is automatically hosted on the cloud platform. It can be used separately (without the standard Sales, Service, and Marketing cloud) or can be used in parallel with the existing Salesforce application.
The users can access the application using a browser from any mobile, computer, tablet and any of the operating system such as Windows, UNIX, or Mac and so on, giving them complete freedom of location.
The hosted environment also ensures that the software is automatically updated to the latest releases, whether it is Salesforce CRM or a custom application build on Force.com platform. The automatic update automatically upgrades any code or components used by the custom application. As the applications hosted on the Force.com platform have access to a large pool of shared cloud resources, they can be easily scaled to millions of users without significant developer changes.
The key to building any successful business application is a powerful yet loosely coupled Model-View-Controller (MVC) architecture. The MVC architecture ensures that we separate the complex business logic from the UI and the database. This loosely coupled system also helps working in a team. It is also easy to upgrade part of the system without disturbing the entire structure. The following figure illustrates the model-view-controller of Force.com:
The complex business process logic is written inside the controller. The real-life business problems are programmed into powerful data manipulation algorithms. The business logic is separated from the back-end database and the front-end user interface.
Force.com uses workflows, Apex triggers, and Apex controllers as the controller in the MVC architecture.
The view forms the user interface of the system. This gives the designers the best chance of optimizing the complex data coming from the controller in a human readable form.
Force.com uses Visualforce pages, sites, and standard UI (including buttons, forms, tabs, and page views) to define a view.
The backbone of this loosely coupled system forms the model or the database. This powerful database system is offered as the bridges between view and controller. Data is wrapped in the model and send to the UI for display.
The metadata, Salesforce objects, Apex objects, and Database.com schema form the model layer of Force.com
We will be looking in detail at each layer in the MVC architecture in the subsequent chapters.
Force.com is a hosted multi-tenant service used to build custom cloud computing application. It is a 100 percent cloud platform where we pay no extra cost for the hardware and network. Any application built on Force.com is directly hosted on the cloud and can be accessed using a simple browser from a computer or a mobile.
The Force.com platform consists of some basic key technologies.
The base of the platform forms a multi-tenant kernel, where all users share a common codebase and physical infrastructure. The multiple tenants, who are hosted on a shared server, share the resources under governor limits to prevent a single instance monopolizing the resources. The custom code and data are separated by software virtualization and users cannot access each other's code.
The multi-tenant kernel ensures that all instances are updated to the latest version of the software simultaneously. The updates are applied automatically without any patches or software download.
The multi-tenant architecture is already live for one million users. This helps developers easily scale the applications from one to a million users with little or no modification. The following image illustrates the multi-tenant architecture:
Traditional software systems are hosted on a single-tenant system, usually a client-server based enterprise application. With the multi-tenant architecture, the end-user does not have to worry about the hardware layer or software upgrade and patches. The software system deployed over the Internet can be accessed using a browser from any location possible, even wide ranges of mobile devices.
The multi-tenant architecture also allows the applications to be low cost, quick to deploy, and open to innovation. Other examples of software using multi-tenant architecture are webmail systems such as www.Gmail.com, www.Yahoo.com, and online storage systems such as www.Dropbox.com, or note-taking applications such as Evernote, Springpad, and so on.
Force.com is entirely metadata driven. The metadata is defined in XML and can be extracted and imported. We will look into metadata in detail later in this chapter.
The data and the metadata stored on the Force.com server can be accessed programmatically through the Webservice API. This enables the developers to extend the functionality to virtually any language, operating system, and platform possible.
The web services are based on open web standards such as SOAP XML and JSON REST, and are directly compatible with other technologies such as .Net, JAVA, SAP, and Oracle. We can easily integrate the Force.com application with the current business application without rewriting the entire code.
Apex is the world's first on-demand language introduced by Salesforce. It is an object-oriented language very similar to C# or JAVA. Apex is specially designed for processing large amounts of data for business applications. Apex is used to write the controller in the MVC architecture.
Salesforce Object Query Language (SOQL) gives developers an easy and declarative query language that can fetch and process a large amount of data in an easy, human readable query language. SOQL is very similar to SQL used in other database systems and mostly uses similar syntax.
Apex and SOQL together give the developers powerful tools for managing the data and processes of their application, leaving the rest of the overage on the Force.com platform.
The following screenshot shows the page editor for Visualforce, it is easy to use and splits a page into two parts, the one at the bottom is for development and the above half shows the output:
Visualforce is an easy to use, yet powerful framework for creating rich user interfaces, thus extending the standard tabs and forms to any kind of interfaces imaginable. Visualforce ultimately renders into HTML and hence we can use any HTML code alongside the Visualforce mark-up to create a powerful and rich UI to manage business applications.
Apart from UI, Visualforce provides a very easy and direct access to the server side data and metadata from Apex. The powerful combination of rich UI with access to Salesforce metadata makes Visualforce the ultimate solution for building powerful business applications on Salesforce.
As the Salesforce.com Certified Force.com Developer Certification does not include Apex and Visualforce, we won't be going into detail about Apex and Visualforce in this book.
AppExchange is the directory of applications build on the Force.com platform. Developers can choose to submit their developed applications on AppExchange. The applications extend the functionality of Force.com beyond CRM with many ready-made business applications available to download and use.
AppExchange is available at http://appexchange.salesforce.com.
Force.com is an easier and efficient way to create a public site using the Salesforce.com data, Visualforce, and HTML/CSS. Using Force.com sites we can build sites with functionality in a jiffy. These sites do not requires a login unless it is designed in such a way.
Siteforce is a new product from Force.com that helps in creating websites using drag-and-drop controls. The sites built using Siteforce do not need any HTML knowledge. The user can directly use readymade components from the directory and create feature-rich websites directly linking their data.
The core process of development involved in traditional software is the same with Force.com. The Force.com platform offers many tools used to define data, business process, logic, and rich UI for the business application. Many of these tools are built-in, point-and-click tools simplified for native users without any development skills. Any user can build applications suitable to their business without a single line of code.
The point-and-click tools are easy to use, but they have limitations and control. To extend the platform beyond these limitations, we use Apex and Visualforce.
Let us now compare the tools used for traditional software development and Force.com:
Building the database
Oracle, MS-Access, SQL, or any third-party database setup
Oracle, MS-Access, SQL, or any third-party database setup
Salesforce metadata (and now database.com)
Connection to the database
Salesforce metadata API
NetBeans, Eclipse,and so on
Online Page Editor and App Setup, Force.com IDE
Controlled environment for development and testing
Local servers, remote test servers
Local servers, remote test servers
Force.com real time sandboxes
Everything on Force.com such as data models, objects, forms, tabs, and workflows are defined by metadata. The definitions or metadata are made in XML and can be extracted and imported. The metadata-driven development also helps users with no prior development experience to build business applications without any need to code. We can define the objects, tabs, and forms in the UI using point-and-click.
All the changes made to the metadata in App Setup are tracked. Alternatively, the developers can customize every part of Salesforce using XML flies that control the organization's metadata. The files are downloaded using eclipse IDE or Force.com IDE.
To customize metadata on Salesforce UI, go to Setup | App Setup:
The metadata API provides easy access to organization data, business logic, and the user interface. We can modify the metadata in a controlled test organization called the sandbox. Finally, the tested changes can be deployed to an enterprise edition or ultimate edition. This ease of access to the organization using metadata API ensures that only debugged and tested code reaches the live organization.
Force.com provides a built-in online editor that helps editing the Visualforce pages in real time. The online editor can be enabled by checking the Development Mode checkbox on the user profile, as shown in the following screenshot:
The online page editor splits the screen into two parts with live code in the bottom half and the final page output in the top half. Force.com also provides an inline editor for editing the Apex code in the browser itself.
Force.com IDE is an IDE built over eclipse. It provides an easy environment to write code and also offline saving too. It also comes with a schema browser and a query generator, which is helpful in generating simple queries (select statements) by selecting fields and object. The code is auto synced with the oranization.
Force.com provides a real-time environment to develop, test, and train people in the organization. It is a safe and isolated environment, where any changes made will not affect the production data or application. These sandboxes are used to experiment on new features without disturbing the live production organization. Separation of test and dev instances also ensures that only the tested and verified code reaches the production organization.
There are three types of sandboxes:
Configuration-only sandbox: This sandbox creates a copy of the metadata of the production organization. It also copies the reports, dashboards, price-books, and products. The configuration-only sandbox can be used to configure the production organization, create multiple objects and relationships, and deploy them to the production. This type of sandbox does not copy the production organization data apart from the objects mentioned above.
Developer sandbox: This environment is specially used for coding and testing of the environment by a single developer. Just like the configuration only sandbox, this also copies the entire customization of the production organization excluding the data. The added feature of a developer sandbox is that it allows Apex and Visualforce coding also.
Full copy sandbox: Full copy sandbox copies the entire production organization and all its data records, documents, and attachments. This is usually used to develop and test a new application until it is ready to be shared with the users. Full copy sandbox has the same IDs of the records as that of production only when it has been freshly created.
There are some common types of applications that are required to automate an enterprise process. They are as follows:
Content-centric applications: These applications enable organizations to share and version content across different levels. They consist of file sharing systems, versioning systems, and content management system.
Process centric applications: These applications focus on automating the business process in the organization such as a bug tracking system, procurement process, approval process, and so on. Force.com is suited to building these kinds of applications.
Data centric applications: These applications are built around a powerful database. Many of the organizations use spreadsheets for these applications. Some examples include CRM, HRM, and so on. Force.com is suited to building these kinds of applications.
There are two ways of development on Force.com, one way is using point-and-click without a single line of coding, called the declarative development. The other way is developing application using code, which is called programmatic development. Let us look at the two types of development in detail.
Declarative development is done by point-and-click using a browser. We use ready-to-use components and modify their configuration to build applications. We can add new objects, define their standard views, and create input forms with simple point-and-link with no coding knowledge. The declarative framework allows rapid development and deployment of applications.
Programmatic development requires prior coding knowledge. This method allows us to extend the Force.com platform beyond the declarative capabilities. This method gives us control and flexibility over the application we build.
Programmatic development also uses the MVC architecture.
Web services API
Web service API
The best practice is always to use both declarative and programmatic solutions to build complete applications. Declarative solutions have ease of development and maintenance. They are automatically upgraded with new releases of Salesforce. However, they do not provide complete flexibility to build robust solutions. Programmatic solutions can extend beyond the limitations of a declarative framework.
The easiest way to get your hands on Salesforce is to login through a developer account. If you already have one, login to it now or perform the following steps to create one:
Go to http://developer.Force.com.
Click on Join now.
Fill out the form and validate the e-mail address you provided.
We can login to Force.com from any standard web browser or third-party application. Force.com uses a three-factor authentication method. From the browser, the user is authenticated using the username, password and the I.P. address of the system. The IP address where the account is created is automatically white-listed for the user.
Every time the user logins from a separate IP address, the application verifies the IP by sending an e-mail to the registered e-mail address in the personal profile. Alternatively, the system administrator can enable access by setting the trusted IP ranges. Users login from the white-listed IP ranges are not asked for validation of their IP address or the security token.
The Force.com username is in the format of an e-mail
<[email protected]>, the username is unique across the global organization of Salesforce. If you already have a developer organization with
<[email protected]>, you won't be able to create another one in same username. You can give a separate username ([email protected]) and a valid e-mail ([email protected]) in this case.
To change or modify a personal e-mail address go to Setup | Personal Setup | My Personal Information | Personal Information
To add your IP address in Trusted IP Ranges and white-list it, navigate to Setup | Administration Setup | Security Controls | Network Access as shown in the following screenshot:
If you are within a LAN network of your office, university, and so on, the IP address given by ipconfig command in DOS will give you the internal network specific IP. This IP address is not seen by Force.com; you need the public domain IP address to white-list. To find your public domain IP address, you can visit http://www.whatismyip.com.
When you login to Force.com from a third-party tool such as Force.com IDE, Outlook Edition, Data Loader, or API you need an additional security token along with a username and password.
Every login user gets a security token tied to the password. We need to reset the security token the first time. It is automatically reset whenever password is changed.
Along with a developer account, http://developer.Force.com provides additional resources for developers.
All these resources can be accessed free with a single developer account. Additional community blogs and resources are available in the final chapter of the book.
In this chapter we became familiar with the Force.com platform. We have seen the application life cycle of an application build using Force.com. We saw the multi-tenant architecture and how it is different from the web-hosting server.
We have a fresh new developer account and now in further chapters we will be using it to build an application on Force.com.
Out of the following things which can be done using the Force.com platform? (Select two)
b. Applications with clicks and not code
c. Applications can be upgraded without loss of customization
d. Code version control system
Which of the following statements are true concerning e-mail activation? (Select one)
a. The e-mail activation feature requires that the user click an activation link before logging in from a new computer
b. The e-mail activation feature cannot be disabled
c. The e-mail activation feature can be disabled by request to Salesforce.com support
d. The e-mail activation feature can be disabled through the UI
A security token is required for API access when connecting from an IP address within the list of trusted networks.
Out of the following which applications are suitable for Force.com? (Choose three)
a. Time card application
b. Word processor
c. Online auction management
d. Inventory management
Which of the following refers to the data model of Salesforce? (Choose 2)
a. Force.com API
b. Force.com metadata API
d. Force.com IDE
What types of paid Salesforce edition are available?
a. Enterprise edition
b. Unlimited edition
c. Trial edition
d. Developer edition
Where are Force.com IDs identical?
a. Production and full copy sandbox only
b. Production and dev sandbox only
c. Two developer orgs
d. Two sandbox org