Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1

    Default 4 Reasons Why All PHP Frameworks Suck?




    1. Frameworks Execute The Same Code Repeatedly Without Need

    Rasmus clarified that all frameworks that are for general purposes are not optimized for everbody's needs.

    A more specific complaint was that the solutions that frameworks offer lead to executing needless PHP code repeatedly in every HTTP request. The example that Rasmus gave is that in every request frameworks check the database type the application is using to load the respective database access class. Since the database type does not change after an application is deployed, he sees this as a waste.

    While I agree with Rasmus, I think this example is not very compelling because checking the configuration to decide which database access class to load takes a very small fraction of time, especially when compared for instance with executing database queries, which usually take many milliseconds and sometimes take a few seconds to run.

    A better example of this problem is when frameworks need to read configuration files to define load the actual configuration values.

    Often frameworks read configuration from INI files. PHP has built-in functions to load and parse INI files. Despite you can do it all with a single function, reading a INI file and parse it takes some time that is usually way more than checking the parsed configuration values.

    If your framework reads and parses configuration values from files in other formats that PHP does not have built-in support, like for instance YAML or XML, things get worse because the frameworks have to do the parsing in pure PHP code. That is much slower than the C code of the PHP engine that parses INI files.

    A better alternative is to have configuration values defined in PHP script files. Just put the configuration values in PHP scripts that assign the values to variables.

    When you use a PHP caching extension, PHP scripts are only compiled once. On a second run, PHP scripts compiled into opcodes are loaded from RAM. That is much faster than loading configuration from files.

    2. Frameworks Require Too Many Interdependent Classes

    Another point that Rasmus mentions is that sometimes you need only specific parts of a frameworks, but since the framework classes have too many dependencies between each other, you need to load too many classes even when you use simple features of the framework.

    While this is true to a certain degree, I have seen efforts from certain framework developers to reduce the dependencies between distinct components. Still there are often dependencies between many frameworks classes that sometimes do not aggregate anything to an application with specific needs.

    To address this problem some developers need to change the frameworks to strip the needless parts that add overhead. This causes a maintenance nightmare because they need to do that every time they want to upgrade to a newer version of a framework they started to adapt for their needs.

    Rasmus suggests using frameworks optimized for specific purposes to avoid this problem. He recommends using for instance Wordpress or Drupal if you just want to publish a blog.

    Alternatively Rasmus suggests that frameworks provide a means to let the developers push to production just a small subset of the components that are needed in each application.

    This solution is too general. Rasmus did not get to the way certain frameworks implement things and so he did not comment on why certain frameworks need so many components.

    For instance many frameworks rely on runtime ORMs (Object Relational Mapping). These are components that let developers define how to query databases treating information as objects, rather than tables of records.

    Object orientation is fine for abstracting problems and encapsulating solutions into classes of objects, but the way certain ORMs work adds too much needless overhead.

    The developer has to write code to dynamically specify the class variables (tables fields), condition clauses, object relationtionships (table joins), etc... to compose the actual query at runtime. This adds a lot of overhead because the queries that are executed are the same on every request, apart from some parameter values that may vary.

    There is a better solution that avoids this overhead. Instead of dynamically composing queries at runtime, just have a separate tool that generates PHP code for the ORM classes. The generated classes already have the compiled SQL queries to execute without further overhead at runtime.

    I have been using this approach since 2002 when I developed a ORM tool named Metastorage. It does exactly what I described above. I define in project file the objects, variables, relationships and functions that I need to apply on objects.

    Metastorage processes my objects definitions and generates ORM classes that execute the necessary queries at runtime just by calling the classes functions. No query building is done at runtime.


    3. Needlessly Complicated Solutions

    One thing that Rasmus did not mention directly is about the complicated solutions that frameworks tend to push.

    That is the case for instance of application version migrations. Some frameworks have copied the concept of migrations from Ruby On Rails. This means that you have to write code to change your database schema between different application versions.

    This is another thing that Metastorage addresses in a more efficient and less painful way for developers. Metastorage generates database table schema definitions in a separate file from my object definitions. It generates an installation class that installs the database tables on the first time.

    If I change the object definitions, the installation class can also upgrade the schema with the newer definitions without destroying any data already inserted in the database tables.

    This certainly makes development much faster and application upgrades less error prone because the tool always generates correct code to upgrade the database schema. When you write migrations code by hand, you may make mistakes that make you spend more time and effort to fix.

    4. Duplicating the Web Server Functionality

    Another aspect that Rasmus did not mention directly is related with aspects that frameworks sometimes require that PHP code redoes work that the Web Server already has done.

    For instance, routing is the processes of assigning some code (a controller) to handle requests with different URL patterns. Many frameworks push applications to use the front controller pattern. The front controller analyzes the request URL and load a specific controller to actually handle the request.

    The matter here is that the Web server already does this. It can match the request URL against configuration (for instance of mod_rewrite or similar) and execute the appropriate PHP script.

    When you make PHP handle the routing process, you are adding needless overhead to perform a task that is the same for every request with the same URL pattern. This falls into Rasmus complaint of frameworks that execute the same code repeatedly to the reach the same outcome.

    This seems to be yet another bad influence that PHP frameworks got from Ruby On Rails and Java. With those languages the Web server forwards the request to an application server.

    PHP does not need to work this way because it always runs integrated with the Web server, so there is no point duplicating the Web server functionality in a way that is slower and adds more overhead.
    Source: 4 Reasons Why All PHP Frameworks Suck? - PHP Classes blog - PHP Classes

    most of famous PHP framework are guilty of this 4 reason... more specifically #4 since most framework wanted to have routing control via code instead of mod_rewrite for one im guilty of all this... this will certainly affect my current MVC framework that i build... time to recode then...
    Last edited by salbahis; 02-06-2014 at 11:08 AM.

  2. #2
    Hmm.. it does make sense though since siya pud ang nag-author aning PHP. But anyways, on my opinion - rapid development ang apas para mogamit ug frameworks instead of reinventing the wheel over a several times.

    Saying it "sucks" seems to be inappropiate for me though as these frameworks is making our lives easier in our field or career.

  3. #3
    Quote Originally Posted by scrupulous View Post
    Hmm.. it does make sense though since siya pud ang nag-author aning PHP. But anyways, on my opinion - rapid development ang apas para mogamit ug frameworks instead of reinventing the wheel over a several times.

    Saying it "sucks" seems to be inappropiate for me though as these frameworks is making our lives easier in our field or career.
    rasmus and or me... are old-school and purist, people who believe that redundancy is not the answer to programming... as old as it gets... programming is not meant to be rapidly developed... however due to needs... a lot of shortcuts and "TOOL" has been made hence the framework... i developed a framework to compensate that need to finish the project "FAST", after watching the video it really made me rethink my approach..

    as what ive understand RAD in laymans term... its a lazy solution to a complicated problem what most old-school programmer encounter... so if he says SUCK... that opinion is mostly based from an old-school-purist-programmer.. and also.. he says it SUCK because he developed PHP for a certain purpose and this framework does that other way around....

    its quite common to most open source developer... if somebody uses your code and use it that other way.. well you may say you code sucks because thats not what it means to be... i know i have experienced it couple of times when my code was used for other things not the one that i intended...

    then again if we talk if framework is useful? well in some point... where it its necessary.. what most developer should remember that PHP frameworks is not a SWISS ARMY KNIFE... one should determined when, where, why to use it...

    i know its a paradox for i have reinvented the wheel couple of times due to necessity... but after i watched the video.. it reminds me of what and how i could code my framework.. time to recode then...

  4. #4
    .NET nalang, para mo dato samot ang Microsoft hehe

  5. #5
    Open source here
    Quote Originally Posted by Rainerius View Post
    .NET nalang, para mo dato samot ang Microsoft hehe

  6. #6
    though using frameworks will have performance penalty for reasons mentioned, naa mn pd advantage like maintainability especially if dli cge upgrade and if come and go ang developers, so it's not about for the client's benefit but for the vendor, what you think? especially team leads handling php projects?

  7. #7
    base from experienced... framework is always the go-to-solution if in terms of how fast can you build and maintain it... however... as what ive also experienced... since its a framework you are fairly LIMITED with in the limits of the framework otherwise you often risk modifying the framework's core... daghan nako nasugatan ani nga incident.. thats why i always favor that before you use a technology/system it should be thoroughly "ASSESSED" as to what are the requirements and not just because its easy to build and maintain... mao raba ni kasagaran sayop sa mga developer... dili ni siya ma notice until ang next developer nga mo work sa code... as what i always experienced then and even NOW (currently mao ni ako dilema a not-so-well though out plan on implementing the website)...

    framework's are not so versatile... for there is no such thing as a SWISS-ARMY-KNIFE framework.. scalability is not versatility..

  8. #8
    I did not use frameworks for a while when i started my career and find PHP sucks so bad!!! LOL! and I felt my career sucks too!!!

    until I met framework and fell in love with it, it swept me off my feet off the ground..

    Now I live a happily ever after.

  9. #9
    Quote Originally Posted by emailroy2002 View Post
    I did not use frameworks for a while when i started my career and find PHP sucks so bad!!! LOL! and I felt my career sucks too!!!

    until I met framework and fell in love with it, it swept me off my feet off the ground..

    Now I live a happily ever after.
    Oh yea I second the motion. Using frameworks let us focus on the business logic instead of building from the ground up!

  10. #10
    Junior Member
    Join Date
    Jun 2009
    Gender
    Male
    Posts
    478
    Again, gamit ug framework ug kasabot ka kung unsay purpose and if it's really productive. Or if you dont understand, you can reinvent the wheel

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. 18 reasons why it sucks living in the Philippines
    By dyosa_shofa_oka in forum General Discussions
    Replies: 230
    Last Post: 03-20-2015, 07:50 PM
  2. Unsa ang pinaka best PHP Framework para ninyo? and Why?
    By regz_carz in forum Websites & Multimedia
    Replies: 22
    Last Post: 03-07-2013, 04:39 AM
  3. 18 reasons why it sucks being a FILIPINO
    By florigaga in forum General Discussions
    Replies: 5
    Last Post: 08-21-2011, 12:14 PM
  4. ITT: We state the reasons why Filipino Teleseryes SUCK
    By Cruzader in forum TV's & Movies
    Replies: 93
    Last Post: 07-02-2009, 01:46 PM
  5. WHy all planets are circle??
    By Ponzk3 in forum General Discussions
    Replies: 34
    Last Post: 02-12-2009, 12:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top