Skip to main content
K. Trlb ha fatto una domanda in Education Data Architecture

I understand the tradeoff that Table-Driven Trigger Management (TDTM) makes between modularity and efficiency.

 

As my Programming 102 professor said, "If you want to solve a problem more easily, add a layer of abstraction.  If you want to make a program run faster, remove a layer of abstraction."

 

In studying up on HEDA, I'm reading about TDTM at https://powerofus.force.com/articles/Resource/HEDA-Manage-Trigger-Handlers and feel a little stab in my chest when I see separate helper classes for each business process (an entire helper class just to manage "Do Not Contact" preferences?!).

 

  • Yes, it's very readable.  But ouch, that's a lot of passes over the same "Trigger.new."
  • No, it's not very "readable" to have every imaginable thing that could ever need to happen to a given Contact record in "Trigger.new" in one big "method" separated by nothing but "if newc.a == m, do x; if newc.b == n, do y; if newc.c == d, do z..." with nothing but comments and whitespace to help you keep track of what's responsible for what.  But my my my, does it feel good to get those "CPU Limits Exceeded" numbers down.

 

So ... devs who prefer monstrous one-pass-over-"trigger.new"-per-object-if-you-have-anything-to-say-about-it style but work in HEDA orgs ...

 

What has your response been?

 

  • Get over yourself and do a highly modular version of TDTM as demonstrated in the documentation?
  • Bend TDTM to your will by having it never call more than one "helper" per object?
  • Some sort of hybrid?

 

CC @Nonprofit Hub 

14 risposte