purpose of 3rd party mvc?
ive seen many third party mvcs or frameworks such as codeignitor , cakephp, and so on. what i want to know is what are their purposes? ive created my own framework call it an mvc or framework (in my opinion their all the same). in my framework i have all the classes in one folder called classes and all functions in another. its all organized and when a new project comes in i am able to complete it fast. i have looked at the applications that i mentioned and it seems to have huge articles and tutorials to study. what is the purpose? why not study the main language such as php, javascript/ajax or jquery, and so on then build something that you know the ins and outs of so that any project comes your way you know what to do. ive known some people who use cakephp and for every project they get stuck and need to figure out what to do. another guy i knew worked with joomla and every basic开发者_高级运维 company website that came his way he would reverse engineer joomla to make it work with the site. are people using these applications because they lack knowledge in the languages? or sometimes have no choice but to make a site while lacking language and put something together.
ps: i dont want to say which is better or argue, i want to understand and see if im missing anything.
Standardized frameworks make it easy to adapt and reuse blocks of code. By using a framework such as Zend, Cake, Joomla, etc. you can find repositories of pre-made scripts and components that easily plug into your existing site.
Not only that but frameworks will (in most cases) handle a lot of complicated, repetitive tasks that are standard across most websites. Frameworks will in most cases scaffold CRUD classes against your database automatically and support a clean separation of logic and view.
Frameworks aren't for everyone and I would actually recommend that newcomers to programming or PHP learn the basic syntax and object structure. Doing so will give you a stronger understanding of how your framework behaves and make it easier for you to modify/override the existing structure. Every framework is different, and some are better suited than others for particular tasks. You should do research and testing to see which one fits your needs.
One other benefit that hasn't been mentioned yet is that using a standard framework gives some shared knowledge between developers. If you build a project with your home-grown "framework" and then someone else has to maintain it in the future, they have to totally learn your methods from scratch. However, if you had used CakePHP, and they already have experience with CakePHP, they're going to have a pretty good base to start with. That can make a huge difference in the amount of time it takes them to get comfortable with a new system.
If you want to setup a project quickly, without having to know too much about everything underneath, using one of these frameworks can be very useful. You know, to some extent at least, that they're pretty well built and reliable, and it saves you a lot of time opposed to creating everything yourself. Most of them are also easily extendable to add functionality you might need.
But you're right, it's always a good thing to learn about all the basics. That way it's a lot easier to know what these frameworks exactly do, and more importantly, why and how. And knowing that makes it easier to choose the right framework for you and extend it in a proper and efficient way.
But in the end you'll learn from both approaches, the difference being that with an existing framework you can get start working with a site (almost) right away.
I too use my own home-built framework that took many months to develop, but for every project I still weigh the pros and cons of using a 3rd party framework. The decision usually comes down to the specifics of what I want to achieve. For example, in database-centric applications, I use my own framework because the ORM solutions of most of the well-known frameworks are just downright terrible and inefficient, but for something simple like a Blog, Codeigniter might be my choice (just because I hate Wordpress, which isn't even a framework but I have to mention here how horrible it is).
But keep in mind that while you know the ins and outs of your own framework, if anyone else has to maintain your project later on it will be difficult especially if you don't document. Big frameworks like CakePHP, Kohana, Symfony, etc. are fairly well known and it's easy to find others who have experience with them. Plus if you need help, all you have to do is post on their forums and chances are you'll have a good answer.
Another point is the maintenance of a home-built framework. More often than not this comes second to developing new sites or maintaining old ones, whereas a standard framework has a team of developers behind it. Any security issues in the framework are addressed and patched more rapidly and you can usually just upgrade the framework and keep your code intact.
精彩评论