Definitely max out the RAM first. AFAIK it's not possible to do that anymore since it's soldered onto the mainboard. I have a (work machine) 15" retina that is a year old with 16GB of RAM that I can't really exhaust. My personal 2012 Air has 8GB and even that is pretty sufficient for most tasks, but these days I'd go 16 in a heartbeat.
Processor wise, go with whatever you can in your budget. The chip is pretty much the same whether you go for a lower or higher clockspeed, so there aren't any hidden benefits to the top-of-the-line one. It'll just crunch numbers faster.
i5 vs i7 is really dual-core vs quad-core. I wanna say that is physical cores, so in reality you're looking at 4 and 8 logical cores thanks to hyper threading. It really depends on your workload. An i5 will be a little better on your battery, but an i7 will help if you're doing a lot of multithreaded programming.