Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've decided to completely rewrite a PHP framework (Using MVC) that I've been working on, on and off, for years. My problem up until now was that I would just come up with ideas, throw them into Trac as tickets, and add them later - without worrying about the design of the framework itself. Over time this has caused some problems and I think a rewrite would be helpful, however I'm not sure where to begin with the planning of it - I know I don't want to use Trac, and I know I need more than just tickets and milestones - but what else would I need?

I really want to thoroughly plan this rewrite out, I want to detail every feature I want, where it will go, and how it will connect to every other part - but I have no experience with this level of planning. Any advice? Any programs that will help? I'm getting tired of Trac, I've never really liked it.

I know I'll need a design document, but is there any certain layout I should follow? I'll also need bug tracking, tickets, milestones, etc., but beyond Trac I don't know what's good for that either. I'm sure there's more I'll need but I have no idea what, so any help would be appreciated.

share|improve this question

migrated from stackoverflow.com Sep 15 '11 at 14:19

This question came from our site for professional and enthusiast programmers.

    
why do you want to rewrite it? Why not refactor it in those places that need improvement? When you rewrite something from scratch, chances are you eliminate old problems for new ones. –  Gordon Sep 15 '11 at 13:54
    
@Gordon maybe it is so extremely terribly written that rewriting it is better than refactoring. –  rightfold Sep 15 '11 at 14:51
    
Rewriting is always harder than it seems, and I've learned it the hard way. Oh, well this time I know what I'm doing, so it'll take half as long (then it ends up taking longer than the original because you over-engineer trying to correct or pre-empt mistakes made previously) –  Davy8 Sep 15 '11 at 22:49
add comment

6 Answers

up vote 5 down vote accepted

See below some things I do when developing a big project:

1 - I use a planning tool like OpenProj and add all the features I want to include as a task. For example, right now I am working on a feature to allow my users to automatically log on after they register in my site. I have a task in my plan like "feature-autologin".

2 - I am a one-man development shop so I usually move from one feature to the next. My plan is created in a way that all features are sequential. I don't invest too much time estimating how much time I will need for each feature. I usually consider that each one will take me a day to develop. If one takes more, I simply update the plan and all the future tasks move accordingly.

3 - I use git extensively. Each feature is a branch. Once I complete each feature, I merge it back to the development branch and create a new branch for the next feature.

4 - If I find a bug in the software I create a small git branch to fix it and merge it back once it is resolved. I make sure I update both the development branch and my current feature branch I am working on. By the way the bug becomes another task in my OpenProj plan. Something like "bug-wrong-address". And when I insert it, all the other features get moved back in the timeline.

5 - While I am developing, if I think about a new feature, I simply include it in the plan where I think it will best fit and adjust the timeline again.

I hope this helps. It sounds like you have an exciting project ahead of you. Good luck!

share|improve this answer
add comment

If you are going for a complete rewrite, why not also consider if you should be using php at all? A change/upgrade of technology might be the catalyst you want to improve your design/scalability/maintainability etc...

share|improve this answer
3  
Also, consider existing frameworks may be better suited than creating Yet Another Single-Use Framework. –  S.Lott Sep 15 '11 at 15:22
1  
@S.Lott - what is wrong with creating a single-use Framework if it is tailored to cater for that single use better than any other? –  Anonymous Sep 15 '11 at 15:47
1  
@Chris Bridgett: The world may not need yet another highly-specialized framework. It can be an "attractive nuisance". A fun waste of time. Often, existing frameworks do the job just as well. The "tailoring" in a special-purpose framework often stems from a failure to understand an established, existing framework. Often, existing frameworks are more secure, more reliable and faster. Often, existing frameworks are already debugged. Often, existing frameworks are better understood by other team members. –  S.Lott Sep 15 '11 at 16:06
    
@S.Lott: I'm writing this for several sites that I own, and its design is setup in a way that no other framework is. I also don't plan to release it for awhile, if ever. re: TheLQ: That was one of my first thoughts, however no other web language has the reach that PHP does other than .NET. Python would be preferred, however getting it setup on cPanel servers (Which sadly makeup a lot of the web hosting world), is a pain. –  Jon Sep 15 '11 at 19:58
1  
@S.Lott I've been reading up on Symfony, CakePHP and CodeIgniter since posting, and the number one thing that is keeping me from using these - is that all seem to blindly stick to MVC, and ignore re-usability. My current (And future, if I do rewrite) design is MVC in a single folder (A 'module' folder), with views in there however the user wants (Named example.module.view.php), as well as a themes folder, where designers can create their own themes that override existing views. This is crucial for me, and none of the major frameworks seem to do this without a lot of hacking - that bothers me. –  Jon Sep 15 '11 at 21:18
show 1 more comment

I would suggest to refactor heavily instead

The Problem you anticipate here:

I really want to thoroughly plan this rewrite out, I want to detail every feature I want, where it will go, and how it will connect to every other part - but I have no experience with this level of planning. Any advice? Any programs that will help? I'm getting tired of Trac, I've never really liked it.

is a real tough one. It is basically the Waterfall model with all its uglyness. Here's some anecdotical evidence for the problems with the 'great rewrite' approach, that comes to the conclusion: you will probably not anticipate the problems correctly, and end up with another mess you want to rewrite from scratch. Not because you're bad, but because it's impossible to get something big right in one shot.

When you instead start to refactor, you can write individual tickets and you can continue using the project. The trick here is to identify smaller changes that lead to an overall better design.

For example: you mention, you have no MVC, but you want to. As a first step, you could take a single PHP-file, and, assuming the usual mixup, sort it, so that in the top you have all db-access, calculation, etc, in the bottom you have the "templating" (first tickets, for each file). As a second step, you could encapsulate all these templating parts into functions, that get their parameters passed. (a lot of more tickets). Done? Congrats, you finished your V in MVC.

share|improve this answer
    
I'll take that into account, thanks. Also just to clear things up - I am using MVC right now. –  Jon Sep 15 '11 at 19:59
    
@Jon: Yes, also, my example assumed a typical page, no framework. But i think, mutatis mutandis, my answer is not invalidated by that. A point i did not mention: refactoring is fun. It's very rewarding to see total crap becoming something beautiful :) –  keppla Sep 16 '11 at 8:14
add comment

Consider using an existing framework. CakePHP, Zend Framework, CodeIgniter and Symfony are the known ones for PHP. If they cater the needs of hundreds or thousands of users, I'm sure they can cater yours.

If you're willing to learn/use something other than PHP - Django (Python) and Rails (Ruby) are pretty much the leading frameworks for conventional web applications.

That's, of course, unless you want experience creating frameworks - which, I might add, is of much less value in the market (rather than knowing how to use existing, supported frameworks well).

share|improve this answer
add comment

What I enjoy using is Redmine as a schedule tracker. IT handles each of those items very well, along with being so much more user friendly (in my opinion) than trac.

Regarding your re-write, it's important to first understand you will never anticipate every feature / new extension that can come up, so to try and write your application as flexible as possible. Using many of the MVC frameworks which PHP has can help leverage this; however some of these frameworks also pidgin hole you if your DB architecture isn't flexible from the start (Cake). I would really focus on making things as abstract as you can, and whenever you see something hard coded ask yourself what it's for and why can't it be stored in a DB.

Really DB design helps answer so many questions and issues, and is where I see the main importance of how your application interacts; so I would recommend spending a good majority of time analyzing how the data is stored, and how your DB is structured.

share|improve this answer
add comment

As a issue tracking software, JIRA is great, but it's very expensive. Another good tool that i'm using is Eventum. It's free.

But the most important part is to have a good idea of what you need. First you have to gather the requirements for your application, to have an overall feeling about what you want and as complete as possible.

Based on that you will create software requirements, that is a more technical approach in which you'll describe the modules that will be part of your application, their functions and sub-functions, objects, classes, their interfaces, just about everything.

By know you'll have a good understanding of the complexity of the application and the lines of code needed, so you can make an estimate and create a schedule. It's important to have a schedule and deadline, or else you may end up never finishing it.

Hope it helps

share|improve this answer
    
Jira is very inexpensive for less that 10 users. The cost is $10 and the $10 goes to charity. –  sixtyfootersdude Mar 18 '13 at 14:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.