Book Image

Learning Apex Programming

5 (1)
Book Image

Learning Apex Programming

5 (1)

Overview of this book

Table of Contents (17 chapters)
Learning Apex Programming
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Chain reactions


By definition, the unexpected is hard to prepare for. When given business requirements, it's always for the expected use case. Rarely is one told what should happen when rules are not followed. Less often are you given requirements that take into account the code from previous requirements or possible future ones. You could spend all your time refactoring your code, but most of us have deadlines and other responsibilities to meet. Add in possible changes of staff, pressure from management, and too many late nights and you'll take the easy way out and just write code to meet the current requirements.

We've worked with many clients who have large code bases that are not documented, not understood, and sometimes not even used. Excess code is not a good thing, especially as our Apex governor limits restrict how much can happen in any given transaction. Let's say that you already have at trigger that updates contacts when an account is updated (similar to the one we worked on in...