Salesforce Anti-Patterns: Create powerful Salesforce architectures by learning from common mistakes made on the platform
()
About this ebook
Salesforce Anti-Patterns teaches you to spot errors in Salesforce patterns that may seem like a good idea at first but end up costing you dearly. This book will enable Salesforce developers and architects to understand how ingenious Salesforce architectures can be created by studying anti-patterns and solutions to problems that can later lead to serious implementation issues. While there are several books on the market that start with the question, “How do I create great Salesforce architecture?” and proceed to a solution from there, this book instead starts by asking, “What tends to go wrong with Salesforce architectures?” and proceeds to a solution from there.
In this book, you’ll find out how to identify and mitigate anti-patterns in the technical domains of system architecture, data architecture, and security architecture, along with anti-patterns in the functional domain of solution architecture as well as for integration architecture. You’ll also learn about common anti-patterns affecting your Salesforce development process and governance and, finally, how to spot common problems in how architects communicate their solutions.
By the end of this Salesforce book, you’ll have gained the confidence to architect and communicate solutions on the Salesforce platform while dodging common mistakes.
Read more from Lars Malmqvist
Salesforce DevOps for Architects: Discover tools and techniques to optimize the delivery of your Salesforce projects Rating: 0 out of 5 stars0 ratings
Related to Salesforce Anti-Patterns
Related ebooks
Salesforce Architect's Handbook: A Comprehensive End-to-End Solutions Guide Rating: 0 out of 5 stars0 ratingsEngineering Manager's Handbook: An insider's guide to managing software development and engineering teams Rating: 0 out of 5 stars0 ratingsPractical Salesforce Development Without Code: Building Declarative Solutions on the Salesforce Platform Rating: 0 out of 5 stars0 ratingsServerless Beyond the Buzzword: What Can Serverless Architecture Do for You? Rating: 0 out of 5 stars0 ratingsSalesforce CRM Administration Handbook: A comprehensive guide to administering, configuring, and customizing Salesforce CRM Rating: 0 out of 5 stars0 ratingsSolution Architecture with .NET: Learn solution architecture principles and design techniques to build modern .NET solutions Rating: 0 out of 5 stars0 ratingsPractical Full Stack Machine Learning: A Guide to Build Reliable, Reusable, and Production-Ready Full Stack ML Solutions Rating: 0 out of 5 stars0 ratingsEssential Guide to LLMOps: Implementing effective LLMOps strategies and tools from data to deployment Rating: 0 out of 5 stars0 ratingsScalability Patterns: Best Practices for Designing High Volume Websites Rating: 0 out of 5 stars0 ratingsLearning Salesforce Visual Workflow and Process Builder - Second Edition Rating: 4 out of 5 stars4/5Better Embedded System Software Rating: 0 out of 5 stars0 ratingsApex Design Patterns Rating: 4 out of 5 stars4/5Software Architecture for Busy Developers: Talk and act like a software architect in one weekend Rating: 0 out of 5 stars0 ratingsThe DevOps Career Handbook: The ultimate guide to pursuing a successful career in DevOps Rating: 0 out of 5 stars0 ratingsScrum: What You Need to Know About This Agile Methodology for Project Management Rating: 5 out of 5 stars5/5Learning Apex Programming Rating: 5 out of 5 stars5/5Salesforce Sales Cloud – An Implementation Handbook: A practical guide from design to deployment for driving success in sales Rating: 0 out of 5 stars0 ratingsMonetizing Machine Learning: Quickly Turn Python ML Ideas into Web Applications on the Serverless Cloud Rating: 0 out of 5 stars0 ratingsBuilding Design Systems: Unify User Experiences through a Shared Design Language Rating: 0 out of 5 stars0 ratings
Enterprise Applications For You
Excel 2019 For Dummies Rating: 3 out of 5 stars3/5QuickBooks 2024 All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsBitcoin For Dummies Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5QuickBooks 2023 All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsEnterprise AI For Dummies Rating: 3 out of 5 stars3/5Excel Formulas That Automate Tasks You No Longer Have Time For Rating: 5 out of 5 stars5/5Scrivener For Dummies Rating: 4 out of 5 stars4/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsNotion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5Excel 2016 For Dummies Rating: 4 out of 5 stars4/550 Useful Excel Functions: Excel Essentials, #3 Rating: 5 out of 5 stars5/5Excel Gurus Gone Wild: Do the IMPOSSIBLE with Microsoft Excel Rating: 4 out of 5 stars4/5Access 2019 For Dummies Rating: 0 out of 5 stars0 ratingsExcel Formulas and Functions 2020: Excel Academy, #1 Rating: 4 out of 5 stars4/5SharePoint 2016 For Dummies Rating: 5 out of 5 stars5/5Managing Humans: Biting and Humorous Tales of a Software Engineering Manager Rating: 4 out of 5 stars4/5Excel All-in-One For Dummies Rating: 0 out of 5 stars0 ratingsExcel Workbook For Dummies Rating: 4 out of 5 stars4/5Excel for the Math Classroom Rating: 5 out of 5 stars5/5Microsoft Excel 365 Bible Rating: 0 out of 5 stars0 ratingsQuickBooks Online For Dummies Rating: 0 out of 5 stars0 ratingsChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 1 out of 5 stars1/5
Reviews for Salesforce Anti-Patterns
0 ratings0 reviews
Book preview
Salesforce Anti-Patterns - Lars Malmqvist
BIRMINGHAM—MUMBAI
Salesforce Anti-Patterns
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Alok Dhuri
Publishing Product Manager: Harshal Gundetty
Senior Editor: Ruvika Rao
Technical Editor: Pradeep Sahu
Copy Editor: Safis Editing
Project Coordinator: Manisha Singh
Proofreader: Safis Editing
Indexer: Subalakshmi Govindhan
Production Designer: Ponraj Dhandapani
Developer Relations Marketing Executives: Deepak Kumar and Rayyan Khan
Business Development Executive: Puneet Kaur
First published: December 2022
Production reference: 1171122
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-80324-193-7
www.packt.com
To Damiana, Ada, and Pino. To my mother, Inger Bejder, and the memory of my father,Finn Malmqvist.
– Lars Malmqvist
Contributors
About the author
Lars Malmqvist has spent the past 13 years working as an architect and CTO within the Salesforce ecosystem. He has worked on over 40 Salesforce implementations, ranging from simple out-of-the-box scenarios to advanced, bespoke, multi-cloud solutions for large global brands. He is a 29-time certified Salesforce CTA with degrees in anthropology, mathematics, and technology management, an MBA from the University of Cambridge, and a Ph.D. in computer science from the University of York. Currently, he is a partner at Implement Consulting Group.
I would like to thank my wife, Damiana, for her undying support and my children, Ada and Pino, for their constant inspiration.
About the reviewers
Ashvin Bhatt is an enterprise architect, technical writer, trainer, and speaker with over 11 years of experience with the Salesforce platform working on various clouds. He has trained over 600 people on Salesforce through various initiatives. He is a certified Application Architect and holds a wealth of experience with various Salesforce products. Ashvin is the co-organizer of the Salesforce Architect Summit and has been a speaker at various events, such as Dreamforce and TDX. He has worked in a variety of domains such as high tech, advertising, manufacturing, healthcare, insurance, and pharma, to name a few. He believes in sharing his knowledge through community-led initiatives to help foster learning and innovation.
Rafael Gutiérrez Castillo is a Salesforce architect with multi-cloud implementation experience. With more than 10 years of working experience, he started his career in the education industry, developing leadership programs for university students.
He has worked in different positions within the Salesforce ecosystem, as a business consultant, tester, solution consultant, and solution architect.
Working as an associate manager at Accenture, he designs solutions that bridge the gap between business processes and technology and advises companies on their digitalization and transformation journeys. Being the proud owner of 24 Salesforce certificates, he is passionate about automation processes, solution design, process management, innovation, and leadership.
Table of Contents
Preface
Part 1: Technical Anti-Patterns
1
Why You Need to Understand Salesforce Anti-Patterns
Understanding anti-patterns
From pattern to anti-pattern
Where do anti-patterns come from?
An anti-pattern template
How can anti-patterns deepen your architecture skills?
How great architects learn from mistakes
An example: The Hero anti-pattern
Hero (development life cycle and deployment planning)
Analyzing the example
Summary
2
How Not to Mess Up Your System Architecture
Muddling up the systems landscape
Stovepipe
A Big Ball of Mud
Too much coupling
Intense coupling
Org complications
Ungoverned Org Proliferation
Knowing the takeaways
Summary
3
How Not to Get Confused about Security
Getting confused about shared responsibility
Shared Belongs to Salesforce
Mistaking other things for security
Compliant Is Secure
Declarative Is Always Safe
Sharing isn’t always caring
Spaghetti Sharing Model
Knowing the takeaways
Summary
4
What Not to Do about Data
Mistaking Salesforce for a regular database
Salesforce as Relational Database
Forgetting about governance
Disconnected Entities
Unplanned Growth
Synchronizing excessively
Unconstrained Data Synchronization
Knowing the takeaways
Summary
Part 2: Solution Anti-Patterns
5
Unpicking Solution Architecture Troubles
Picking the wrong thing
Ignoring the ecosystem
License-based solutioning
Applying the thing wrong
Assumption-driven customization
The Golden Hammer
Engineering overflow
Automation bonanza
Overweight component
Making a mess of code
God class
Error hiding
Knowing the takeaways
Summary
6
Keeping Integration Straight
Muddling up the integration landscape
Middleware in name only (MINO)
Service proliferation syndrome
Interfacing indecently
Fat interface
Chatty integration
Getting the patterns wrong
Integration pattern monomania
Knowing the takeaways
Summary
Part 3: Process and Communication Anti-Patterns
7
Keeping the Development Life Cycle from Going off Track
Misaligning the process
Big bang release
Project pieism
Unpacking the pipeline
Using packages to create silos
Example
Problem
Proposed solution
Results
Better solutions
Testing without testing
Dummy unit tests
Knowing the takeaways
Summary
8
Communication without Mistranslation
Communicating too much
Cognitive overload
Being unclear in several ways
Ambiguous solution
Groundhog day
Drawing diagrams with excess creativity
Non-standard documentation
Knowing the takeaways
Summary
9
Conclusion
Summarizing the key messages
Explaining how to use anti-patterns in practice
Using anti-patterns constructively
Using anti-patterns diagnostically
Going further with anti-patterns
Diving deeper into the anti-pattern literature
Extending your knowledge of Salesforce architecture
Extending your general architecture knowledge
Summary
Index
Other Books You May Enjoy
Preface
Salesforce is the world’s leading enterprise systems platform. This is a position it has reached over the last decade, with its scope having grown from its roots in sales and customer service to encompass a wide range of business domains.
However, as Salesforce has grown, so have the complexities of the technological environments that contain it. And with that growing complexity, a number of common mistakes have emerged that often end up derailing Salesforce projects in a number of interesting ways.
These mistakes are what we will learn to call anti-patterns and investigate in a structured manner in this book. There are quite a few books on Salesforce architecture already available on the market today, but they all approach the subject from a normative view, grounded in good practice.
In this book, we flip that perspective around. We look at bad practices that commonly occur in Salesforce projects, and that, in fact, can seem like a good idea at the time you make the decision.
By doing that, we see what happens when things don’t go to plan – when you don’t make the right call, and your solution suffers as a consequence. That gives a great background for us to review key architectural concepts and good practice as it applies across a range of scenarios.
In this book, you will get information structured into the seven domains of the Certified Technical Architect (CTA) exam roadmap. That way, while all the information is based on real-world examples, you will also be able to directly apply it in your journey to becoming a CTA, should that be a path you are on or are considering.
Who this book is for
This book is for anyone who has a position of responsibility in a Salesforce implementation and wants to see it avoid the common mistakes that plague many projects. While the primary audience is architects or aspiring architects, it will also be of value for project managers, business analysts, functional consultants, and executives overseeing Salesforce projects.
What this book covers
Chapter 1, Why You Need to Understand Salesforce Anti-Patterns, starts by explaining what anti-patterns are by going through a number of different definitions and ways of looking at them. You will then learn how they can help you deepen your understanding of architecture by understanding how these common mistakes are made and how they can seem like a good idea at the time. We then finish the chapter by understanding the book and the ways in which you can approach the content.
Chapter 2, How Not to Mess Up Your System Architecture, guides you through common anti-patterns relating to the systems landscape, the mix of systems you use in your solution, and how they can be combined. We will start by looking at anti-patterns at the highest level that describe problems around the composition and scoping of systems. Then we will look at anti-patterns that create highly coupled and brittle system landscapes, after which we will look at anti-patterns around selecting the right systems to include. The chapter will end with a review of the key takeaways for real life and the CTA Review Board.
Chapter 3, How Not to Get Confused about Security, includes anti-patterns related to securing your Salesforce org. It starts by reviewing a key anti-pattern around the shared security model that is integral to Salesforce. Then we will look at anti-patterns that can occur when you mistake other things for security. We will continue to look at how not to make a mess of your sharing model and once again finish up with a review of the takeaways.
Chapter 4, What Not to Do about Data, contains anti-patterns related to data architecture, modeling, and governance. We will start by looking at what goes wrong when you don’t design with Salesforce’s object model in mind. Then we will look at some of the common governance disasters that can happen around data. From there, we will look intently at data synchronization and the ways in which it can go wrong, and finish up with takeaways for life and the CTA Review Board.
Chapter 5, Unpicking Solution Architecture Troubles, covers anti-patterns related to your solution architecture. We will start by looking at anti-patterns related to your choice of solutions. Then we will look at things that can go wrong when you do functional design. Thirdly, we will look at some particular anti-patterns that affect customizations, first at the conceptual level and then at the code level. We will end the chapter by summarizing the key takeaways.
Chapter 6, Keeping Integration Straight, looks at anti-patterns around your integrations with other systems. The first part of the chapter looks at anti-patterns around the integration landscape and integration patterns. The second part looks at what can go wrong in the design and use of interfaces, and the third zooms in on problems with particular integration styles such as event-based architectures and batch transfers. As always, we end the chapter by distilling the key takeaways.
Chapter 7, Keeping the Development Life Cycle from Going off Track, looks at anti-patterns related to areas such as development process, governance, and DevOps. We will start by tackling a few significant process-level anti-patterns and then move on to a couple that deal with DevOps and packaging. Finally, we will tackle a common and very unfortunate anti-pattern related to testing. At the end of the chapter, we will summarize the key takeaways for real life and the CTA Review Board.
Chapter 8, Communication without Mistranslation, deals with anti-patterns centered around the way you communicate architecture to different audiences. The first part relates to anti-patterns that relate to information control. Then we look at a few anti-patterns that relate to the clarity of your communication. Thirdly, we look at an anti-pattern specifically about the way you create architectural artifacts. As we’ve been doing all along, we will end the chapter by summarizing our key takeaways.
Chapter 9, Conclusion, gives a broad overview of the content of the book, including the overarching takeaways from the preceding chapters. It then explains how you can use the anti-pattern method and perspective in your own work to improve your architecture skills. Finally, it gives you pointers on how you can go to progress further in this direction.
To get the most out of this book
This book is intended for anyone who has a stake in making Salesforce projects successful. While some of the technical chapters will make assumptions about general technical knowledge and experience, the only real precondition is a general knowledge of and interest in the Salesforce platform.
Download the color images
We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/xGcuB.
Conventions used
There are a number of text conventions used throughout this book.
Any command-line input or output is written as follows:
@isTest
class dummyTest{
static testMethod void notRealTest(){
//assume A is a class with two methods
A aInstance = new A();
aInstance.methodA();
aInstance.methodB();
//nothing is done to test anything
}
}
Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: When building custom solutions on Salesforce, you will generally be using Apex, an object-oriented language closely related to Java. That means you should be following good object-oriented analysis and design (OOAD) practices if you are proposing to build anything non-trivial on the platform.
Tips or important notes
Appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form. Any errata related to this book can be found at https://github.com/PacktPublishing/Salesforce-Anti-Patterns.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Share Your Thoughts
Once you’ve read Salesforce Anti-Patterns, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.
Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.
Download a free PDF copy of this book
Thanks for purchasing this book!
Do you like to read on the go but are unable to carry your print books everywhere?
Is your eBook purchase not compatible with the device of your choice?
Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.
Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.
The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily
Follow these simple steps to get the benefits:
Scan the QR code or visit the link below
https://packt.link/free-ebook/978-1-80324-193-7
Submit your proof of purchase
That’s it! We’ll send your free PDF and other benefits to your email directly
Part 1: Technical Anti-Patterns
Part 1 will teach you how to identify and mitigate anti-patterns in the technical domains of system architecture, data architecture, and security architecture.
This part has the following chapters:
Chapter 1, Why You Need to Understand Salesforce Anti-Patterns
Chapter 2, How Not to Mess Up Your System Architecture
Chapter 3, How Not to Get Confused about Security
Chapter 4, What Not to Do about Data
1
Why You Need to Understand Salesforce Anti-Patterns
Salesforce anti-patterns tell us about the kinds of systematic mistakes that make their way into many Salesforce projects, mistakes that can even seem like a good idea at the time of implementation but end up having serious drawbacks in the long run. We will learn the most common of these mistakes and how to think about them throughout this book. However, to do so, we must first really understand what anti-patterns are and how understanding them can help us architect and design better systems.
In consequence, this chapter will start by explaining what anti-patterns are by going through a number of different definitions and ways of looking at them. You will then learn how they can help you deepen your understanding of architecture by knowing how these common mistakes are made and how they can seem like a good idea at the time. We then finish the chapter by explaining the book and the ways in which you can approach the content.
In this chapter, we’re going to cover the following main topics:
Understanding anti-patterns
Where do anti-patterns come from?
How can anti-patterns deepen your architecture skills?
Learning about anti-patterns from an example
Understanding anti-patterns
Most developers and architects will be familiar with the concept of a pattern – a good solution to a recurring problem within an architectural domain described in a formalized and reusable way. Some classic examples include the following:
Singleton: A software design pattern that limits the number of instances of a given type to one.
Fire-and-forget: An asynchronous integration pattern that sends off a message from a computational context and proceeds without waiting for a response.
Model-View-Controller (MVC): An architectural pattern that divides an application into three tiers with specifically defined responsibilities:
First, a model maintains the state of the application and is responsible for any changes to data
Second, a view shows a particular representation of that model to an end user via some interface
Third, a controller implements the business logic that responds to events in the user interface or changes in the model and does the necessary mediation between the view and the model
This pattern is shown in the following diagram:
Figure 1.1 – MVC pattern diagramFigure 1.1 – MVC pattern diagram
Patterns such as these have been defined at many levels of abstraction and for many different platforms.
References
You can look at the following resources to get a good introduction to the various patterns that one can apply from a Salesforce perspective.
The integration patterns guide lists all the main patterns to use when designing Salesforce integrations: https://developer.salesforce.com/docs/atlas.en-us.integration_patterns_and_practices.meta/integration_patterns_and_practices/integ_pat_intro_overview.htm. In a Salesforce world, this may be the most commonly referenced set of patterns as they are ubiquitous for integration design.
The book Apex Design Patterns from Packt, by Anshul Verma and Jitendra Zaa, provides patterns at the software design level and the concrete code level for the Apex language.
The Salesforce Architects site, while new, contains a range of patterns across domains, from code-level specifics to reference architectures and solution kits to good patterns for selecting governance: https://architect.salesforce.com/design/#design-patterns.
The point is that we have lots of good patterns to choose from on the Salesforce platform, many that are provided by Salesforce themselves, others by the wider community. Many patterns that apply to other platforms are also relevant to us and we learn much by studying them.
But this is a book about anti-patterns, not patterns. So why am I starting with a discussion about patterns? It turns out that the two are nearly inseparable and originate in the same tradition. Understanding anti-patterns, therefore, begins with an understanding of what a pattern is. Indeed, one common form of anti-patterns is a design pattern that has been misapplied. We will explore this in the next section.
From pattern to anti-pattern
The design pattern movement in software architecture originates from the work of Christopher Alexander, an