This week I started to have a look how AI can be used for maintaining and extending existing code. I was planning to make a short getting started course which as a result should show a proper revenue/expense report. There I found out that when you start using the system in the middle of an accounting period, the report does not show correctly. Further I saw that the 2 other accounting reports in the same function were not yet upgraded top the new layout using floating action buttons.
I am using VsCode at the moment where co-pilot is integrated. I like to avoid MS as much as possible so was looking for other LLM systems. I think Anthropic, the originators of MCP would be a good choice to start with. After some research i found the 'Cline' extension which allows various LLM models to integrate with VsCode.
After getting an admin & code API from the Anthropic console app, i started my first function request to change the balance_summary_list.dart. There is a time period dropdown to select the accounting year by default. Further with the buttons 'Q' 'M' and 'Y" can be changed to quarter/month and back to year. change the screen by replacing the dropdown and Y,Q,M with floating buttons with the same functionality.
After implementation i also requested that on the same file to add the functionality to select previous years not just the current year and check if data for the requested year exist when not show a message.
After a couple of minutes the LLM confirmed the work what was done, a button for viewing the changes and a button to restore.
The balance sheet was the easiest to do, the prompt: all the changes you made to the balance summary, do the same to the balance sheet in file flutter/packages/growerp_order_accounting/lib/src/accounting/ledger/views/balance_sheet_form.dart did the trick
The revenue report was more difficult and AI just responded after a ling time spending a lot of tokens with no result. Here i had to make the changes manually.
These where my prompts i used to make the screens layout more consistent.
in the balance summary in flutter/packages/growerp_order_accounting/lib/src/accounting/ledger/views/balance_ summary_list.dart there is a time period dropdown which by default shows the year and by the two buttons 'Q' 'M' and 'Y" can be changed to quarter/month and back to year. change the screen by replacing the dropdown and Y,Q,M with floating buttons with the same functionality
the program atflutter/packages/growerp_order_accounting/lib/src/accounting/ledger/views/revenue_expense_chart.dart currently shows the result of the business by year. a floating action button need to be added which shows the data by year/quarter/month this button also makes the period drop down selection change by y/q/m
In the file flutter/packages/growerp_order_accounting/lib/src/accounting/gl_account/views/gl_account_list.dart the floating action buttons are relative to the top left of the screen, change it to be relative from the bottom right
I checked the result and found that the LLM implemented a function better as I did: putting the floating action buttons positioned relative from the bottom/right of the screen, which is better than what i did on other screens to position relative to the top left. The advantage that this positioning will work better on both mobile and desktop.
I asked AI to make the change from top/left to bottom/right in all other screens (about 6) which worked very well. Even the variable names which were used, were also renamed.
Relative easy work can be done by AI reliably, although the code still has be reviewed and understood.
Further it helps to get a big task to cut in smaller pieces which will work better and are easier the review.
As mentioned and is the case in any code review: you can learn from the code to be reviewed.
Do not try to help the LLM in the middle of a task, it will create confusion. if you think you can do better, cancel the task, modify the files and start a new task.
I also realized prompting is really important, the more precise, the closest the result is to what you want.
I used the Cline plugin which is downloaded more than a million times, unchanged.
In order to improve the used LLM it is possible to include system related information and project organization into Cline. See the Cline documentation or More information here
The final commit to the GrowERP system you can find here: https://github.com/growerp/growerp/commit/bfeeec460ae9b46bf1b24856b4870a70b740fcdd
If you found this article valuable, don't keep it to yourself -- spread the word! Share it with your friends, family and colleagues and let's inspire more people to create business applications!
No posts

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.