Doing the dishes (AKA code cleanup)

Fri, 07/26/2013 - 16:03
Written by
Filed under


This is a great format for demonstrating coding styles, thank you for putting this guide together.  It might be relevant to also permalink to part of the Civi codebase which is exemplary, to help alleviate the issue of people copy + pasting deprecated snippets from the medieval ages.

Sat, 07/27/2013 - 14:23

In reply to by anonymous_stub (not verified)

Thanks to put it up together.

On the same idea, to make the life of integrators easier: 

don't generate html within php, assign all the "potentially useful to customise even if not displayed (eg id)

smarty:Don't put business logic in it, it's only for display, try to use sematic html and put classes and ids

and jquery: wrap everything in a function.

Sat, 07/27/2013 - 14:45

In reply to by anonymous_stub (not verified)

Xavier- I can add those to the table - but would good to have some examples since they are more complex - kind of like what Adam said - maybe links to commits where we refactor bad to good?


Perhaps we could have a competition to get people to provide a patch that implements each of the above as an example (& an improvement). First prize - free accomodation for one week in er... New Zealand (flights not included).