Another factor that I left out is length of the flight. On flights of less than an hour, it isn't uncommon for ATC to limit your maximum altitude due to traffic. I frequently fly a 45 minute flight (air time) in a DC9 and we are usually stopped in the mid to upper 20,000's regardless of what our requested altitude might be. There simply isn't time to get up and get down while avoiding traffic conflicts during the climb and descent.
On short flights the ideal altitude profile would be to climb until reaching the optimum altitude even if you never reach it. In that case you'd climb until reaching the point where you intercept a flight idle descent profile at which point you would transition from a climb to a power off (flight idle) descent. Rarely happens, though.