views:

596

answers:

7

I have a project that is currently all over the place and i'm thinking of making it MVC.

The problem is that the system is currently being used and I can not change the interface (It's in frames :s) Also there are certain things that I will need to handle myself such as password generation, login and user levels.

I already have the model side down of the MVC so I am wondering is it worth using a framework like Zend Framework or CakePHP or just to code my own View and Controllers to work around this problem?

I am going to have to work this in slowly and I'm not sure if i will be able to do that if I use one of the ready made frameworks.

+3  A: 

You will find CakePHP in particular to be quite "invasive". IMHO for this you should use a lightweight framework or write your own. I don't normally advise writing your own for this kind of thing but when you're dealing with software you can't change it can sometimes be the best solution. Also, a controller in PHP is not a hard thing to write so you can sometimes end up unnecessarily overcomplicating the solution if you use a prefab solution that's either too heavyweight or just not a good fit for your current constraints.

For lightweight MVC frameworks I highly recommend CodeIgniter.

cletus
Thanks, I won't be given any time by the powers that be to do this so I think i'm gunna have to phase/sneak it in :P Never used CodeIgniter but i know it will be easy to pickup
xenon
+3  A: 

Wheel reinvention is bad. Use a tried and tested framework like Zend Framework unless you have a really, really special reason not to.

karim79
Dependencies are bad. Use a tried and tested framework you developed, unless you're ok with depending on an external framework's whim.
Andomar
True, but frameworks like ZF can be viewed as a collection of independent packages, dependencies issues are likely to be of less significance than, say, CakePHP
karim79
I am thinking more ZF than CakePHP as cake's features seem to be harder to customize (but then again it's rapid development framework so i'll let it off)
xenon
+6  A: 

Normally I would recoil in horror and advise against bringing yet another web MVC framework into the world, but it's fair to note that our hosts Joel and Jeff have another opinion on the matter:

From Joel: In Defense of Reinventing the Wheel From Jeff: Don't Reinvent the Wheel

One last thought: If it's a one-person project, then you only affect yourself with this choice. My resistance would spike up if a team developing a long-lived product was involved. You may do a disservice to the team and the customer if you roll your own.

duffymo
This is a fair point. It is currently only me maintaining and coding it but I am mindful of future coders working on it which is part of the reason I'm refactoring the code ( the other is that its ridiculously hard to maintain )
xenon
Fair enough, xenon. +1 from me.
duffymo
Oh, and thanks for the links btw :)
xenon
You are most welcome. Thank our hosts. 8)
duffymo
+5  A: 

I wrote my own MVC framework for Coldfusion because the current "flavour of the month" Mach-II was horrendously slow. After switching my page generation time dropped from 2-5 seconds down to 9 milliseconds.

Over the last 3 years I've developed this framework into a rival for any commercial or open-source framework I've used (and I've used quite a few) by building in function libraries and components for a range of common tasks (CMS, CC processing, Image manipulation, etc..)

Although there was no doubt some "re-inventing the wheel" the wheel I ended up with was exactly what I need to do my job. I understand how it works with an intimacy that no documentation could ever provide.

Of course, one day some future programmer may be cursing over my code wishing a pox on me for not using their favorite library - but frankly - I just couldn't care less. I wrote it for ME, it does what I need and it does it well. I also learned a lot in the process.

Having said that you are NOT automatically doing your customers/co-workers a disservice by writing your own framework. Public frameworks tend to have no real direction so they tend to bloat massively trying to keep everyone happy. This bloat means more to learn, more that can go wrong. Your framework will be meeting a much smaller set of requirements and with good documentation could be a lot easier to understand and setup than a more established public one.

I say go for it, live on the edge a little. Maybe in 5 years you'll release the next "Mach-II" or whatever and we can all bitch about it.

SpliFF
+1  A: 

It depends on your task. Some trivial tasks already have exellent solutions, but sometimes it's harder to fix bugs or to fit a solution for your needs than to write the own one.

Anyway when you start using a framework - you have to spend some time to learn it. And sometimes writing is faster than learning.

Just google about solutions you need, find some mature, look at their functionality, read open bugs and decide if you want to use it. That's all I can tell you without detailted task.

Jet
+1  A: 

The problem is that the system is currently being used and I can not change the interface (It's in frames :s) Also there are certain things that I will need to handle myself such as password generation, login and user levels.

I am going to have to work this in slowly and I'm not sure if i will be able to do that if I use one of the ready made frameworks.

Not knowing the details of your situation, I'd say that the fact that the system is currently running would make a general purpose MVC framework difficult to integrate.

Having said that, many MVC frameworks are composed of modular components that can be used as stand-alone entities. You may be able to pull off certain features of those frameworks for use in your project.

User authentication, session management, and password handling is one area in particular that should only be built from scratch if you have a great deal of experience in that area.

Rich Apodaca
The user auth and session management all works at the moment, i just need to refactor it. I would need to modify the framework to handle the way my application auths
xenon
A: 

Developing a framework is not an easy task, by the way, you should code, test, patch, more test and develop new features constantly. So if you aren't going to make it open source, which will we a good idea for having a huge community of testers-developers, you should not think about reinventing the wheel. It's round, it spins well, so choose the best one that fits your needs and take profit of some months of coding and testing of the community.

Best wishes