It sounds like you are thinking like an economist to me.
If one cannot see staying in the same place for at least five years, renting is better than buying.
And yes, whatever rent/mortgage payment one is making, they have be affordable in relation to one's income.