When I was young I promised myself to never be in debt and so far I have not broken that promise.
It is simple really. Do not spend money you do not have. And if you have it but will need it later then do not spend it. That is it.
If one day I have to choose between debt and going without something then I will go without, I prefer that over a debt.