elephant PHP

How to Start Working on Inherited PHP Disaster in 5 Steps

Often times it happens in the life of php software development specialists that their managers assign them somebody else’s project nobody wants to take. Why? Because everything’s awfully messed up there and it seems you’ll never make it work.

But who is the big php development guru setting to work any software if not you? All you need is just some advice to get you up and running with it.

What’s wrong?

The most terrible PHP project a developer may inherit has certain characteristics that make it a real programming chaos. Usually they are the following:

  1. The original developers aren’t there anymore.
  2. The code supports no version control.
  3. Development and testing of the project were both done on live server by editing and renaming PHP files. Also there are lots of copies of the same files and no way to understand which of them are actually being used.
  4. Many files have other files included into them and these multiple inclusions are messing thing up very much.
  5. The project has been handed over across many developers, each with his own way of coding.

How to make it right

To start working on a project like this, first you need to get everything in order.

Here are 5 steps we recommend that you take to ensure this:

  1. Version control. It’s imperative that you get that project into version control disregarding how messy it is. Even if it works somehow and you break anything, you’ll need to go back to that working state, or just compare your changes with it to at least understand what went wrong. It’s necessary to do small and frequent check-ins while refactoring to have then less code when you have to roll back.
  2. Database. Ensure everything in it is relatively normalized, columns are named clearly, etc.
  3. PHP code. If that code is likely to take too much patchwork, it makes sense to fit it to some framework. I recommend that you choose Symfony or CakePHP as they have a way of separating concerns which makes it easier to decide where each piece of code should go. This isn’t a simple thing to do, but once it’s done, you are already halfway to a fairly constructed app. Besides, test facilities built in a good framework make it far easier to refactor your code, too. Before changing some piece of existing functionality, write a test covering it which will let you know if you broke anything afterwards.
  4. Cleaning up.With you database sorted, model code in models, and controller code in controllers, it’s time to take care of such presentation-level stuff as standardizing things on a single AJAX/JS library, and cleaning up CSS.
  5. Development environment. Finally, you should set up your local development environment. Use turnkey WAMP packages or install to a virtual machine like Linux Box or VirtualBox. You also need to get a separate integration testing environment which would mimics your live server. Ensure that he live server is used only for running live code.

Have you ever come across the same problems? What did you do?

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

    Facebook Comments

    comments

    'How to Start Working on Inherited PHP Disaster in 5 Steps' have 1 comment

    1. Author Image

      July 30, 2014 @ 11:02 am Winterly

      OMG, is it even possible fix such an awful project? I’ve been in this exact situation you’re describing and I quitted ’cause this whole fixing campaign would take me months! But your tips have definitely made it clear how to at least start. I guess I lacked some sort of guidance like this at that time.. Thanks!

      Reply


    Would you like to share your thoughts?

    Your email address will not be published.

    Software development and outsourcing blog by QArea © 2016

    Яндекс.Метрика