Your body is unforgiving. The saying "You are what you eat" is so very true. Yet it is also important to consider that the way in which you live your overall lifestyle is also extremely important in determining your body weight and body shape.
This is common knowledge. What you eat and how you move around will determine how your body looks. But have you ever really considered this before? That your body shape is a function of every single "input" into your body?
Inputs include what you eat, when you eat it and your portion sizes. These inputs also include your exercise - the type of exercise you do, the intensity of your exercise, how often you exercise. Furthermore, inputs also include how often you sleep, how physical your job is, whether you play sport, how far you walk each day, your stress levels and so on. All of these inputs come together to form a particular body shape - the body shape that you currently are living with.
Let's say that your goal is to lose weight. Therefore in order to accomplish this, you need to change your inputs to result in the weight loss "output". So, you may reduce the amount of food you consume, get 8 hours of sleep a night, perform some intense exercise and walk to and from work each day. This shift in inputs is going to result in a change in output. The rate at which your body shape changes will be highly variable between individuals, but your body shape will most certainly change.
Alternatively consider muscle and weight gain. If your current inputs are walking to and from work each day and eating a limited number of calories, you would therefore have to modify these to eating more calories each day and performing specific exercises to induce muscle development.
Dieting is a change in inputs, be it often a temporary change. You change the food that you take in to induce rapid weight loss. If you revert back to your pre-dieting inputs, your output will eventually be similar to your original body shape.
So the key is to change your inputs in a manner that necessarily result in the desired output. But the key is to change these inputs permanently. As I said, the body is unforgiving - it will adapt to the environment to which it is subjected to.
Whilst the body is unforgiving, it is also honest. It will tell you how you're doing. In fact, it is the one and only accurate indicator to your progress (obviously because it is the thing you are trying to change)! So, if you are progressing toward your goal, such as losing weight, your inputs are correctly aligned. If not, you need to revise your inputs.
Because the body is so honest, this means that you need to be honest with yourself. If you have a slip up with your nutrition, or skip a few workouts - identify it, learn from the mistake and move on. The body will not say to you "Oh, don't worry about it, I'll just continue to lose weight anyway - I understand you were feeling tired that day" - even though you may feel the urge to rationalise in this manner (hey, it's normal human behaviour, I'm sure we've all done it at some point). Be honest with yourself and you will reap the benefits.