As the other half of this little venture, I have not been pulling my weight on this blog.  But no more!  It is my turn to chime in with a few lines of thought that might only be interesting to me.

My free time the last few days has been spent developing my side of the project, a new fantasy baseball game.  Developing is not the right word – more like refactoring for scale.  Right now the game is written to handle the one league and 12 teams that have been using it for the last 5 years.  However, if I want it to go anywhere, people should be able to sign up, create teams, join leagues, and so on and so forth.  So after multiple false starts, I’ve decided to take the working code I have now, refactor it for legibility and to fix the bugs that I have found, and push it out to the world next spring.

There turned out to be two clear options for me in considering scale for ottoneu.  One option is the one I took – take my manually written, inefficient, and generally goofy PHP and turn it into somewhat legible, slightly less inefficient, still remarkably goofy PHP that allows more than 12 people to play this fantasy game.  The other option would be to start over from scratch and develop a scalable, efficient piece of software against a proven MVC framework.  I tried the second path two or three times, and I’ve learned, basically, that I hate development frameworks.

I decided to work with Zend, a PHP framework with which I had heard good things.  I started from knowing nothing, and only towards the very end of my experience did I start feeling any bit of understanding towards the framework.  Basically, learning Zend was like learning a new language, but with this whole level of indirection on top of it – it looks like something I knew, but it wasn’t anything that I knew, and hiding everywhere in the framework was some call or some method that was the “Right” way to solve a problem.  Some people have this problem with base PHP – lots of silly built-in methods/functions, lots of ways of solving a problem, but the difference is that when using a framework, there really was the “Right” way and the dangerous way, whereas base PHP has multiple right ways, depending on what you are trying to do.

The second attempt at going down the Zend path had me hire a developer who had serious production experience with the framework and, I hoped, would be able to guide me and help me develop the new version of ottoneu.  However, the problems here were fairly straightforward – I still wasn’t learning anything about Zend, I barely had an idea of what was going on, and the developer was a freelancer, not invested or interested in being invested in the project.  So fine, this isn’t a beef against the framework, but… Goddamnit, I’m a reasonably smart person and a decent developer.  If your framework is too obtuse for me to pick up and build a reasonably complex project with, it isn’t doing its job.  All the “Hello Worlds” and simplistic authentication examples in the world won’t convince me otherwise.

So I decided, with a little help from this post from Joel Spolsky, to run with what I had.  Yes, it was ugly code.  Yes, I’m embarrassed to share it with anyone with anything more than self-taught PHP experience.  Yes, it had bugs galore, didn’t interact consistently with MySQL, and was way slower than it should be.  But look – it works.  The damn code works, and has worked for 5 years.  Best of all, I understand what I am working with – I wrote all this code, so I know what it is trying to do, how to fix various issues with it, etc.  And for just that reason, I know it will be faster for me to get to launch day, Spring 2011 than it would have been using Zend.

My conclusion is this – frameworks are good for someone starting out from scratch, but only if 1) the project is going to use a ton of the built-in help the framework gets you and 2) won’t need a lot of stuff that is outside the scope of the framework.  There are ways for me to eventually get my code to something much cleaner and more legible and even faster, but starting over from scratch was not one of those ways.

Next up, I’ll discuss a more interesting, more fantasy baseball-oriented topic: how do game and inning limits work?

One thought on “Frameworks”

Leave a Reply

Your email address will not be published. Required fields are marked *