Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

php - Should I use a framework or write my own MVC?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...