9 ms·
I used to work on a 15 year old PHP codebase. Everything was mixed in the same file - PHP, SQL, CSS, JS… These are some things we did Start using Git Start do
by akudha 4y ago
I used to work on a 15 year old PHP codebase. Everything was mixed in the same file - PHP, SQL, CSS, JS…
These are some things we did
Start using Git
Start doing code reviews, for newer code
Only refactor as needed. Don’t rewrite, it will likely end in disaster (we tried and failed)
Start deleting dead code. If you’re paranoid, comment it out for a few releases, before deleting
It is all about ROI - for example, removing inline CSS might be good practice, but does it really matter that much in your codebase? Maybe there are better things to do.
Even when refactoring, try to do it in stages. For example, simply splitting a large file into two or more files, without changing the code too much might be a good start.
For any new code that is being written have strict code reviews and rules in place, so past problems aren’t repeated