Mental Models

Hands-on practice for this lecture. Work through the exercises and quizzes to reinforce what you've learned.

1

Exercise 1 of 1

The Subject-Verb Swap

Practice shifting your mindset from "Actions acting on data" to "Entities owning their actions".

deposit(account, 500)
account.deposit(500)
joinBatch(student, "March-2024")
student.joinBatch("March-2024")
calculateTax(invoice)
invoice.calculateTax()
sendAlert(notification, "User123")
notification.sendAlert("User123")

💡 The Swap: In Procedural code, we think "Do X to Y". In OOP, we think "Y, do X". Click the arrows to see how the syntax changes.

Hands-on Labs

Practical exercises to master the concepts.

Practical Lab
Abstraction

Library System Abstraction

Identify the "Ideas" in a Library system. Create a Book class with Guna (ISBN, Title) and Karma (checkout, return).

Try implementing this on your own first!
Practice: Mental Models — Interactive Exercises | Durgesh Rai