Reverse Engineering My Brain #Python
Working on a feature that needed to be done, like every other one right?
The logic was inherited and reflected the long winding path an ORM points the user towards to save writing a SQL query. The details are not important beyond a few facts:
- A lot of foreign keys
- Use of Generic Foreign Keys
- Use of Mixin
- A trail of tears as features are pushed on previous decisions where they are not entirely welcome
It was understood that an impasse was reached. Each analysis of the problem seemed to solicit the same wrong solution or misunderstanding.
The decision to step away felt right but was not working. Mentally reviewing the issue was not helpful. Repeatedly hitting the same incorrect conclusions even AFK is frustrating. The cycle was nearly impossible to stop, like a bad song stuck on repeat in the brain.
Key to the solution was the decision to reverse engineer the problem and approach. The core contemplation was simple as the brain needed to come in at a different angle and add some new features.
How can I solve this problem using a different tool kit?
With the current machine in use for throwing shit at the wall being neither fast or simple to operate the pivot was key. In the new approach the opportunity to streamline the dev cycle was available.
TDD was chosen, the problem needed a much more empirical approach as well as a controlled environment. TDD is a personal fav BTW.
With the addition of TDD on a simplified script the problem began to unravel very quickly. The initial 6+ hours of no results led to the solution coming together in under an hour. All of this was via a perspective change moving to a simple TDD script moving out of the greater application.
Next time the problem starts to grind change the approach used. Consider a pivot on tools, methods, and environment. And above all, when shifting try to simplify things!