关于框架的一般问题[已结束]

Ok so I've been programming in PHP for several years now. I always enjoyed building content systems from the ground-up for practice (forums, blogs, comics, general CMSs etc), however in the past few months I have come to the conclusion I am focusing too much time in doing redundant work like building the base content system every time - fetching information from databases, making the basic layout actually work before bringing any valuable content management to it, etc. Now, im aware of development frameworks such as Zend, CakePHP, etc; but I've always failed to work with them to my satisfaction, and seemed to give up on them rather quickly.

So my questions are:

  • How customizable are those frameworks? Can I really get full freedom with them once I learn to use them properly and get to work on actual features instead of wasting weeks on getting a simple base ground up and running?
  • How much can I write my own functions for doing stuff in the background?
  • Are the results usually fast? Or do the frameworks provide slow and heavy code?
  • How intuitive is it to really get them working in my favor and how easy is it to get past the basics nd working with what's really important?

I'd love any insights in this subject. Also I'd love to know if any of you have any preferred frameworks to work with. Thanks in advance!

How customizable are those frameworks? Can I really get full freedom with them once I learn to use them properly and get to work on actual features instead of wasting weeks on getting a simple base ground up and running?

It depends. If you get a framework that have everything included you'll spend time to find out the right way to use it. One approach I could recommend is to get a micro framework and to add everything you need by yourself. I. e. you get microframework like Slim or Glue, that provide routing, add you favourite ORM like propel, doctrine, red bean or Pear DB, add your favorite view engine like smarty, twig or anithing else, add Zend modules that you need in your application or Pear classes, add third party tools. This is a longer, but more flexible approach.

How much can I write my own functions for doing stuff in the background?

This method allows your to write everything that you cannot find ready for your work.

Are the results usually fast? Or do the frameworks provide slow and heavy code?

Thus performance completely depends on you. It does not much depend on the factors that you cannot control.

How intuitive is it to really get them working in my favor and how easy is it to get past the basics nd working with what's really important?

It depends on the complexity of your planned project. You can add parts as you need more functionality.

well you are complaining about php frameworks. but how about java and .net?

do you think people know everything about them or even how it works. not really!

Point is that, most of the time people are trying to get their job done.

IMO, zend is great framework to work with php especially when you integrate it with smarty. and yes you can extend it.

There are lots of frameworks available and tons of sites on google and here on stackoverflow that discuss the in's and out's of each framework.

Myself personally, I prefer a barebones type framework like kohana or codeignitor, they do the basics for you and are fairly lite weight. So you end up with some help doing the basics, but largely you are left to your own devices to create a website.

I always think of people who use matured PHP frameworks as lazy people (or in a major hurry). In the long run, using frameworks will not increase your knowledge base anymore and therefore it's good for your time, but not good for you. I have to agree with David Parker, use something you've built from ground-up so you wouldn't have to anymore and whatever you do, do not stop learning because a developer who doesn't develop himself is no developer, right?

A while ago I wrote an answer to similar question;

Firstly you have to ask yourself some questions;

  • Do you really need to use Framework? If you are working on a small project, working it with such frameworks will just make your web pages work slower than they normally would. They have too many features which you might not need and eventually those features which you don't even use will use resources.
  • Do you really want to go through all user guide? Don't forget even for the simple query you want to make, you have to read the user guide. Security measures, queries, URLs, forms, templates etc.. etc.. You might want to save yourself sometime but eventually you would have to spare some time first to learn how to use them.

If you want to use framework, use it for bigger projects. This might save you time (considering you don't have all the features they offer in your library). Make sure Framework you are going to use can do better than you can.

Generally their requirements will match many hosts. Asking for extra requirements to run, will decrease their popularity so you won't have problems with hosting.

I never used framework, instead I coded my own but I took a look at CodeIgniter. If you want to use framework, I wouldn't suggest to use CakePHP. I heard it is using too much memory. I believe CodeIgniter is rising star.

To answer your question shortly; They are easy to install. You can learn quickly in time. CodeIgniter has very well documentation. If you want to use it on small projects, they will just make the page heavier than it normally would be. Coding your own small framework for such projects is the best way to approach it. No need to discover a land twice. If they offer and their code is better than yours (generally speaking) then why not to use it? If you have time and knowledge, I would recommend you to starting building your own.

How customizable are those frameworks?

How customizable is a toolbox?
Do not confuse framework with CMS. Framework is a merely a toolbox. And some sort of application carcass too.

Can I really get full freedom.

Definitely NO.
Framework is mostly an ideology. You will have to be baptized into particular framework's religion and do things the way it propose.

How much can I write my own functions for doing stuff in the background?

I can't get the question.

Are the results usually fast? Or do the frameworks provide slow and heavy code?

frameworks usually provide slow and heavy code.
but the code itself is very seldom being a bottleneck.

From the way the question asked, I'd suggest to learn some framework and then proceed to create your own one.