Redesigning A Redesign

I’ve been working on a complete redesign of my ugly main site this summer (including rewriting all of the code). When I was perhaps halfway done, I thought that I should use a PHP framework. I had to redo most of the code, again, but it would save me work in the future and force me to keep things much more organized. Looking at the options, I decided that CodeIgniter was the best answer. It was small, quick, and intuitive. Unfortunately, I’ve come to the conclusion that it is not the best answer after all.

I have bumped heads with the way that some of its innards work on more than one occasion. For instance, the 404 handling is atrocious. If a module is not found, a generic 404 page is shown and that’s it. If you have logging on, it will make an entry letting you know that a 404 was encountered, but it won’t even tell you the page that was being accessed! I noticed several good solutions on the forum, but they all involved hacking the CI source, which (IMO) defeats the purpose of using someone else’s framework. If I’m going to have to modify it significantly due to all the little things I want/need done differently, then upgrading will become a pain and it makes more sense to just do it my way in the first place. Why can’t I just extend the handling of 404’s? The problem also reveals that the development of CI does not take advantage of member contributions the way it should.

I tried symfony, and it’s quite impressive; however, symfony is definitely overkill for my needs. I believe CakePHP would be far more than I need as well.

I started working on my own framework, a very minimal one. I want the MVC architecture, but I don’t need a lot of the features that frameworks have. The more I develop it, the more I realize I am building the “dump truck” that will bring the supplies to let me build the foundation rather than just building the foundation directly, which frustrates me. I’m ready to have the site done, or at least to get working on the site itself rather than the backbone (incidentally, I’ve named my personal framework “Vertebrae,” though “Bruised Coccyx” may be a better option, as this is becoming quite the PITA).


2 Responses to “Redesigning A Redesign”

  1. 1 Mason

    404 handling is barebones… no rules saying you can’t extend or override the built-in 404 function. Add a call in there to log the 404. If you think the design is nasty, it gives you a place to make your own. So it’s a bit of work…. I still think the benefits you gain from CI outweigh the small amount of trouble it takes to bend it to your will.

    I had a similar experience using the image libraries. If you use the default behavior, it works great. I wasn’t even going for non-default behavior - what I asked for was apparently already a function of the library, but due to logic errors in several places, that functionality was broken. Reading into the comments, it seemed like the last person to make edits just… didn’t follow through. “Might as well return here” it says, or something similar.

    I’ve implemented quite a few frameworks… usually accidentally, while trying to alleviate busy-work on client projects. What they say is true: the best frameworks are extracted, not conceived. With that in mind, remember that CI was taken out of pMachine. There is some real-world experience in those bits of code.

    I’d seriously give CI another chance. I’ve done some crazy things on top of it to get what I want done, but it’s a much better, lighter option many of the other MVC frameworks. CakePHP is poorly documented and full of mixed metaphors, Symfony is overkill a la max. A framework I used once took advantage of PropelDB for the ORM layer… was nice coding, but if you had to make one change to the schema, it was a three/four+ step process.

    For the most part, I’ve abandoned PHP and PHP frameworks. After working with more dynamic languages like Python and Ruby (and their Django/Ruby counterparts), I have a hard time wanting to code in anything else. I just finished setting up Capistrano for deployment, and while it was a bit of a bitch to get going, it’s been smooth sailing from there. Rails kicks more buckets than any other framework I’ve used. I’ve loved it and hated it over the years, leaving it (for fear of it being over-hyped), yet always coming back, because it always delivered.

  2. 2 Gordaen

    Unfortunately, the show_404() function is built into Common.php (line 179), though you can extend the exceptions class and rewrite the show_404 method that is there. Then you run into a question of how much of the framework has been loaded when the 404 is called. That’s not the only issue I’ve had with CI, just the recent one. I think I would ultimately be better off writing my own framework since I would be able to fully customize it to my needs, reducing overhead and making it take better advantage of PHP5 features. I still have not decided for sure one way or the other at this point.

    Python/Django is gaining quite a bit of a following at work. Django seems to have a similar feature set to symfony, but is perhaps a bit more clear. PHP was a language I could pick up just by looking at it. Something in it just makes it “click” for me (perhaps because I dabbled with C when I was very young). Python looks intriguing, but it’s not as intuitive to me. I’d like to learn it, but I’ve got enough hobbies and projects at the moment!

    Thanks for the long and thoughtful post.

Leave a Reply