
Relational Database Design and Normalisation
Students will design Entity-Relationship (ER) diagrams and normalise databases up to the Third Normal Form (3NF). This ensures data integrity and reduces redundancy.
About This Topic
Object-Oriented Programming (OOP) marks a transition from procedural logic to modeling the world through Classes and Objects. In the MOE JC 2 syllabus, this topic focuses on encapsulation and abstraction. Students learn to bundle data (attributes) and behaviors (methods) into a single unit, the class, which acts as a blueprint for creating individual objects. This modular approach is essential for managing the complexity of modern software systems.
Encapsulation is a key concept here, where students use private modifiers to protect the internal state of an object, exposing only what is necessary through public methods. This mirrors real-world engineering where components are treated as 'black boxes.' Students grasp this concept faster through structured discussion and peer explanation of how real-world entities like a 'Bank Account' or a 'Student' should be modeled.
Key Questions
- Why is data redundancy problematic in a database?
- How do primary and foreign keys establish relationships?
- What are the steps to achieve Third Normal Form (3NF)?
Learning Objectives
- Identify the core components of an event-driven programming model.
- Explain how user interactions are translated into program events.
- Design a simple graphical user interface that responds to mouse clicks.
- Compare event-driven programming with sequential or procedural programming paradigms.
- Create a basic program that executes specific functions based on keyboard input.
Before You Start
Why: Students need a foundational understanding of how programs execute instructions and make decisions before they can grasp how events alter program flow.
Why: Event handlers are functions, so students must be familiar with defining and calling functions to implement event-driven logic.
Key Vocabulary
| Event | A signal indicating that something has happened, such as a user clicking a button or pressing a key. |
| Event Handler | A function or method that is executed in response to a specific event occurring. |
| Event Loop | A programming construct that continuously checks for and dispatches events to appropriate handlers. |
| Callback Function | A function passed into another function as an argument, which is then invoked inside the outer function to complete a routine or action. |
| GUI (Graphical User Interface) | A visual way of interacting with a computer using windows, icons, and menus, often involving event-driven interactions. |
Watch Out for These Misconceptions
Common MisconceptionA class and an object are the same thing.
What to Teach Instead
A class is the template (the recipe), while an object is the instance (the cake). Using the 'cookie cutter' analogy in a hands-on activity helps students see that one class can create many independent objects.
Common MisconceptionMethods must always be public.
What to Teach Instead
Internal helper methods should be private to hide complexity. Discussion of 'information hiding' helps students understand that a clean interface only shows what the user needs to interact with.
Active Learning Ideas
See all activitiesThink-Pair-Share: The Blueprint vs. The House
Students identify a real-world object (e.g., an EZ-Link card) and list its attributes and methods. They then compare their lists in pairs to decide which data should be 'private' and which 'public' to ensure security and functionality.
Inquiry Circle: Object Modeling
Small groups are given a scenario, such as a library management system. They must draw a class diagram on a whiteboard, defining the attributes and methods for 'Book', 'Member', and 'Loan' objects, then explain their design to another group.
Peer Teaching: Encapsulation Defense
One student writes a class with public attributes. Their partner must 'hack' the object by setting invalid values (e.g., a negative age). The first student then refactors the code using private attributes and setter methods with validation logic to 'defend' the data.
Real-World Connections
- Video game developers use event-driven programming to make characters react to player inputs like button presses or joystick movements, creating interactive gameplay experiences.
- Web developers build interactive websites where clicking on a button triggers a specific action, such as submitting a form or displaying new content, all managed through event handling.
- Mobile application developers design user interfaces where tapping on icons or swiping the screen initiates specific functions within the app, demonstrating real-time responsiveness.
Assessment Ideas
Provide students with a short code snippet demonstrating a button click event. Ask them to write down: 1) What is the event? 2) What is the event handler? 3) What will happen when the button is clicked?
Pose the question: 'Imagine you are designing a simple drawing application. What kinds of user events would your program need to handle, and what actions would each event trigger?' Facilitate a brief class discussion, encouraging students to identify specific mouse and keyboard events.
During a coding session, ask students to demonstrate how to attach an event listener to a specific UI element (e.g., a button). Observe their code and provide immediate feedback on correct syntax and logic for event handling.
Frequently Asked Questions
What is the main advantage of using OOP over procedural programming?
How does encapsulation improve software security?
How can active learning help students understand classes and objects?
Do I need to know how to draw UML diagrams for the exam?
More in Databases and Data Management
Structured Query Language (SQL)
Practical application of SQL for Data Definition Language (DDL) and Data Manipulation Language (DML). Students will write complex queries involving joins and aggregations.
2 methodologies
NoSQL and Alternative Data Stores
An introduction to non-relational databases, focusing on document-oriented stores like MongoDB. Students will compare NoSQL with traditional SQL databases.
2 methodologies