DEV Community

Cover image for Micro Context Switching
Tracy Gilmore
Tracy Gilmore

Posted on

Micro Context Switching

NB, These are the mental rambling of an aged software engineer and AI-sceptic.

Writing computer code is a little like writing a well considered letter/document. In both cases we plan what we want to say, we have to consider that text in the micro (each statement/sentence) and the macro (the document/application as a whole.) But AI interference, I suspect in both cases, disrupts the thought process.

We used to say ‘software developers are not paid to write code, they are paid to think and solve problems’. This remains true even in these days of AI, perhaps even more so. But typing in code is itself part of the thought process and therefore the problem solving. Some might say the code is the ultimate expression of the software design process.

However, AI tools embedded in the Integrated Development Environments (IDEs), whilst some might find them useful, can be a serious distraction and disrupt the thought and coding process.

Before, or after disabling the AI tools, the process was easier. After studying the brief (task description) and considering candidate solutions, you start reading the code looking for the touch points. Identifying what code needs to be removed or changed and building a mental map of the code needed to effect an appropriate solution. You might not set out with a single solution in mind, expecting the existing code to inform your judgement.

This follows the observation “plans seldom survive first contact with the enemy.”

As an aside, this is where I find having a comprehensive collection of unit tests really helps. Agreed, as well as making the change, unless it is just a refactor, it is likely to demand a revision of the unit tests, and require more effort. However, you will be glad when a breaking change is trapped by a failing unit test and you realise the change is not a straightforward patch or even a minor change but something that will impact code outside of the unit. A you discovered it before adversely impacting others.

Without AI “assistance” the process is, read the code, understand the code in the context of your developing mental model and the solution you are applying, make the necessary changes, repeat. A unidirectional feedback loop that delivers a dopamine hit.

With AI, I find that flow is disrupted. Read the code, understand it, start making the change and bang! Your thought process is distracted by a suggestion from the AI you did not ask for. Some might say, you did ask for it by typing in the code, I disagree. The feedback loop has now become bidirectional.
It is like working with a bad pair-programmer who keeps taking the keyboard away from you and enters code you don't recognise.
You have to regain composure, read the suggested code, which to be fair might be as good and sometimes better than what you were going to write, evaluate the suggestion aside your mental model before accepting or rejecting it.

“Now where was I, and so much for me expected dopamine hit.”

The mental disruption is worse than a colleague tapping you on the shoulder for a coffee break, which can actually be beneficial when struggling with a problem, or a notification pinging up on the screen informing you of a new email or pending software update.

The AI is relentless and insistent that it knows your thoughts better than you. It might be right but surely it is my right to maintain and apply those thoughts in my own way. After all, that is what I am being paid for isn't it?

Please let me use my brain before it starts to atrophy or rot from reviewing AI-generated code.

Top comments (0)