Once you begin to build a site with a PHP Framework are you locked in from that point forward to have to continue to use such framework?
I have not used a fra开发者_开发知识库mework yet and don't know if 50% (or any arbitrary number) of the way through the project you decide you no longer want to use the framework, at this point do you need to rebuild from day 1 to continue on without it?
Specifically I am looking at the possibility of using Yii but I want more of a generic answer.
It depends on the framework you use and how extensively you use it. I will give you two contrasting examples.
Zend Framework
I recently developed a website completely in Zend Framework, this includes using ZFs' MVC. I used none of my own written code and relied solely on the frameworks built in classes to achieve the tasks I wanted to achieve. If I was to re-write this site without ZF I would need to start from the beginning.
Codeigniter
Codeigniter is known as a light-weight framework, as with most frameworks you can choose to use certain classes or rely solely on the framework. If I started a website with Codeigniter I could decide to use class X or Y to achieve a requirement of the website (the same with Zend). If I wanted to stop using Codeigniter, I would only need to re-write the functions that used classes X or Y.
Basically, it depends on how extensively you use a framework.
The majority of your time spent on creating a web project is probably not actual mindless key pressing in your IDE. Much of the time is spent doing design and solving problems. So if you are switching from one feature-compatible framework to the next, it's not like starting over from day 1.
It does, of course, still take a lot of time. And I wouldn't recommend doing it without an extremely good reason. A little dirty secret that programmers don't like to talk about is the technology behind a project is rarely the reason it succeeds (or fails).
So keep plugging away with what you've got unless you've found out you are using a buggy piece of junk.
For the most, part, yes. If you are using Yii (or Zend, or symfony, or any of those) and are 50% done, it would be very difficult to reuse any of the components that you used, except maybe the SQL since most of the tables would be the same. Unless, you are willing to follow. If you have a ton of SQL, then it will save you some work, but, unless this is case, you start from scratch.
精彩评论