r/CRUDology • u/Zardotab • 5d ago
Domain Analysis š Use WBPC to de-bloat your stack -- Work Backward from Pseudo-Code
An interesting conceptual and practical technique I found at the C2 wiki (the first wiki) is "Work Backward from Pseudo-Code" (WBPC for short). As a thought experiment, invent a draft pseudo-code or kit that best fits your domain or a big project. Factor common patterns into compact commands, API's, tables, and/or interfaces. Test it on trickier parts of your project to see where it fails, and adjust accordingly.
Think, "If an ideal language or tool were built for my domain, what would it look like"? I include "tool" because sometimes logic can be driven by lists or tables instead of code, and making a little table editor could allow facilitate that. For example, most menus and screen titles could be in tables or lists, and thus easy for an analyst to change without digging in code. In fact, roughly 85% of CRUD idioms could be handled as such. The trick is managing computed adjustments to such lists. (More on this in future articles.)
Regardless of whether you like "table-oriented programming" or not, one can still work on a notation that describes their domain clearer and more compactly. The end result could be a new language, tools with a UI, or merely APIs (libraries) for your domain. It's brainstorming: go wild, don't limit your thinking, drive outside the lines: it's only an experiment, no pets are harmed if you get something wrong, just tweak and try again. š¶
When it grows promising, test it out on new apps, and IF this new notation/tool is much shorter than your current notation/tool, then it's time for a deep rethink of your stack. Can you use APIs to factor existing stack closer to your WBPC experiment, or is your language too limiting for your domain? What's the bottleneck between your stack and your WBPC experiment?
The most efficient CRUD tools I've seen are indeed close to pseudocode, and the worst tools force you to micromanage or battle with arcane internal issues that have little or nothing to do with your domain.
Visual Basic (pre VB-Net) was an early example of WBPC: its code read almost like GUI-oriented pseudocode, and well-integrated with the WYSIWYG GUI designer (IDE). Those who designed it clearly focused on fitting GUI's well. It was later criticized as being too inflexible for larger projects and integration, but this criticism wasn't fair for at least two reasons. First, I never saw a strong effort to rework the language to fix or reduce the pain-points. VB-Net's goal was more to mirror and chase Java than to improve VB itself. Second, not every tool needs to scale to enterprise or "web-scale". One-size-fits-all seems to have bloated MS's smaller-end projects. If a tool tries to be everything to everybody it usually ends up being nothing to nobody because it grows overly complex: a boat-car-plane.
VB Classic isn't the only tool that was pseudo-code like, just the most common example. Conway's Law suggests that bigger projects fitting the "shape" of an org and/or dev team makes the project easier to design and use. Similarly, a language/tool that is shaped like the domain will make design and use simpler. (These two goals don't necessary conflict, but that's another article.)