Posts Tagged ‘PHP’

CoC

Saturday, September 5th, 2009

Speaking of symfony, I’ve found it’s “convention-over-configuration” approach a little maddening. There’s zillions of directories. Many of them have the same names but are along different paths. This one tripped me up today.

Configuration Principles in symfony

For many symfony configuration files, the same setting can be defined at different levels:

  • The default configuration is located in the framework
  • The global configuration for the project (in config/)
  • The local configuration for an application (in apps/APP/config/)
  • The local configuration restricted to a module (in apps/APP/modules/MODULE/config/)

Yes, three levels of config folders on top of the default (which is hidden deep inside of /lib where it belongs). That’s a good thing in that it allows for a lot of modularity and module-specific behaviors. But it’s a bad thing when you edit the file at the wrong place in the hierarchy as I did today. SVN helped me bail out of that particular fuck up.

I like the CoC approach – not being a trained programmer I do things intuitively and defining conventions is a very intuitive approach. Just takes a little pattern recognition to see what’s going on. Humans are good at that. The flip side is that convention over configuration is a my way or the highway proposition. If you don’t like it you may want to keep hacking your own code or maybe use Zend Framework which is not convention-driven.

So, I’m hanging in there with symfony after two days. It’ll probably take a month before I either jump all in or give it all up. We’ll see which.

Doctrine ORM

Saturday, September 5th, 2009

Doctrine is an Object Relational Mapper for PHP. I’m new to this so correct me if I’m wrong – an ORM allows you to interact with databases on a purely objective level. I finished Day 5 of the 24 day symfony tutorial today and had my first exposure to this. Symfony is object-oriented through and through. Tying it to an ORM keeps everything in the realm of objects. That’s attractive but it also means, you know, a high level of abstraction. So it can be a little mind bending. But, I’m game. I’m tired of writing stuff that is just driven by constant data retrieval and iteration through records. It may be nice to have things more encapsulated and just sort of… always on.

Getting into symfony

Thursday, September 3rd, 2009

I’ve been working with the symfony PHP framework today and am feeling excited about it so far. I went in search of some confirmation for my enthusiasm and found this blog post.

Symfony refactor of the Zend Quick Start Tutorial

My friends & colleagues have used Zend Framework (ZF) for a while, and I do my best to avoid it and use the Symfony PHP framework. Initially I was open to learning ZF, I was just curious why people liked it. The more questions I asked, the more I realized there were no good answers other than standards for standards sake, and variations on the Sunk Cost Fallacy.

I built a site using ZF some time ago and felt guilty about how little I enjoyed it. Symfony is not as simple as CodeIgniter or even Cake. But it doesn’t feel clever for the sake of being clever. The focus on getting things done and doing them properly is pretty tight. I may never get some of the people I work with to buy into this but I can live with that. There will be plenty of opportunities for me to build some skills with this toolset.