I\'ve just been assigned a large project. The client has had multiple developers
ID: 649453 • Letter: I
Question
I've just been assigned a large project. The client has had multiple developers across different companies working on their (intended to be) large, MySQL driven eCommerce site.
The DB schema is ...pretty good, naming is a bit rendundant but nothing real bad.
The real issue is the code is in desperate need of "OOP-ification". Sadly, while actually being fairly nice procedural code as far as simplicity and legibility, there are so far about 3 functions across...about 50 files. :( Thankfully these are handling database connection but there's not a single function, class or even a foreach anywhere in site that deals with page rendering.
All static using implicitly defined php variables and some js. Tons of reduncy and inconsistent use of code vs. html. File/directory structure is probably the worst of all :/
The client very very much needs a custom CMS, especially for inventory control. Dynamic page generation is a must but I doubt they will want me to start over.
So I ask: is there a point of attack that will make transforming this code into a more straightforward task?
Explanation / Answer
Funny, I just answered something similar to this in this thread.
In a nutshell, the client won't care what the code looks like so really, you shouldn't either.
I would highly suggest developing new features using today's OO standard approaches and only refactoring legacy code when absolutely needed.
If the client wants to pay you for refactoring time further down the road (or you just want to take the time yourself), then have at 'er. But, I assume they're not paying you for that - they're paying you for additional features.
Whenever you refactor code, there's always the possibility of introducing knock-on bugs. If you're refactoring code just for the sake of refactoring and the client finds problems in the output, you're going to have to answer some tough questions as to why you did it (and again, management and clients don't care that the code looks better or is easier to work with).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.