Solution 1:

I used to work with a 2009 MBP 13" with C2D 2.53Ghz, 8GB ram and 256GB SSD, it worked like a charm with development (Qt, XCode), VM (VirtualBox), image edition (lightroom).

I changed it because the screen was too small but that shouldn't be an issue for you since you're running on a 17". So if you change both, you can hope at least 2 more years.

I would go for the SSD which is awesome : your HDD should reach around 100MB/s in RW whereas the SSD can go up to 375MB/s in SATA2 which is very nice. You'll get more speed in loading softwares, and swapping will be faster in order to compensate the eventual lack of RAM.

Solution 2:

I have a 2011 MacBook Pro 15", and upgraded it both to 8GB and an SSD. Both upgrades are extremely valuable.

Since you are using the MBP for coding, I would definitely go for the 8GB. XCode et al. can use quite a lot of RAM.

The SSD will also refresh your MBP immensely! Compiling will be much, much faster. As will be application startup times. Especially iPhoto, Aperture and the like will be incredibly faster, if the photo library resides on the SSD.

Since Apple is shipping most Macs with 8GB still, I guess this will prolong the work life of your Mac for several more years.

Solution 3:

On the other hand, I use an old 2010 Core 2 11" MacBook Air with a measly 2 GB of RAM, and it's quick enough to handle Xcode because it has an SSD. I'd say put the money on the SSD now and make sure your swapfile is going there.