Exclusion from the group or activity may be appropriate. Mass punishment is rarely effective and often counter-productive. In the case of direct defiance, remain calmly in control. Pause, take a deep breath, avoid responding with anger or retaliation. Work toward a mutually agreeable solution.
Teaching is a highly interpersonal profession.
You are constantly dealing with individuals of widely varying interests and life experiences. This makes for great rewards as well as challenges. Maintaining a positive learning environment is an ongoing process that changes and evolves with each group of students. Take it a step at a time and remember - keep your sense of humor. Suggestions for maintaining a learning environment.