What are your tips for keeping track of variables in complex data flows?

Posted by rainyengineer@reddit | ExperiencedDevs | View on Reddit | 11 comments

I’m on a new-ish team where we have a lambda that should really broken into smaller pieces and a part of a larger step function. Unfortunately, we probably won’t be allocated time to do so. It started out smalls but over time we added more and more services, api calls, orchestrators, and now we have some monstrous code.

It’s become quite difficult to follow what the values of the variables are behind the scenes as I’m working on it (they’re all usually some hefty json). What also doesn’t help is that I’ve always been a visual learner. I envy the engineers that can just ask where something comes from and remember it forever. I need to see it and diagram the more complex repositories to understand them fully which can be time consuming and seen as wasteful.

How do you prefer to stay on top of knowing what exactly the expected values are from one method call to the next in spiderwebs of code? I log the json to CloudWatch which helps, but that can get costly and make the logs noisy. Do you maintain really detailed doc strings of the expected json response bodies/variable values? Do you put sample values in the if name = main for local run and debug?

I’ll take any tips or advice you have for me. This is an area I want to improve upon because it’s holding me back as an engineer.