Dogs, by instict, like small spaces. If you were to leave a dog outdoors and let it go feral (wild...), it would dig a hole as it's den. Also, leaving a dog with the run of an apt. adds too much stress to the animal... they feel they have to protect the entire apartment, and that's what causes a lot of barking problems.
Crates make a dog feel secure, they recreate that 'den' feeling. It has to be big enough for the dog to stand and turn around. They are also great for house-breaking, as dogs will not 'go' where they sleep.
However, an inside dog
should not be left alone longer than 7 or 8 hours, as a young adult. Puppies need a lot more attention, and probably until they're 6 months shouldn't be left alone longer than 4 hours.
Celebrate Life
Experience is what you get when you didn't get what you wanted.
- Randy Pausch