We are in process from converting our 10 old system to something more managable.
Most of the stuff we somehow managed to convert to a loose mvc zend 2 based system but there are few... monsters still lurking. We, for example, have one function wich is basically a giant html/php mess. Wich is in base one page of order details bloathed to max.
The code structre is like this
function(){
php alters
php inserts
html code
php code
htm/js code
php code...
html snipets in php variables...
pick a nightmare....
x 5000 times of 8000 lines of code
}
I know I know, kill it, burn it with fire... but we cant. And we have to clean it up step by step.
The question is :
Does someone have an idea How we can make it as a gradual process without breaking the damn thing every monthly release (scrum yaaay) and without killing our self in process??
We use smarty for generating html output and zend2 modules for controllers.
I was thinking including the whole god damn thing in a output buffer and pasting it in a smarty variable and gradually pull the php out of it.
Any input is more then welcome or any literature pointer on pulling spagety php /html apart (I found some documentation but they never handle templating)
Thank you in advance for any advice :)
First of all, this question is too broad, and there is no way that you could have a unique good answer. There is as much good answer as developer on earth. Each of them will propose an advice, a direction to go, but you may not choose to listen them and it will probably just assure you in your decisions you've made.
For me (and I am in a more complex position than you are). I made another application wich communicate with my old code. With a bridge between them. My old code continue to works as expected, and my new code add some functionalities or replace them if it's finished.
I advice you to isolate your old code from your new application because you don't know how many time the new code will be in developpement. You can't take the risk to break your production code with your new developpement or introduce new bugs.
I can continue, and talk about my experience, but it's not the purpose of StackOverflow, like I said your question is too broad.
Edit : From comment I quote
"I have few methods for refactoring, but they are kinda messy."
You get my point. For respecting standards, and avoid to introduce more mess in an application already messy, you have to dissociate your development. There is no miracle. It's like a new version of a Framework like Zend Framework 2. Why do we use semver ? Why do we use versionning, and Break compatibilities etc... We do use those concept because we can't refactor in a maintainable way a procedural application or an old architecture into a respectful OOP approach, design pattern, MVC and so on.
and im only asking about general pointers
That's the definition of "Too broad".
But I agreee with you, it will take abouuut 5 years, even more... But you have a job !