Working with ChatGBT4o and generating a PHP class the longer I worked on the class and added additional functionality the bot was getting over focused on the new functionality in the sense that it dropped much of the previous functionality. I was making good progress until I realized I lost work.
I have issued this prompt which seems to have helped somewhat:
when I ask you to update functionality I want you to compare the new version with the prior version and determine if any functionality is dropped. You have erased several functions from the class.
I also asked it why it dropped functionality, it said:
The issue likely occurred because the updates I made were incremental and focused on specific requests, without fully comparing each update against the previous versions. As a result:
- When refactoring the class to remove
__get
, some functions may have been unintentionally omitted because the focus was on renaming properties and methods rather than preserving the entire set of functionalities. - When splitting out helper functions (e.g., bitwise operations), I may have assumed that some functions were redundant and needed to be in the helper file rather than in the class itself.
- I didn’t do a full side-by-side verification of the updated class against its previous complete state before applying the final update.
How to Prevent This in the Future
To ensure that this doesn’t happen again:
- I will always compare the new version against the prior version before submitting an update.
- I will verify that no existing functionality is lost or unintentionally changed.
- I will highlight any additions or removals explicitly, so you can confirm they align with what you want.
I don’t mind mentoring a digital assistant, but there’s no planet on which I want functionality that isn’t changing to disappear. So, if this behavior of confirming nothing is being lost can be integrated at a higher level that would make using ChatGBT more useful out-of-the-box.