Skip to content

Comment on Ask HN: I just inherited 700K+ lines of bad PHP. Advice?

Comments

1. Put it under Version control. Preferably GIT, You will need a lot of the tools that git and github provide. A private Github account will do but hosted github is what I'd prefer.

2. Get a Test System that has enough horsepower.

3. Create a deployscript

4. Deploy until it seems to work.

5. Start working with CI and static code analysis. You might get lucky when it comes to copy paste code. Copy-Paste detection and Coding Standards come to mind at first but there are a lot more helpers

6. Automatically create some API Documentation. The worst code cant hide what is inheriting from which class etc. Integrate Generation of Docs into the CI.

7. Create some basic so called "Smoke Tests". I'd prefer some very basic Selenium Tests opening the most important parts of the app. This is straight forward. Run them against the APP with error logging turned on on every E_ALL. This error.log is your scary list.

8. Setup Single Builds and try to integrate with More than one Version of Vtiger, PHP and Mysql. Since you have 150 Customers, chance is great that you have 150 different setups.

Note: You havent changed one line of code yet. Sit down with the customer and discuss all your findings and metrics.

9. Start creating different GIT repos with the above process for all the modules that are added by your customer. Integrate with the build and run the tests until you have the same amount of errors like before. start extending the build To build Against your Mysql, PHP Versions

... I could go on forever .. but basically this will get you up and running.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.