Book Image

Force.com Enterprise Architecture

By : Andrew Fawcett
Book Image

Force.com Enterprise Architecture

By: Andrew Fawcett

Overview of this book

Table of Contents (20 chapters)
Force.com Enterprise Architecture
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Enterprise organizations have complex processes and integration requirements that typically span multiple locations around the world. They seek out the best in class applications that support their needs today and in the future. The ability to adapt an application to their practices, terminology, and integrations with other existing applications or processes is key to them. They invest as much in your application as they do in you as the vendor capable of delivering an application strategy that will grow with them.

Throughout this book, you will be shown how to architect and support enduring applications for enterprise clients with Salesforce by exploring how to identify architecture needs and design solutions based on industry-standard patterns. Large-scale applications require careful coding practices to keep the code base scalable. You'll learn advanced coding patterns based on industry-standard enterprise patterns and reconceive them for Force.com, allowing you to get the most out of the platform and build in best practices from the start of your project.

As your development team grows, managing the development cycle with more robust application life cycle tools and using approaches such as Continuous Integration become increasingly important. There are many ways to build solutions on Force.com; this book cuts a logical path through the steps and considerations for building packaged solutions from start to finish, covering all aspects from engineering to getting it into the hands of your customers and beyond, ensuring they get the best value possible from your Force.com application.

What this book covers

Chapter 1, Building, Publishing, and Supporting Your Application, gets your application out to your prospects and customers using packages, AppExchange, and subscriber support.

Chapter 2, Leveraging Platform Features, ensures that your application is aligned with the platform features and uses them whenever possible, which is great for productivity when building your application, but perhaps more importantly, it ensures whether your customers are also able to extend and integrate with your application further.

Chapter 3, Application Storage, teaches you how to model your application's data to make effective use of storage space, which can make a big difference to your customer's ongoing costs and initial decision-making when choosing your application.

Chapter 4, Apex Execution and Separation of Concerns, explains how the platform handles requests and at what point Apex code is invoked. This is important to understand how to design your code for maximum reuse and durability.

Chapter 5, Application Service Layer, focuses on understanding the real heart of your application: how to design it, make it durable, and future proofing around a rapidly evolving platform using Martin Fowler's Service pattern as a template.

Chapter 6, Application Domain Layer, aligns Apex code typically locked away in Apex Triggers into classes more aligned with the functional purpose and behavior of your objects, using object-orientated programming (OOP) to increase reuse and streamline code and leveraging Martin Fowler's Domain pattern as a template.

Chapter 7, Application Selector Layer, leverages SOQL to make the most out of the query engine, which can make queries complex. Using Martin Fowler's Mapping pattern as a template, this chapter illustrates a means to encapsulate queries, making them more accessible and reusable, and their results more predictable and robust across your code base.

Chapter 8, User Interface, covers the concerns of an enterprise application user interface with respect to translation, localization, and customization, as well as the pros and cons of the various UI options available in the platform.

Chapter 9, Providing Integration and Extensibility, explains that enterprise-scale applications require you to carefully consider integration with existing applications and business needs while looking into the future, by designing the application with extensibility in mind.

Chapter 10, Asynchronous Processing and Big Data Volumes, shows that designing an application that processes massive volumes of data either interactively or asynchronously requires consideration in understanding your customer's volume requirements and leveraging the latest platform tools and features, such as understanding the query optimizer and when to create indexes.

Chapter 11, Source Control and Continuous Integration, shows that maintaining a consistent code base across applications of scale requires careful consideration of Source Control and a planned approach to integration as the application is developed and implemented.

What you need for this book

In order to follow the practical examples in this book, you will need to install the Salesforce Force.com IDE, Apache Ant v1.6 or later, Java v1.6 or later, and the Salesforce Developer Edition Orgs.

The following is the list:

  • Salesforce Developer Edition Orgs

  • Java v1.6 (or later)

  • Apache Ant v1.6 (or later)

  • GitHub Client (optional for chapters 1 - 10)

  • Salesforce Force.com IDE (optional)

  • MavensMate (optional for chapters 1 - 10)

  • Salesforce Developer Console (optional)

Who this book is for

This book is aimed at Force.com developers who are looking to push past Force.com basics, and learn how to truly discover its potential. You will be looking to expand your knowledge of developing packaged ISV software and complex, scalable applications for use in enterprise businesses with the Salesforce platform. You will know your way around Force.com's non programmatic functionality as well as Apex, and are looking to learn how to architect powerful solutions for enterprise-scale demands. If you have a background in developing inside other enterprise software ecosystems you will find this book an invaluable resource for adopting Force.com.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "This example utilizes read and write member variables in the RaceRetirement class, indicating both are required."

A block of code is set as follows:

try 
{
  Set<Id> seasons = new Set<Id> { seasonId };

  SeasonService.updateStandings(seasons); 

  SeasonService.issueNewsLetters(seasons);
}
catch (Exception e) 
{
  ApexPages.addMessage(e);
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

public PageReference awardPoints()
{
   try 
   {
     ContestantService.awardChampionshipPoints(
       new Set<Id> { standardController.getId() });
   }
   catch (Exception e) 
   {
     ApexPages.addMessages(e);
   }        
   return null;
}

Any command-line input or output is written as follows:

ant package.installdemo 
  -Dsf.username=testorgusername 
  -Dsf.password=testorgpasswordtestorgtoken

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The Developer Console option provides some excellent tools to profile the consumption of governors."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

The source code for this book has been provided through the cloud-based source control repository known as GitHub. The collective source code for the application built throughout the book is available in the main branch. For each chapter, a branch has been provided containing the code added during that chapter building from the previous one, for example, branch chapter-02 will contain code from chapter-01.

The repository for this book can be found at https://github.com/afawcett/forcedotcom-enterprise-architecture.

Downloading the source code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

An alternate way to download the source code is to navigate to www.github.com in your browser using the link given in the preceding section, locate the repository and branch you want to download, either the main branch or a specific chapter branch, and then click on the Download Zip button in the sidebar on the right.

Alternatively, you can download the GitHub desktop clients as listed above and click on the Clone in Desktop button.

Of course, if you are familiar with Git, you are free to use the tool of your choice.

Deploying the source code

Once you have the source code downloaded for your chosen chapter, you should execute the Ant build script to deploy the code into your chosen Salesforce Developer Edition org (as described in Chapter 1, Building, Publishing, and Supporting Your Application).

Open a command line and navigate to the root folder where you downloaded the source code (this should be the folder with the build.xml file in it). To deploy the code, execute the following command, all on one line:

# ant deploy [email protected] -Dsf.password=mypasswordmytoken

Note

Remember that the password and token are concatenated together.

Keep in mind that each chapter branch builds incrementally from the last and will overlay new files as well as changes into your chosen DE org. So, each branch may overwrite changes you make to existing files as you have been exploring that chapter. If you are concerned about this, it is best to use one of the desktop development tools listed earlier, and prior to running the previous command, download the code from the server for safe keeping.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/2994EN_GraphicsBundle.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.