Colossal waste of time
2007-11-01 16:01:10
A while back I wrote about how I tried to use Ajax for a work project and failed miserably. In the same post, I mentioned that I had developed my own framework, with a router similar to CherryPy's. In fact, Here's the post.
Anyway, the requirements of the project grew a little bit and the framework has quadrupled in size. The biggest addition was a more better ORM component.
Writing raw SQL for all actions was becoming way too tedius. I know, with an ORM I don't experience the unbridled power that is SQL. I also won't experience depression from looking at the same query 9 times in one file.
As I was saying, I wrote an ORM. I started out by looking at the 2 ORM projects for PHP: Propel and Doctrine. Neither fit the bill. Propel wouldn't work out because it hurts my brain, and Doctrine wouldn't work because it didn't work. At this point I thought about converting SQLAlchemy to PHP, but the syntax just wouldn't transfer over. Plus the fact that there are no namespaces would be a great hinderance.
At this point, I realize I have to write my own stuff. So I proceeded to do it. It just needed to be simple -- there aren't a lot of complex relationships in the DB structure. I also wanted to do something that wasn't ActiveRecord, because I don't particularly like AR. Of course, I ended up with a mutant AR/Zend_DB kinda thing. D'oh! It works for this, but it certainly isn't worth releasing or even continuing to build out.
Some other features I added too. Auto-rendering views, layouts, before and after callbacks, a $_SESSION wrapper, an input filtering component, auto-initializing models, and a bunch of utility functions. Yesterday, I started thinking, "This controller code seems awfully familiar."
Today I realized that I am basically recreating CakePHP!! ARGGHHH!! What a waste of time! But I can't rewrite it again, even though I know down the line it will definitely be beneficial to do so.
Moral of the Story: if you have a framework that you like, use it...no matter how much it seems like overkill. Just because it seems like there's a lot you don't need at the moment, the project can change and you'll be finding you need stuff that you don't have.
Anyway, the requirements of the project grew a little bit and the framework has quadrupled in size. The biggest addition was a more better ORM component.
Writing raw SQL for all actions was becoming way too tedius. I know, with an ORM I don't experience the unbridled power that is SQL. I also won't experience depression from looking at the same query 9 times in one file.
As I was saying, I wrote an ORM. I started out by looking at the 2 ORM projects for PHP: Propel and Doctrine. Neither fit the bill. Propel wouldn't work out because it hurts my brain, and Doctrine wouldn't work because it didn't work. At this point I thought about converting SQLAlchemy to PHP, but the syntax just wouldn't transfer over. Plus the fact that there are no namespaces would be a great hinderance.
At this point, I realize I have to write my own stuff. So I proceeded to do it. It just needed to be simple -- there aren't a lot of complex relationships in the DB structure. I also wanted to do something that wasn't ActiveRecord, because I don't particularly like AR. Of course, I ended up with a mutant AR/Zend_DB kinda thing. D'oh! It works for this, but it certainly isn't worth releasing or even continuing to build out.
Some other features I added too. Auto-rendering views, layouts, before and after callbacks, a $_SESSION wrapper, an input filtering component, auto-initializing models, and a bunch of utility functions. Yesterday, I started thinking, "This controller code seems awfully familiar."
Today I realized that I am basically recreating CakePHP!! ARGGHHH!! What a waste of time! But I can't rewrite it again, even though I know down the line it will definitely be beneficial to do so.
Moral of the Story: if you have a framework that you like, use it...no matter how much it seems like overkill. Just because it seems like there's a lot you don't need at the moment, the project can change and you'll be finding you need stuff that you don't have.
Latest Files
- ZAMN Editor - "Zurfl" - 2008-07-29 11:42:42
- Find and Replace - 2008-05-16 11:14:45
- Luhn Validation - 2008-03-12 09:38:16
- Drawing - 2008-01-07 14:01:36
- Pipe Demo - 2007-12-19 14:59:44
Most Popular
- ZAMN Editor - "Zurfl" - 483
- ZAMN Editor Source - 301
- ZAMN Password Generator - 215
- Colorspy - 196
- Readme Generator - 160