Whatever the age of your child, it's important to be consistent when it comes to discipline. If parents don't stick to the rules and consequences they set up, their kids aren't likely to either.
When your child between 0-2 years old does some things undesirable, bets strategy of to say No and distract the child. 'Time out' can be introduced at around 15-18 months of age for unacceptable behavior like hitting, biting, throwing food etc. It's important to not spank, hit, or slap a child of any age. Babies and toddlers are especially unlikely to be able to make any connection between their behavior and physical punishment. Remember that you are the role model for the child, and violence of any sort from you will set a bad example for the child.
As your child grows older and begins to understand the connection between actions and consequences, make sure you start communicating the rules of your family's home.
Explain to kids what you expect of them before you punish them for a certain behavior. For instance, the first time your 3-year-old uses crayons to decorate the living room wall, discuss why that's not allowed and what will happen if your child does it again (for instance, your child will have to help clean the wall and will not be able to use the crayons for the rest of the day). If the wall gets decorated again a few days later, issue a reminder that crayons are for paper only and then enforce the consequences.
The earlier that parents establish this kind of "I set the rules and you're expected to listen or accept the consequences" standard, the better for everyone. Although it's sometimes easier for parents to ignore occasional bad behavior or not follow through on some threatened punishment, this sets a bad precedent. Consistency is the key to effective discipline, and it's important for parents to decide together what the rules are and then uphold them.
While you become clear on what behaviors will be punished, don't forget to reward good behaviors. Don't underestimate the positive effect that your praise can have — discipline is not just about punishment but also about recognizing good behavior. For example, saying "I'm proud of you for sharing your toys at playgroup" is usually more effective than punishing a child for the opposite behavior — not sharing. And be specific when doling out praise; don't just say, "Good job!"