Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
No function should be longer than what can be printed on a single sheet of paper in a standard reference format with one line per statement and one line per declaration. Typically, this means no more than about 60 lines of code per function.
For example the showInputField function in commonObject has several functionalities which can be separated to be modified by inheritance :
setparamstype,
setmorecess,
setinputsoptions
addinput, (can be externalized into a specific function file)
get boolean input,
get chkbxlst input,
get sellist input,
...
Use case
I my case,
I have to implement a new feature into commonObject
(add a dependence filter with filed A that filter field B)
To do it, I have to inherit commonObject and copy and past ~800 lines of code of showInputField to simply add my own functionnality of 10 lines inside...
if the functions where separated, you only have 20 lines (set of variables and call of functions) and insert the required function or code between or override the function that need to be changed.
Suggested implementation
No response
Suggested steps
Define the global and specific functions that have a big win to be refactorised.
Feature Request
As a developer, it is difficult to understand and maintain the code when it is too long. NASA’s ten coding commandments N°4:
For example the showInputField function in commonObject has several functionalities which can be separated to be modified by inheritance :
Use case
I my case, I have to implement a new feature into commonObject (add a dependence filter with filed A that filter field B)
To do it, I have to inherit commonObject and copy and past ~800 lines of code of showInputField to simply add my own functionnality of 10 lines inside...
if the functions where separated, you only have 20 lines (set of variables and call of functions) and insert the required function or code between or override the function that need to be changed.
Suggested implementation
No response
Suggested steps
Define the global and specific functions that have a big win to be refactorised.