The symfony Challenge: Part 4 > and the...

in case you're behind on whats happened so far:

you can dig any of the above stories (or this one if you too!), help a guy out.

I know I'm way way late. I apologize. Even the awesome powers of symfony can't rescue you when you're in over your head as far as I am. Plus, I had to set my oven on fire. I just had to!

>Where were we?
We were at hour 2.5 and we had a working backend (with photo uploads) and a partially working frontend that displayed text content and matched the style already established for the site in the previous incarnation. We had plenty left to do, but 97.5 hours left in which to do it.

>Well, how many hours did you use?
As if I'm going to tell you know so you can stop reading before we cover the interesting bits. sheesh.

>Okay, so what did you accomplish?
You ask all the right questions grasshopper. It's like you're reading my mind.

In the following hours I:

  • built up a login/security for the backend.
    • I opted for just a straight password stored in the app settings file. There is only one user and it just doesn't make sense to me to have a db table for one user. Further, I didn't bother with persistant sessions. It's very rare the users update this site and when they do, looking at past behavior, they tend to do small, quick updates. Knowing this saved time that was spent in the previous version allowing them to add users and control access levels. But, if you've read Getting Real by those 37signals folks you know it makes more sense to write what they need rather than what they might never use. This time savings shouldn't really go to symfony directly, but in part, because it frees up time to think about the merits of what your implementing it makes your implementation tighter. Call it time saved by proxy.
    • The downside to this choice is that their password is linked to me changing it if they forget it or lose it. In some situations this would equal death, in practical reality, objectively looking at user needs and behavior I can tell you it may cost me 5 minutes over the next two years of deployment. These are the choices we need to make on a case by case basis and symfony lets me write for the customer because I know if i have to change something later it's pretty painless.
  • I got the mainpage loading the "featured" image.
    • this is a plus for the user. I have no idea why, maybe because I was over-schedule, but in the previous version I didn't get to letting the user pick the image they wanted for the mainpage. They didn't mind, but it's a small feature that gives them a way of keeping the site feeling fresh and it's one field in the db. This took literally no time to do as it was one call to the db and one line of code to display it.
  • I got the gallery page going with a list of valid, viewable images ordered by sort id
    • this I blew out a couple of extra hours on. Once again I tried to climb the css hill to accomplish the peculiar layout required. And I do mean required, they were very commited to it looking exactly how it does. The issue is it's a three column table with left images aligned to the left, center images centered and right images aligned to the right. Where the rub comes in is the images are all the same height, but varied widths. Using all the css magic I could come up with I inevitably ended up with the center columns not lining up (because the percentages would change from line to line) and sometimes wrapping columns onto the next line. I eventually decided it wasn't worth it to keep working on this problem and instituted the same ugly table solution from the previous version.
  • I created the slideshow/veiw image page.
    • This was simple enough. It's pulling an image from the db and at the same time establishing what the next image will be. Nothing complex there. What was interesting about this step is that some of their images are quite long, and break 800x600 compatibility when placed next to the navigation menus. The solution was to write a small image tools class that grabbed image properties, then decide which css class to decorate the image with at load time based on the width of the image. Regular images go beside the menu, wide images go below it. Simply by declaring a different css class which lays out the image in a different spot. I then took this code back to the mainpage featured image and factored it in, so the same effect happens if they choose a narrow or wide image for the featured image.
    • The basic functionality is view image, click on image for the next image. Get to the last image and by cycled back to the gallery page. Standard enough and I would've loved to add some ajax functionality to make it a bit sexier, but the customer's like how it works and it matches the style and tone they have established.
    • I tried to optimize the loading of images by using an array in the session to see if it would save some time.
    • After playing with various implementations for this I decided it wasn't worth the time savings to have to be concerned about images being out of date, changed, deleted from the backend but still cached in session and the site speed was plenty fast enough with symfony's built-in caching so i moved on.
  • I went over the site from top to bottom looking for security problems.
    • Just standard checks for any risky code, or possible places for sql injection, or unescaped characters, or other hot spots. I found nothing but I code with these issues in mind initially so they tend not to crop up later. It should be noted that symfony's data imlpementation allows you to essentially use a command pattern style call where you are calling by explicit mysql paramaters and limiting calls through doSelectOne which gives you a really solid database level protection from the most common unsafe data techniques. I still recommend escaping unverified data and using common sense, but for those new to web app development they get a quick start, free level of security right out of the box.

>Okay, So how long did all that take?
At the end of the above list I was somewhere around hour 9 or 10. Yes you read that right.

>What's left?
I rolled it out on to the new server. I cleaned up any unwanted files because I have to deploy by ftp and then thoroughly tested the wheaties out of it for any unexpected behaviors. Satisfied everything was as it should be, I emailed the customer that the rebuild was done, advised them to inspect it and play with the backend functionality some and let me know if everything was cool.

>Oooh, a picky customer playing with 10 hours of work--what did they say?

"It looks, and works great Ruzz. Thanks very much for taking the time. I'll have to add new images soon. Hope things are well with you."

>Zero complaints, really?
Really, really. This is the true measure of the effectiveness of this process. Did the customer feel they lost or gained? Did they find fault with the changes? Was I able to successfully rebuild the site from scratch in a new version of the language (php5) and a new framework and satisfy the customers needs in the same or less time? The answer to all of the above is yes. a resounding yes.

>So, what was the total time invested?
The goal was to get the site to exactly the functionality they make use of and possibly improve a few places in 100 hours or less. Total time invested from opening my editor to being done is 11 hours. I'm removing an hour for the time i wasted on css and because I like round numbers and calling it 10 hours. That's a 90 hour time savings. That's a 10x increase in productivity where every hour is worth 10 in non-symfony development.

>Wow, I'm impressed. Is there anything else you want to say about this?
Yes, actually. I want to point out that not only did I save 90 hours but I was able to take code developed here, and apply it to other projects immediately. Further, I learnt more and more about symfony through the process which goes to comfort and understanding which futher accelerates future development. I didn't get any fancy new technology into this release but that's because my life is overloaded and this isn't a paying gig, not because I didn't have time left to do it.

>Anything else?
I just want to say, personally, symfony is to me what Ruby on Rails promised me it would be. I spent a lot of time and effort over the last 4-5 years looking for a solution like symfony. I wrote my own framework which while rewarding had none of the class of symfony. I went to C#/ASP.NET devleopment for a year hoping to find something better, and I spent 6 months in Ruby on Rails-land before discovering symfony.

I recall reading Ruby on Rails creator David Heinemeier Hansson's weblog talking about how RoR has actually made his non programming life better. How it made him feel less flawed, and happier about what he was doing. How it free'd him from the dread all programmer's know about writing crap code, only half understanding things, and feeling less able than your peers. He, in essence, felt RoR was a type of coming home. While I don't care for the syntax or visual style of Ruby, I can say that in my 4-5 year quest I many times asked myself if I Wasn't the problem, rather than the language or framework and upon finding symfony I can see a lot of pent up potential finding a way out. I am actually excited to develop again.

My "developer stress" has declined greatly. You know that feeling of noise or fuzz that washes over your mind when you try to understand something new which is just beyond your ken.. well, the calm i get from developing with symfony has brought that noise down and I'm able to explore new ideas again without dread or fear, to me that's worth more than 90% time. That's everything.

>Can we see the site?
Sure you can. You can go to www.williamanderson.ca and look around. Remember while you're there these aren't my design choices, or even my implementation choices. It's a simplistic site that meets the needs of the user explicitly and in my world that's a success.

>What's next?
What's next is a top secret pre beta symfony app I am working on for fellow symfony devleopers. I don't want to release the details just yet because I'm having trouble keeping my schedules on track and it's better to wait it till things are calmed down some. But, hopefully, soon there will be much more symfony talk on the web. If you have a blog, blog about this. Think it's amazing? crap? bullshit? Exactly what you needed? talk about it. Get the word out there. symfony is competing with a lot of lesser frameworks and it takes people talking about that to help people making choices about what which framework to use.

Advertisement

Live comments off Comments (2)

Log a comment

You have to be logged in to comment. Don't have a LifeLog yet? Sign up for a better online existence now! It's FREE!