Every year I run the Fantasy Formula 1 Grand Prix site, which is now in 15th year, it’s almost ready to go for the 2012 season, now that the driver lineup has been finalised and the prices have been fixed.
Quite often, there will be one team that hasn’t quite got their act together. In 2009 we didn’t know that Brawn GP was going to make it to the grid, until about week before the first race. However I can’t complain as Jenson Button and Brawn GP became world champions that year, and it was a fantastic year!
This year I’ve got a new feature coming to FF1GP, which I’m keeping under wraps until closer to the 20th of February.
However, the main reason for this blog was to talk briefly about the code on the FF1GP site. It does have quite a bit of history.
I’ll warn anyone reading this blog, that the next part is quite geeky and techie, and has bugger all to do with F1.
When the FF1GP website started in 1998, it was powered by a Access 97 database, which exported and imported CSV files to a bunch of Perl scripts. It worked very well for the small numbers, and it made a nice side project while at University.
Then in 1999 the Perl scripts changed to PHP scripts, however the Access 97 database remained until 2000, where it was migrated from Access 97 to Paradox. The reason? Well I was doing some work with Delphi 3 then, and it seemed a good idea at the time.
Then the database changed again in 2001, to MySQL. It’s still using that database, and it looks like it’s set to stay that way.
However the website code has always remained in PHP, and that has many changes over the year. The next re-write started in 2007, and never really got finished as I also decided to write my own PHP framework to run the FF1GP site.
Well it sort of worked, but as I found out, maintaining your own framework isn’t easy and takes a lot of time away from doing the real stuff, like writing the new code for the FF1GP site.
Also at the time in 2007, I didn’t think there was any decent PHP 5.2 frameworks that I felt was worth using. Since I’m a .NET developer, I was looking for something that was as good as the Microsoft .NET framework.
Come to 2011, there is no shortage of very good PHP 5.3 Frameworks. I looked at a few and started tinkering with a early Zend 2 Framework alpha however the progress on that framework has been very slow, and they only released another Beta recently. Also it’s still a massive framework in the terms of size and shear number of files. That’s not to say that is a bad thing, since it is a well tested framework.
So I looked at Symfony 2, and although it is a lot smaller than Zend, it met my requirements quite nicely. I’ve also managed to setup a bundle to help manged the running of the site and customise it for my needs. Also it was a simple job to introduce Symfony 2 to my existing code base, so I can slowly migrate all the old code to Symfony 2.
The Dependency Injection in Symfony 2 does take a little bit of getting used to, but once you understand it, it’s a very powerful feature.
At this stage, the FF1GP site is running a mesh of Symfony 2, my old framework code, with Doctrine 1 and Smarty template. The next step is to move the templates from Smarty to Twig, and then move from Doctrine 1 and old DB code to Doctrine 2. Once I’ve got that done, I can finally complete the code to make all the previous year’s data available.
It sounds like a lot of work, but for once I’ve got a feeling it can be finally achieved.
Anyway I’ll close this blog with a tip to anyone considering writing their own framework. Either:-
- Use someone else’s framework.
- Write your own, then throw it away and use someone else’s framework.