Skip to main content David Edelstein's Blog

Pega and "Signs that you're a bad programmer - Software Engineering Tips"

Published: 2011-10-20
David Edelstein

1. Inability to reason about code

  1. The presence of “voodoo code”, or code that has no effect on the goal of the program but is diligently maintained anyway (such as initializing variables that are never used, calling functions that are irrelevant to the goal, producing output that is not used, etc.)
  2. Executing idempotent functions multiple times (eg: calling the save() function multiple times “just to be sure”)
  3. Fixing bugs by writing code that overwrites the result of the faulty code
  4. “Yo-Yo code” that converts a value into a different representation, then converts it back to where it started (eg: converting a decimal into a string and then back into a decimal, or padding a string and then trimming it)
  5. “Bulldozer code” that gives the appearance of refactoring by breaking out chunks into subroutines, but that are impossible to reuse in another context (very high cohesion)

Pega makes doing all the above nearly required because of inconsistent libraries and reference frameworks that are not-editable. This makes the entire PRPC application stack hard to reason with.

1. The built in Pega code is opaque enough that if you don’t copy something that exists and works, it is not terribly likely that your new code will.

1. If you want to change something in an inherited framework (broken/missing feature), you are essentially copying and pasting to your layer and tweaking small bits. The stuff you don’t touch might as well be voodoo.

3. Error handling is hard so many inherited pieces of code do not do it properly.

4. Work -> Data -> Int -> Data -> Work for integration

4. Also, date processing. enough said

5. Big activities/flow are hard to read, so split them into smaller ones that only could ever be used from one place. The fix is to not write big activities, but since most projects are against other peoples code, this is not an option and refactoring is hard!

To the credit of Pega, the other bad practices are not encouraged quite as much. So to all of this, I say, “it’s not my fault!”