summaryrefslogtreecommitdiff
path: root/tutorials/module_1/notebook_1/classes_and_objects.ipynb
blob: b74c189d1a430684609e8d352d1cdccafffd9c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Modular Programming\n",
    "\n",
    "## 1. Introduction\n",
    "\n",
    "-   A. What is Object-Oriented Programming?\n",
    "-   B. Why use OOP? (vs. procedural)\n",
    "-   C. Real-world analogies (e.g., modeling components like pumps,\n",
    "    motors, or vehicles)\n",
    "\n",
    "## 2. Core OOP Concepts\n",
    "\n",
    "-   A. **Classes and Objects**\n",
    "    -   Definitions\n",
    "    -   Syntax in Python\n",
    "-   B. **Attributes and Methods**\n",
    "    -   Instance variables\n",
    "    -   Functions inside classes\n",
    "-   C. **Encapsulation**\n",
    "    -   Public vs private variables\n",
    "    -   Using `__init__` and `self`\n",
    "-   D. **Inheritance**\n",
    "    -   Parent and child classes\n",
    "    -   Reuse and extension of code\n",
    "-   E. **Polymorphism** *(brief overview)*\n",
    "    -   Method overriding\n",
    "    -   Flexibility in interfaces\n",
    "\n",
    "## 3. Python OOP Syntax and Examples\n",
    "\n",
    "-   A. Define a simple class (e.g., `Spring`)\n",
    "-   B. Instantiate objects and use methods\n",
    "-   C. Show `__init__`, `__str__`, custom methods\n",
    "-   D. Add a derived class (e.g., `DampedSpring` inherits from `Spring`)\n",
    "\n",
    "## 4. Engineering Applications of OOP\n",
    "\n",
    "-   A. Modeling a mechanical system using classes\n",
    "    -   Example: Mass-Spring-Damper system\n",
    "-   B. Creating reusable components (e.g., `Material`, `Beam`, `Force`)\n",
    "-   C. Organizing simulation code with OOP\n",
    "\n",
    "## 5. Hands-On Coding Activity\n",
    "\n",
    "-   A. Write a class for a basic physical component (e.g., `Motor`)\n",
    "-   B. Add behavior (e.g., `calculate_torque`)\n",
    "-   C. Extend with inheritance (e.g., `ServoMotor`)\n",
    "-   D. Bonus: Integrate two objects to simulate interaction"
   ],
   "id": "3440ae51-dc28-4d79-8abe-3ed2c35686eb"
  }
 ],
 "nbformat": 4,
 "nbformat_minor": 5,
 "metadata": {}
}