How to proper organize 28K lines of code?
Posted: Sat Jul 06, 2019 12:00 pm
Hey all,
So i made administration software with PB with at least 28.000 code lines. I did make new features/bugfixes to it the last 3 years, but its getting harder everytime when i maintenance the code.
Now my plan is to make a version 2.0. To fix all my mistakes i did with version 1.
i already have a list with things i want to fix with the rewrite, but theres something i cant get my head around it, in pseudo code i did the following::
GUI layout is a panelgadget with 8 tabs, every tab has its own include file, separated in macro's for: global vars, procedures, GUI and last macro for menu case's
Every panelgadget tab include file has this layout:
then in main.pb i have:
; startup:
constants, globals, includes, etc (not included in a macro)
- then macro's for all the global vars from all the includes
- after that i have all the macro's for procedures
then i have the 'If openwindow' code lines
- after that i have alle the GUI macro's in their tabs in the panelgadget code
- after that there is the 'repeat until' code with all the macro's from the cases for the GUI
Why did i do it this way? Well, i have relative small code in my main.pb and the rest of the code is separated in their own included file.
Now my questions are:
- Was above a good plan after all?
- Can i do the same as above but without all the macro's?
- What is the best practice to organize long code as this?
- How do you do your code in big projects?
Any insight will help!
So i made administration software with PB with at least 28.000 code lines. I did make new features/bugfixes to it the last 3 years, but its getting harder everytime when i maintenance the code.
Now my plan is to make a version 2.0. To fix all my mistakes i did with version 1.
i already have a list with things i want to fix with the rewrite, but theres something i cant get my head around it, in pseudo code i did the following::
GUI layout is a panelgadget with 8 tabs, every tab has its own include file, separated in macro's for: global vars, procedures, GUI and last macro for menu case's
Every panelgadget tab include file has this layout:
Code: Select all
macro GloablVarsTab1
; all the global vars of Tab 1
endmacro
macro ProceduresTab1
; all the Procedures of tab 1
endmacro
macro GuiTab1
; all the GUI of tab 1
endmacro
macro casesTab1
; all the cases of tab 1
endmacro
then in main.pb i have:
; startup:
constants, globals, includes, etc (not included in a macro)
- then macro's for all the global vars from all the includes
- after that i have all the macro's for procedures
then i have the 'If openwindow' code lines
- after that i have alle the GUI macro's in their tabs in the panelgadget code
- after that there is the 'repeat until' code with all the macro's from the cases for the GUI
Why did i do it this way? Well, i have relative small code in my main.pb and the rest of the code is separated in their own included file.
Now my questions are:
- Was above a good plan after all?
- Can i do the same as above but without all the macro's?
- What is the best practice to organize long code as this?
- How do you do your code in big projects?
Any insight will help!