#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    8
    Rep Power
    0

    When to use a web framework


    Hello,
    I've been web programming in PHP/MySQL for a while, but have never used a framework. I have a project now with the potential for high traffic, and I'm not sure that the code I usually write by hand is scalable enough to handle that. I'm wondering if the code generated by a framework is made to be scalable, or if it still depends on the skill of the coder.

    I'm also wondering whether it depends on the kind of site. My site has a lot of user interaction, so the data pulled for a given page can change based on user input, and is updated on a pretty regular basis. I've heard that frameworks are better for large collections of non-interactive pages, but I'm not sure if that's true.

    Finally, does anyone have any recommendations for someone who is new to the framework world?
    Thanks.
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    Good performance scalability has a lot to do with good database design, a lot to do with writing your SQL queries correctly, a little to do with not writing dumb PHP code, and not a whole lot else. A framework will not help much, if at all, when it comes to performance scalability.

    The primary purposes of a framework are (a) to provide a roadmap for a high-level architecture design (usually MVC) and (b) allow code to be re-used between projects more easily. Both of these are intended to improve development scalability - the ability to change and reuse code later without having to rewrite large amounts of other code.

    Standard frameworks are primarily useful for sites that have non-trivial code and not super-high traffic. If the code is simple, then the framework adds more programming overhead than it's worth. If the site is super-high traffic, then the framework adds too much performance overhead.

    However, even though you say "high traffic", I doubt the traffic of your site will be high enough to the point where a framework would hurt performance. Additionally, "potential" for high traffic is not the same thing. Using a framework is a wise choice, but prematurely optimizing code because you think you might have high traffic someday is not.


    A content management system is best suited to large collections of non-interactive pages. This would be something like Drupal, WordPress or Joomla. They are not particularly well suited to any other type of site, although many developers (ab)use them in this way.

    A framework would be something like CodeIgniter, Yii or Zend. I recommend CodeIgniter as it has hands down the best documentation and the least complicated design of any major PHP framework.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    8
    Rep Power
    0
    Thanks E-Oreo, this helps a lot.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Dec 2004
    Posts
    3,031
    Rep Power
    377
    sorry, i hope you dont mind me posting a question:

    i am doing a project and using MVC and it has gotten to a point where because of the three separate files for each functionality, it is getting a bit hard to keep track and i have to open all three (M, V, C) when i work on a functionality..

    SO the question is how should i "manage/track" it all?

    I would love to go back to simple OOP but i am half way into the project and do not necessarily want to switch. I may just re-code/optimise the site once the project is actually working..
  8. #5
  9. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    The point of MVC is generally to split the three components into separate files, so there is not really a way around editing three separate files.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo