Creating classroom rules at the outset of a school year or semester will help you keep order in the classroom and give you a way to reward good behavior. Remember that rewarding good behavior is far more important than punishing bad behavior, so be sure whatever classroom rules you create give you the freedom to reward students for meeting expectations. Consistency is also very important; if you create a rule, be ready to evenly enforce that rule throughout the semester or school year. Inconsistent enforcement of rules will encourage students to break those rules or to become too lax in other ways.
Try to be minimalist with your classroom rules. Too many rules will confuse the students and will make them feel as though they have no leeway in the classroom whatsoever. Your rules should be simple and brief, and they should be easy to follow. Present the rules at the beginning of the school year and make sure they are posted clearly within the classroom so students can reference the classroom rules at any time. It may help to outline a rewards and punishment scale as well so students know what to expect should they break the rules.
It will be important to phrase the rules carefully. Instead of using a lot of "No" statements, try phrasing the classroom rules to encourage earning of privileges. A rule that states, "No mp3 players in the classroom," for example, will seem harsh to a student, thereby encouraging them to find ways to break that rule. You can instead say, "Mp3 players will be allowed only with teacher permission." This will encourage students to ask the teacher when they can use mp3 players, and the teacher can then make a determination on a case by case basis. This opens up options for both the teachers and the students.
Some rules will, of course, need to be punitive to some degree, which is acceptable. If you need to discipline a student for violating classroom rules, never do so in front of the entire class. Whenever possible, pull the student aside so other students are not watching and commenting. Isolating the student prevents backlash from other students, and it helps the teacher quell any conflict that may have arisen in the classroom. Praise can be given in front of the class, as can rewards, though it will be important for the teacher to gauge whether this is appropriate on a case by case basis as some students may be embarrassed by this.