This lesson introduces students to smart system design through exploring rule-based systems and conditional logic. As the teacher, prepare by familiarising yourself with rule-based systems and conditional logic. Start with a discussion on everyday rules in games or machines like traffic lights. Guide students through creating conditionals using IF-THEN structures. Facilitate group activities to design smart systems, encouraging creativity. Conclude by linking to real-world programming concepts.
Ask the students to think of something in their lives that runs on rules. Think about a game, a sport, or a machine. What are their rules?
Discuss examples like a traffic light or a vending machine. Explain that these are simple systems that follow a set of rules.
Today, the students are going to be system designers. They will create your own 'smart' machine by writing its rules. These rules are called conditionals. They allow our machine to make decisions.
Write the basic structure on the board.
IF [something is true] THEN [do something]
IF [something is true] THEN [do this] ELSE [do something else]
Point out that conditions can be combined.
Briefly explain the difference between AND (both conditions must be true) and OR (at least one condition must be true).
Set the Scene by having students imagine they are designing a 'Smart Locker' for school. It needs to have some rules to help students.
As a class, come up with a few rules for the locker. For Example:
Rule 1: IF the code is correct, THEN the locker opens.
Rule 2: IF the code is incorrect, THEN a red light flashes.
Rule 3: IF the school day is over AND the locker is closed, THEN send a message to the student to check for books.
Ask the students to probe for problems with the rules. What if they enter the correct code, but the locker is already open? Does the red light still flash?
This leads to a discussion about making rules specific and avoiding conflicts.
Now, in groups, students will design their own smart system. They can choose from one of these ideas or come up with their own!
Give each group a stack of index cards.
The task: The group must design a system and write at least 5 conditional rules for it, with one rule per card.
Their rules must use if... then... or if... then... else.... Encourage them to use AND or OR for at least one of their rules.
Have them draw a simple diagram of their system on a separate piece of paper.