Logic Update Overview
As an application grows, situations arise where existing business rules need to be changed or performance improved. Logic Update is the process of delicately refining logic to meet new requirements while maintaining the context of existing code. Prometheus AI supports updates that minimize side effects by identifying existing code dependencies.Main Update Scenarios
The following is the process of updating the ‘Popular Post’ logic, which previously only considered view counts, to include date conditions.-
Convey Change Requirements: Clearly present the direction for modifying the existing logic.
Prompt: “Update the existing popular post logic. Now, I want to display as a popular post only if it’s among ‘posts written within the last 7 days’ and the view count is 50 or more, in addition to the total view count.”
-
Code Analysis and Modification: The AI reads the existing
BoardServicecode throughread_fileand proceeds with the update safely by adding date comparison logic. -
Request Performance Optimization: If the logic becomes complex, you can request performance improvement together.
Prompt: “Modify this logic by considering indexes or optimizing queries so it doesn’t put a load on the database.”
Process for Safe Update
- Current Logic Analysis: The AI first analyzes the currently implemented logic and its connected dependencies (Method calls, DB Tables, etc.) through
read_file. - Planned Changes: It suggests the
view_difftool to show the user the lines of code to be modified in advance and get approval. - Incremental Application: Rather than modifying too many files at once, it’s safer to update files containing core logic one by one.
- Regression Testing: After the update, verify if there is any degradation in functionality by checking if existing test codes still pass with
run_terminal_command.
💡 Logic Update Tips
- Specify ‘Before & After’: If you give instructions by clearly contrasting them, such as “It used to work in method A, but now change it to method B,” the AI grasps the scope of modification more accurately.
- Ask About Impact Scope: Before fixing the logic, ask the AI, “If I modify this logic, what other files will be affected?” This can prevent unexpected errors in advance.
- Use Backup Instructions: When fixing important logic, secure a recovery point by requesting, “Leave the existing logic as a comment and write the new logic.”