hatakekksheeshh's picture
Upload folder using huggingface_hub
7ec75e2 verified
{
"course": "Advanced_Programming",
"course_id": "CO2039",
"schema_version": "material.v1",
"slides": [
{
"page_index": 0,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_001.png",
"page_index": 0,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:18+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP. HÖ CHi MINH TP.HCM Advancea Programming C02039 Chapter 1: Object Oriented Programming Revision - Encapsulation DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 1,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_002.png",
"page_index": 1,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:21+07:00"
},
"raw_text": "CONTE NT 01 NTRODUCTION TO OOP 02 ENCAPSULATION HOW ENCAPSULATION 03 WORKS? 04 BEST PRACTICES 05 CONCLUSION 06 EXTENSIONE CLASS DIAGRAM 2"
},
{
"page_index": 2,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_003.png",
"page_index": 2,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:24+07:00"
},
"raw_text": "NTRODUCTIO N I TO OBJECT 01 ORIENTED PROGRAMMIN G 3"
},
{
"page_index": 3,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_004.png",
"page_index": 3,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:28+07:00"
},
"raw_text": "What is OOP? Abstraction Object-oriented programming (OOP) is a Polymorphism Encapsulation programming paradigm 1 that organizes software Object-Oriented design around objects, which Programming / can represent real-world entities or abstract concepts Inheritance Classes Each object contains data Objects (attributes or properties) and behavior (methods or functions) 4"
},
{
"page_index": 4,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_005.png",
"page_index": 4,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:31+07:00"
},
"raw_text": "Key principles of OOP Abstraction Encapsulation: Bundles data (attributes) and methods Polymorphism Encapsulation (behavior) into a single unit 1 (class) and restricts access to Object-Oriented protect data integrity Programming Example: A Car object has Inheritance Classes private attribute speed and a Objects public method getSpeed() to access it. => Protects data integrity by 5"
},
{
"page_index": 5,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_006.png",
"page_index": 5,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:35+07:00"
},
"raw_text": "Key principles of OOP Abstraction Inheritance: Allows one class to inherit attributes and Polymorphism Encapsulation methods from another, 1 promoting code reuse and Object-Oriented hierarchical relationships Programming Example: A Truck class can Inheritance Classes inherit from a Vehic/e class Objects => Promotes code reuse 6"
},
{
"page_index": 6,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_007.png",
"page_index": 6,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:38+07:00"
},
"raw_text": "Key principles of OOP Abstraction Polymorphism: Allows objects to take on many Polymorphism Encapsulation forms, e.g., a single method 1 or class to represent different Object-Oriented underlying data types or Programming behaviors Inheritance Classes Example: A draw( method Objects behaves differently for Circ/e and Rectang/e objects. =>Simplifies code and makes 7"
},
{
"page_index": 7,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_008.png",
"page_index": 7,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:42+07:00"
},
"raw_text": "Key principles of OOP Abstraction Abstraction: Hides implementation details and Polymorphism Encapsulation exposes only essential 1 features, simplifying complex Object-Oriented systems for the user. Programming Example: A user presses a Inheritance Classes car's \"start\" button without Objects needing to understand the engine mechanics. =>Reduce complexity 8"
},
{
"page_index": 8,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_009.png",
"page_index": 8,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:46+07:00"
},
"raw_text": "Why OOP? Create systems that are modular, scalable, reusable and easier to understand. Think of a car in the real world. It has: Attributes: color, brand, speed, fuel capacity Behaviors: start, stop, accelerate. Modular -> divides programs into independent, self- contained classes Scalable -> allows new functionality to be added or extended Reusable -> creating generic classes or extending existing classes 9"
},
{
"page_index": 9,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_010.png",
"page_index": 9,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:48+07:00"
},
"raw_text": "ENCAPSULATI 02 ON 10"
},
{
"page_index": 10,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_011.png",
"page_index": 10,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:51+07:00"
},
"raw_text": "What is Encapsulation? When creating new data types (classes) the details of the actual data and the way operations work is hidden from the other programmers who will use those new data types Encapsulation IN - CAPSULE - ation class Variables Methods 11"
},
{
"page_index": 11,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_012.png",
"page_index": 11,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:55+07:00"
},
"raw_text": "Why is Encapsulation important? By controlling how data and methods are accessed or modified Why? encapsulation ensures: Data Integrity: Prevents unauthorized or accidental changes to data. Security: Sensitive data is hidden from unauthorized access. Ease of Use: Users of the class do not need to understand its internal complexities. 12"
},
{
"page_index": 12,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_013.png",
"page_index": 12,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:28:58+07:00"
},
"raw_text": "Core principles of Encapsulation Data Hiding: The internal state of an object is kept private and can only be accessed through public methods (getters and setters). Access Control: Access specifiers are used to control the visibility of class members: private: Accessible only within the defining class. default: Accessible only within the same package protected: Accessible within the same package and by subclasses (even in different packages)) public: Accessible from anywhere (any class, any package, and any subclass). 13"
},
{
"page_index": 13,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_014.png",
"page_index": 13,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:03+07:00"
},
"raw_text": "Example public class Person { // Public: Accessible anywhere public String name; // Protected: Accessible within the same package or by subclasses protected int age; // Default (Package-private): Accessible only within the same package String address; // Private: Accessible only within this class private String password; // Constructor to initialize the object public Person String name, : int age, String address, String password) { this name = name this age = age this address = address this password = password } / Getter for password to demonstrate controlled access public String getPassword() { return password; } 14"
},
{
"page_index": 14,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_015.png",
"page_index": 14,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:06+07:00"
},
"raw_text": "HOW 03 ENCAPSULATI ON WORKS? 15"
},
{
"page_index": 15,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_016.png",
"page_index": 15,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:09+07:00"
},
"raw_text": "Class vs struct structure class Defining Classes and struct struct_name class class-name Objects // struct data members // data } // functions }; = Can I use Struct instead of Class? Java: no struct Struct Class Default Access Public Private Encapsulatior Less support Full support Use case Light weight objects All 16"
},
{
"page_index": 16,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_017.png",
"page_index": 16,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:13+07:00"
},
"raw_text": "Constructor in Encapsulation A constructor is a special function in a class: Same name as the class. Not have a return value. It is automatically called when an object is created (the programmer does not call it directly). If no constructor is declared, the program automatically provides a default empty constructor. What is the access modifier for the default constructor? - Can we create a private constructor? (Sing/eton Pattern 17"
},
{
"page_index": 17,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_018.png",
"page_index": 17,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:17+07:00"
},
"raw_text": "Getters and Setters Getters and Setters Example: public class Getset are methods used to private int age access and modify // Getter for 'age public int getAge the private fields of a return age class, adhering to the principles of // Setter for 'age' with validation public void setAge int age encapsulation if age 0 this age age, else System out.println \"Age cannot be negative.\" public static void main String args 18"
},
{
"page_index": 18,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_019.png",
"page_index": 18,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:20+07:00"
},
"raw_text": "Getters and Setters -Encapsulation: Protects the internal state of an object. -Control: Allows you to validate or modify data before it's set. -Consistency: Helps maintain consistent object state. -Flexibility: Makes it easier to change the internal implementation without affecting other code -Readability: Improves the readability and maintainability of the code. -Access Control: Allows creation of read-only or write-only properties. -Debugging: Enables easy tracking and debugging of changes to the data. 19"
},
{
"page_index": 19,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_020.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_020.png",
"page_index": 19,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:22+07:00"
},
"raw_text": "BEST 04 PRACTICES 20"
},
{
"page_index": 20,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_021.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_021.png",
"page_index": 20,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:26+07:00"
},
"raw_text": "Exercise 1 - Multiple constructor Create a Car class with the following private attributes: brand (string) model (string) year (int) Add the following: A default constructor that sets default values. A parameterized constructor to initialize all attributes. Setters and getters for all attributes. Write a main function to: Create an object using the default constructor and display its details. Create another object using the parameterized constructor and display its details. 21"
},
{
"page_index": 21,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_022.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_022.png",
"page_index": 21,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:28+07:00"
},
"raw_text": "Exercise 2 - Constructor chaining Create a Laptop class with attributes: brand (string) model (string) price (double) Add the following: A default constructor. A parameterized constructor to initialize all attributes. Use constructor chaining to call one constructor from another Write a main function to test the class 22"
},
{
"page_index": 22,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_023.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_023.png",
"page_index": 22,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:31+07:00"
},
"raw_text": "Exercise 3 (Bonus) Create a Library system using encapsulation and constructors. 1. Create a Book class with attributes: tit/e, author, /sBN, price and stock. 2. Create a Library class with: a. An array of Book objects b. Methods to: I. Add new books. ii. Search for books by title or author. iii. Borrow books (reduce stock) 3. Write a main function to simulate library operations 23"
},
{
"page_index": 23,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_024.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_024.png",
"page_index": 23,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:33+07:00"
},
"raw_text": "05 CONCLUSION 24"
},
{
"page_index": 24,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_025.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_025.png",
"page_index": 24,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:36+07:00"
},
"raw_text": "Conclusion 1. Encapsulation is the foundation of OOP, focusing on bundling data and functions within a class. 2. The main difference between a class and a struct lies in the Ievel of data security (private/public). 3. A constructor is a special mechanism in OOP that automatically executes when an object is created and can cause errors if not properly designed 25"
},
{
"page_index": 25,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_026.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_026.png",
"page_index": 25,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:37+07:00"
},
"raw_text": "EXTENSION: 06 CLASS DIAGRAM 26"
},
{
"page_index": 26,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_027.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_027.png",
"page_index": 26,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:40+07:00"
},
"raw_text": "Class diagram Circle tvarName:type = default-value radius:double = 1.0 - denotes private access -color:String = \"red\" + denotes public access +Circle() +Circle(r:double) +getRadiusO:double tmethodName(parmName: type, : . :) :retunType +getAreaO:double Can you write a program based on the above class diagram? 27"
},
{
"page_index": 27,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_028.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_028.png",
"page_index": 27,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:47+07:00"
},
"raw_text": "A class called Ball which models a bouncing ball, is Hands-on exercise designed as shown in the following class diagram Ball It contains its radius, x -x:float -y:float Each move step advances x and y and y position. Each -radius:int by x and y. x and y could be -xDelta:float move-step advances the x positive or negative. -yDelta:float and y by delta-x and +Ball(x:float,y:float,radius:int delta-y, respectively. xDelta:float,yDelta:float +getXQ:float delta-x and delta-y could +setx(x:float):void +getYQ:float be positive or negative +setY(y:float):void The reflectHorizontalO +getRadius():int +setRadius(radius:int):void and reflectVerticalO Move one step: +getXDeltaO:float x += 4x; y += Oy; methods could be used to +setXDelta(xDelta:float):void +getYDelta:float 4x = -Ax bounce the ball off the +setYDelta(yDelta:float):void +moveQ:void- walls, Write the Ball class. 4y = -4y treflectHorizontalQ:voido Study the mainO on how +reflectVerticalQ:void- \"Ball[(x,y),speed=(Ax,4y)] +toStringQ:String° the ball bounces. https://www.programiz.co m/online-compiler/5VrKcT 28"
},
{
"page_index": 28,
"chapter_num": 1,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_029.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_1/slide_029.png",
"page_index": 28,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:49+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 29,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_001.png",
"page_index": 29,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:52+07:00"
},
"raw_text": "DAI HOC BK QUOC GIA TP. HÖ CHi MINH TP.HCM Advanced Programming CO2039 Chapter 2: Object Oriented Programming Revision - Inheritance DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 30,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_002.png",
"page_index": 30,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:56+07:00"
},
"raw_text": "Additional Notes Call constructor of the superclass Default baseclass Class Object Overloading method Subclass inherits ALl members of the superclass 2"
},
{
"page_index": 31,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_003.png",
"page_index": 31,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:29:59+07:00"
},
"raw_text": "CONTE NT 01 NTRODUCTION TO INHERITANCE KEY CONCEPTS OF 02 NHERITANCE HOW INHERITANCE 03 WORKS? 04 BEST PRACTICES 05 CONCLUSION 06 EXTENSIONE COMPOSITION 3"
},
{
"page_index": 32,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_004.png",
"page_index": 32,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:01+07:00"
},
"raw_text": "INTRODUCTIO 01 N TO NHERITANCE 4"
},
{
"page_index": 33,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_005.png",
"page_index": 33,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:04+07:00"
},
"raw_text": "What is lnheritance? A mechanism for creating a new class (called a derived class or child class) from an existing class (called a base class or parent class) to reuse and extend its functionality Animal Inheritance Dog Cat 5"
},
{
"page_index": 34,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_006.png",
"page_index": 34,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:07+07:00"
},
"raw_text": "Why is Inheritance important? Code Reusability: Reuse of common logic from base classes = codebase more efficient and maintainable Extensibility: New features can be added by extending the base class - easy updates without affecting existing code. Polymorphism: Introduced in Chap 3 later. Hierarchical Organization: 6"
},
{
"page_index": 35,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_007.png",
"page_index": 35,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:09+07:00"
},
"raw_text": "KEY 02 CONCEPTS OF INHERITANCE 7"
},
{
"page_index": 36,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_008.png",
"page_index": 36,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:13+07:00"
},
"raw_text": "Base class & Derived class Base class (Parent/Superclass) : The class whose properties (attributes) and methods (functions) are inherited by another class. Exanva caimatiria/sscflas: Animal Deri The class inheriting from the base Inheritance class. It can use or override the members of the base class and add its own = \"is-a\" relationship Dog Cat Examp/e: Dog inherits from Animal = Dog \"is-a\" Animal. 8"
},
{
"page_index": 37,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_009.png",
"page_index": 37,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:17+07:00"
},
"raw_text": "Method overriding A derived class can redefine (override) a method from the base class to provide specific functionality. The method in the base class must have the same name, return type, and parameters as the created, the base class constructor is called first followed by the derived cJass constructor. Destructors: When an öbject is destroyéd, the derived class destructor is called first, followed by the base class destructor. Introduced more detailed in Chap 3 - 9 Polymorphism"
},
{
"page_index": 38,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_010.png",
"page_index": 38,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:20+07:00"
},
"raw_text": "Types of Inheritance Single Inheritance: A derived class inherits from one base class. Multiple Inheritance: A class inherits from more than one base class. (Supported in C++ but not in Java) Multilevel Inheritance: A class inherits from a derived class, forming a chain. Hierarchical Inheritance: Multiple derived classes inherit from one base class. Hybrid Inheritance: A combination of two or more types of inheritance. 10"
},
{
"page_index": 39,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_011.png",
"page_index": 39,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:23+07:00"
},
"raw_text": "Types of Inheritance ClassA ClassA ClassA ClassB ClassB ClassB ClassC Single Inheritance HierarchicalInheritance ClassC ClassA MultilevelInheritance Diamo nd ClassA ClassB ClassB ClassC Proble m? ClassC ClassD Multiple Inheritance Hybrid Inheritance 11"
},
{
"page_index": 40,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_012.png",
"page_index": 40,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:25+07:00"
},
"raw_text": "HOW 03 INHERITANCE WORKS? 12"
},
{
"page_index": 41,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_013.png",
"page_index": 41,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:28+07:00"
},
"raw_text": "Subclass inherits all members from WHpersloaass inherits from a superclass: All members of the superclass, whether public or private, are technically inherited. However, accessibility depends on the access specifier: O Public and protected members can be direct/y accessed in the subclass. Private members are inherited but not accessible direct/y; they are accessible through public or protected getters and setters in the superclass. 13"
},
{
"page_index": 42,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_014.png",
"page_index": 42,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:32+07:00"
},
"raw_text": "Subclass inherits all members s from Superclass MODE OF INHERITANCE Base class member Public Protected Private access specifier Public Public Protected Private Protected Protected Protected Private Private NotAccessible Not Accessible Not Accessible (Hidden) (Hidden) (Hidden) 14"
},
{
"page_index": 43,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_015.png",
"page_index": 43,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:36+07:00"
},
"raw_text": "Pointers for Polymorphism (1) class Superclass { public: }; Subclass s class Subclass : public Superclass { public: void display() override { cout << \"Subclas$n\"; } }; sup sub int main( { Subclass sub; Superclass sup = sub, sup.displayO; // Output: ??? 15"
},
{
"page_index": 44,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_016.png",
"page_index": 44,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:39+07:00"
},
"raw_text": "Pointers for Polymorphism (2) class Superclass { public: }; Subclass s class Subclass : public Superclass { public: void display() override { cout << \"Subclas$n\"; } }; sup sub int main( { Subclass sub; Superclass* sup = &sub; sup->displayO; // Output: ??? 16"
},
{
"page_index": 45,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_017.png",
"page_index": 45,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:42+07:00"
},
"raw_text": "Implicit use of pointers class Superclass { public void display( { System.out.println(\"Superclass\"); } } In Java (and many other OOP class Subclass extends Superclass languages): All objects are @Override public void display() { accessed via references System.out.println(\"Subclass\") (similar to pointers in C++): } } public class Main { public static void main(String[] args) { Superclass obj = new SubclassO; obj.displayO; // Output: ??? } } 17"
},
{
"page_index": 46,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_018.png",
"page_index": 46,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:44+07:00"
},
"raw_text": "BEST 04 PRACTICES 18"
},
{
"page_index": 47,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_019.png",
"page_index": 47,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:47+07:00"
},
"raw_text": "Exercise 1 - Inheritance in Vehicle classes (1 Create a base class Vehicle with the following private attributes: brand (string) year(int) Add the following to Vehicle: A default constructor that sets default values \"Unknown\" for brand, 0 for year) A parameterized constructor to initialize brand and year. Setters and getters for brand and year. A method displaylnfo() to print details of the vehicle. 19"
},
{
"page_index": 48,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_020.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_020.png",
"page_index": 48,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:51+07:00"
},
"raw_text": "Exercise 1 - Inheritance in Vehicle classes Add a private attribute: mode/ (string)) Provide a default constructor and a parameterized constructor for Car using constructor chaining. Override the displaylnfo() method to include model. Create another derived class Bike that inherits from Vehicle: Add a private attribute: engineCapacity (int) Provide constructors and override displaylnfo() to include engineCapacity In the main function: Create a Car object using both default and parameterized constructors and display its details. Create a Bike object using both default and parameterized constructors and display its details. 20"
},
{
"page_index": 49,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_021.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_021.png",
"page_index": 49,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:30:55+07:00"
},
"raw_text": "Exercise 2 - Enhanced Library System withalnberitance (1) Attributes: title, author, ISBN, price, and stock. Methods: Constructor to initialize attributes. Getter and setter methods A virtual displayDetails() method to display book information. Derived Classes: EBook (inherits Book) Additional attribute: fileSize (in MB Override displayDetails() to include file size PrintedBook (inherits Book) Additional attribute: pageCount. Override displayDetails() to include page count 21"
},
{
"page_index": 50,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_022.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_022.png",
"page_index": 50,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:00+07:00"
},
"raw_text": "Exercise 2 - Enhanced Library System W A dynamic array or vector of pointers to Book objects (supporting both EBook and PrintedBook) Methods: addBook(Book*): Add a new book (of any type) searchByTitle(string) and searchByAuthor(string): Search books by title/author. borrowBook(string ISBN): Reduce stock of the specified book by 1. displayAllBooks(): Display all books in the library Main Function: Add a mix of EBook and PrintedBook objects to the library Simulate user operations: Search for books by title/author, Borrow books, Display all books. 22"
},
{
"page_index": 51,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_023.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_023.png",
"page_index": 51,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:05+07:00"
},
"raw_text": "Exercise 3 - Point2D and Point3D Point2D -x:float = 0.0f -y:float = 0.0f +Point2D(x:float,y:float) +Point2D() +getXQ:float +setX(x:float):void +getY(:float Can you write a +setY(y:float):void +setXY(x:float,y:float):void Array of{x,y} program based on this +getXY():float[2] class diagram? +toStringO:String \"(x,y)\" extends Point3D -z:float = 0.0f +Point3D(x:float,y:float,z:float) +Point3D() +getZQ:float +setZz:flaot):void +setXYZ(x:float,y:flaot,z:float):void,- Array of{x,y,z} +getXYZ(:f1oat[3] +toString: String \"(x,y,z)\" 23"
},
{
"page_index": 52,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_024.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_024.png",
"page_index": 52,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:07+07:00"
},
"raw_text": "05 CONCLUSION 24"
},
{
"page_index": 53,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_025.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_025.png",
"page_index": 53,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:10+07:00"
},
"raw_text": "Conclusion 1. Inheritance is a fundamental concept of OOP, enabling the creation of new classes by reusing and extending existing ones. 2. The primary benefit of inheritance lies in code reuse and the establishment of hierarchical relationships between classes. 3. Method overriding and dynamic binding' are key mechanisms in inheritance, supporting polymorphism and enhancing flexibility in design lntroduced in Chap 3 - Polymorphism 25"
},
{
"page_index": 54,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_026.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_026.png",
"page_index": 54,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:11+07:00"
},
"raw_text": "EXTENSION: 06 COMPOSITION 26"
},
{
"page_index": 55,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_027.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_027.png",
"page_index": 55,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:17+07:00"
},
"raw_text": "OOP Composition Book 1 -name: String Author has -author:Author -name : String -price:double -email: String -qty:int = 0 -gender:char Author +Book(name:String,author:Author, -name : String No default values for the variables price:double) -email: String +Book(name:String,author:Author, -gender: char char of 'm' or 'f' price:double,qty:int) +getName() : String +Author(name:String +getAuthor:Author email:String, gender:char) +getName(): String +getPrice:double +setPrice(price:double):void +getEmail:String +getQty:int +setEmail(email:String):void +setQty(qty:int):void +getGenderO:char +toStringQ:String \"Author[name=?,email=?,gender=?]' +toStringQ : String \"Book[name=?,Author[name=?,email=?,gender=?]price=?,gty=?]\" You need to reuse Author's toString(). Complete this code: https://www.programiz.com/online-compiler/03auguyMRlCj0 27"
},
{
"page_index": 56,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_028.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_028.png",
"page_index": 56,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:22+07:00"
},
"raw_text": "Hands-on exercise Book m Author -name: String -name : String -authors:Author[] -email: String -price:double -gender: char -qty:int = 0 +Book(name: String,authors:Author[] price:double) +Book(name: String,authors:Author[] price:double,qty:int) +getName() : String +getAuthors):Author[] +getPrice:double \"Book[name=n,authors={Author[name=n, +setPrice(price:double):void email=e,gender=g], : : ..},price=p, +getQty:int qty=q]\" +setQty(qty:int):void +toString: Stringo 'authorName1,authorName2' +getAuthorNames():Stringo Complete this code: https://www.programiz.com/online-compiler/74XUfgm8cwc0G 28"
},
{
"page_index": 57,
"chapter_num": 2,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_029.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_2/slide_029.png",
"page_index": 57,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:25+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 58,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_001.png",
"page_index": 58,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:28+07:00"
},
"raw_text": "DAI HOC BK QUOC GIA TP. HO CHi MINH TP.HCM Advanced Programming C02039 Chapter 3: Object Oriented Programming Revision - Polymorphism DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 59,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_002.png",
"page_index": 59,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:30+07:00"
},
"raw_text": "CONTE NT INTRODUCTION TO 01 POLYMORPHISM KEY CONCEPTS OF 02 POLYMORPHISM 03 CONCLUSION 2"
},
{
"page_index": 60,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_003.png",
"page_index": 60,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:33+07:00"
},
"raw_text": "NTRODUCTIO N TO 01 POLYMORPHI SM 3"
},
{
"page_index": 61,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_004.png",
"page_index": 61,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:36+07:00"
},
"raw_text": "What is Polymorphism? In Java, polymorphism refers to the fact that you can have multiple methods with the same name in the same class Two kinds of polymorphism: Overloading: two or more methods with different signatures. Overriding: replacing an inherited method with another having the same signature 4"
},
{
"page_index": 62,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_005.png",
"page_index": 62,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:39+07:00"
},
"raw_text": "Polymorphism overview Iwo methods have to differ in their names or in the number or types of their parameters. Example: foo(int i) and foo(int t i, int j) are different foo(int i) and foo(int k) are the same foo(int i, double d) and foo(double d, int i) are different 5"
},
{
"page_index": 63,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_006.png",
"page_index": 63,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:43+07:00"
},
"raw_text": "Overloading vs. Overriding Overriding Overloading class Dog{ class Dog{ public voidbark}{ public voidbark(]{ System.out.prlntln(woof\": System.out.println(\"woof\"); } Same Method Name. } Same Method Name Different Parameter } Same parameter //overloading method class Hound extends Dog{ public voidbarkint num){ public void sniff(){ for(int i-0; i<num; i++) System.out.priptln(\"sniff\"); System.out.println(\"woof\"); } } } public voidbark({ System.out.println(\"bowl\"); } 6"
},
{
"page_index": 64,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_007.png",
"page_index": 64,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:46+07:00"
},
"raw_text": "int mainO #include <iostream> 1 Aa; B b; class A a.n = 1; b.n =2: a.f20; b.f20: public: int n; int fO {n++; return n;} return O; int f2O {fO; return n;} } }; class B: public A 1 public: int fO{n--; return n;} };"
},
{
"page_index": 65,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_008.png",
"page_index": 65,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:49+07:00"
},
"raw_text": "class A public class Main public int n; public static void main(String[] args) { public int fO {n++; return n;} A a = new AO; B b = new BO; public int f20 {fO; return n;} a.n = 1; b.n = 2; a.f20; b.f20; System.out.println(a.n)) }; System.out.println(b.n) class B extends A public int fO{n--; return n;} };"
},
{
"page_index": 66,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_009.png",
"page_index": 66,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:52+07:00"
},
"raw_text": "#include <iostream> int main0 class A Aa; B b; a=b; public: a.n=1; int n; a.f20; virtual int fO {n++; return n;} std: :cout<<a.n; int f2O {fO; return n;} return 0; }; } class B: public A public: virtual int fO{n--; return n; };"
},
{
"page_index": 67,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_010.png",
"page_index": 67,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:55+07:00"
},
"raw_text": "public class Main class A public static void main(String[] args) { public int n; Aa= newAO; B b = new BO; a = b; public int fO {n++; return n;} a.n = 1; a.f20; public int f2O {fO; return n;} System.out.println(a.n); //System.out.println(b.n) }; class B extends A 1 public int fO{n--; return n;} }; 10"
},
{
"page_index": 68,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_011.png",
"page_index": 68,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:31:57+07:00"
},
"raw_text": "KEY CONCEPTS OF 02 POLYMORPHI SM 11"
},
{
"page_index": 69,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_012.png",
"page_index": 69,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:01+07:00"
},
"raw_text": "Binding Dynamic Binding vs. Static Binding: Static Binding: Determined at compile-time. Dynamic Binding: Determined at runtime. Polymorphism requires dynamic binding Binding Static Dynamic 12"
},
{
"page_index": 70,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_013.png",
"page_index": 70,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:07+07:00"
},
"raw_text": "Binding in OOP languages ln C++: Static binding (default): the function to be called is determined during compilation Dynamic binding (using virtual): enables polymorphism by resolving function calls at runtime. In Java: Java uses dynamic binding by default for method overriding. The method invoked is determined at runtime based on the actual object, not the reference type. 13"
},
{
"page_index": 71,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_014.png",
"page_index": 71,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:11+07:00"
},
"raw_text": "Hands-on exercise class A { 1. What is the output? void f( { cout << \"A::f\"; } void f2( { fO; } 2. Is polymorphism used in this }; code? class B: public A { If it isn't, how can we implement void f( { cout << \"B::f\"; } }; it? int main) 3. Can you rewrite the code in A* a = new B; Python and Java? a->f2Oi // Output: ??? return 0: } 14"
},
{
"page_index": 72,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_015.png",
"page_index": 72,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:15+07:00"
},
"raw_text": "Key differences: c++ vs. Java Features C++ Java Default binding Static binding Dynamic binding Enabling dynamic Use virtual Always enabled for binding keyword overrides Polymorphism Requires explicit Default behaviour virtual Behind the scenes Requires explicit Abstracted as pointers object references 15"
},
{
"page_index": 73,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_016.png",
"page_index": 73,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:19+07:00"
},
"raw_text": "Why use r pointers for dynamic binding in Reaslon: In C++, the vtable (virtual table) is used to enable dynamic method resolution. When using pointers or references, the program accesses the vtable of the actual object to determine the appropriate method. Static Objects (No Pointer): Vtable lookup is skipped, leading to static binding Dynamic Objects (Pointer/Reference): Vtable is consulted, allowing polymorphism to work 16"
},
{
"page_index": 74,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_017.png",
"page_index": 74,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:20+07:00"
},
"raw_text": "03 CONCLUSION 17"
},
{
"page_index": 75,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_018.png",
"page_index": 75,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:24+07:00"
},
"raw_text": "Conclusion Polymorphism O A key OOP feature that enables objects to behave differently based on their actual type. Dynamic Binding: Required for polymorphism. Default in pure OOP languages like Java. C++ vs. Java: O C++: Static binding by default; use virtual for dynamic binding. O Java: Always dynamic binding 18"
},
{
"page_index": 76,
"chapter_num": 3,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_3/slide_019.png",
"page_index": 76,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:27+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 77,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_001.png",
"page_index": 77,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:30+07:00"
},
"raw_text": "DAI HOC BK QUOC GIA TP.HO CHi MINH TP.HCM Advanced Programming C02039 Chapter 4: Abstract class & Interface DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 78,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_002.png",
"page_index": 78,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:33+07:00"
},
"raw_text": "CONTE NT NTRODUCTION TO ABSTRACT CLASS 01 & INTERFACE 02 NTERFACE IN DEPTH 03 CONCLUSION 04 ADVANCED SECTION 2"
},
{
"page_index": 79,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_003.png",
"page_index": 79,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:35+07:00"
},
"raw_text": "NTRODUCTIO N TO 01 ABSTRACT CLASS & NTERFACE 3"
},
{
"page_index": 80,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_004.png",
"page_index": 80,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:38+07:00"
},
"raw_text": "What is Abstract class? An abstract class is a class that cannot be instantiated. It serves as a blueprint for other classes Key characteristics: Can include abstract methods (methods without implementation May also include concrete methods (methods with implementation Used when classes share common behavior but also require customization in subclasses. 4"
},
{
"page_index": 81,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_005.png",
"page_index": 81,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:42+07:00"
},
"raw_text": "Example in Java abstract class Shape { abstract void draw(); // Abstract method void infoQ { // Concrete method System.out.println(\"This is a shape\"); class Circle extends Shape { void draw { System.out.println(\"Drawing Circle\"); 5"
},
{
"page_index": 82,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_006.png",
"page_index": 82,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:45+07:00"
},
"raw_text": "What is lnterface? An interface is a classlike construct that contains only constants and abstract methods. Key characteristics: Cannot be instantiated (only classes that implements interfaces can be instantiated Why not just use Abstract class? = Java does not permit multiple inheritance but allow a class can implement multiple interfaces. Can an interface be implemented by multiple classes? 6 Mlo instancc ariahlas only constants alowed"
},
{
"page_index": 83,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_007.png",
"page_index": 83,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:48+07:00"
},
"raw_text": "Creating an Interface File InterfaceName.java: modifier is public or not modifier interface InterfaceName used. constants declarations; methods signatures; File ClassName.java: modifier Class ClassName implements InterfaceName : methods implementation; 7"
},
{
"page_index": 84,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_008.png",
"page_index": 84,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:51+07:00"
},
"raw_text": "Hands-on exercise interface Drawable { void draw); // Abstract method } class Rectangle implements Drawable { public void draw( { System.out.println(\"Drawing Rectangle\") : 2 Add new interface Area to calculate the area of a shape and implement it in Rectangle. Write main function to test. 8"
},
{
"page_index": 85,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_009.png",
"page_index": 85,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:53+07:00"
},
"raw_text": "NTERFACE IN 02 DEPTH 9"
},
{
"page_index": 86,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_010.png",
"page_index": 86,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:32:57+07:00"
},
"raw_text": "More in Interfaces (1) Compile-Time Dependency Problem: Normally, methods from one class to another need compile-time presence for signature checks. This creates rigid inheritance hierarchies, pushing shared functionality higher in the class tree Interfaces to the Rescue: Allow dynamic method resolution at runtime. Decouple method definitions from the class inheritance hierarchy Enable unrelated classes to implement the same interface. Key Benefit: Promote composition over inheritance and avoid the rigidity of deep class hierarchies. 10"
},
{
"page_index": 87,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_011.png",
"page_index": 87,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:00+07:00"
},
"raw_text": "More in Interfaces (2) Dynamic Method Resolution: The actual method is determined at runtime, not compile time. Calling code interacts with an interface or abstract class reference, not specific implementations. Benefit: Decouples calling code from concrete classes. Allows flexibility to add/change implementations without modifying the calling code 11"
},
{
"page_index": 88,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_012.png",
"page_index": 88,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:04+07:00"
},
"raw_text": "More in Interfaces - Example interface Shape { void draw(; } class circle implements Shape { public void draw( { System.out.println(\"Drawing a Circle\"); } } class Square implements Shape { public void draw( { System.out.println(\"Drawing a Square\"); } } public class Main { public static void main(String[] args) { Shape shape = new circle(); // Interface reference, dynamic resolution shape.drawO ; // Calls Circle's draw() method shape = new SquareO; : // Switch to a different implementation shape. drawO ; // Calls Square's draw() method 12"
},
{
"page_index": 89,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_013.png",
"page_index": 89,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:08+07:00"
},
"raw_text": "Does interface solve diamond problem? Interfaces help address the diamond problem in multiple inheritance, but indirectly: The diamond problem arises when a class inherits from two parent classes that define methods with the same name and signature leading to ambiguity In Java: Classes do not support multiple inheritance, which avoids this issue. Interfaces support multiple inheritance, but there's no ambiguity because a class implementing multiple interfaces 13 must explicitly define the methods it inherits."
},
{
"page_index": 90,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_014.png",
"page_index": 90,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:11+07:00"
},
"raw_text": "Example: lnterface in diamond problem interface A { default void show( { System.out.println(\"A\"); } interface B { default void show( { System.out.println(\"B\"); } } class C implements A, B { // Resolving the diamond problem @override public void show() { A.super.show(); // Explicitly choose which interface method to call } 14"
},
{
"page_index": 91,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_015.png",
"page_index": 91,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:13+07:00"
},
"raw_text": "03 CONCLUSION 15"
},
{
"page_index": 92,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_016.png",
"page_index": 92,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:18+07:00"
},
"raw_text": "Abstract class vs. Interface Feature Abstract class Interface Instantiation Cannot be Cannot be instantiated instantiated Methods Can have abstract Only abstract and concrete methods Variables Can have instance Only constants variables allowed Inheritance Supports single Supports multiple inheritance inheritance Accessibility Methods can have Methods are Modifiers any modifier implicitly public 16"
},
{
"page_index": 93,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_017.png",
"page_index": 93,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:20+07:00"
},
"raw_text": "ADVANCED 04 SECTION 17"
},
{
"page_index": 94,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_018.png",
"page_index": 94,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:22+07:00"
},
"raw_text": "Class diagram: Interface UML Notation: The interface name and the method names are italicized The dashed lines and hollow Shape K Circle Cylinder triangles are used to point to the interface. java.lang.Comparable compareTo 18"
},
{
"page_index": 95,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_019.png",
"page_index": 95,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:26+07:00"
},
"raw_text": "Classes & lnterfaces Interface1_2 Interface2_2K Interfacel Interface2_1K Interfacel . Object K Class1 Class2 Can you write a Java pseudocode for the above diagram? 19"
},
{
"page_index": 96,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_020.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_020.png",
"page_index": 96,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:30+07:00"
},
"raw_text": "The cloneable interface public class Circle extends Shape implements cloneable { private int x, y, radius; // Constructor // clone method @override public Object clone() { try { return super.clone(); } // Shallow copy catch (cloneNotSupportedException ex) { return null; } } Main function : Circle c1 = new circle(1, 2, 3); // Create an instance of circle Circle c2 = (circle) c1.clone(); // clone c1 into c2 20"
},
{
"page_index": 97,
"chapter_num": 4,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_021.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_4/slide_021.png",
"page_index": 97,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:32+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 98,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_001.png",
"page_index": 98,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:34+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Advanced Programming C02039 Chapter 5: Design Patterns DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 99,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_002.png",
"page_index": 99,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:38+07:00"
},
"raw_text": "CONTE NT NTRODUCTION TO DESIGN 01 PATTERNS CREATIONAL PATTERNS - 02 SINGLETON 03 STRUCTURAL PATTERNS - ADAPTER 04 BEHAVIORAL PATTERNS - OBSERVER 05 CONCLUSION 2"
},
{
"page_index": 100,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_003.png",
"page_index": 100,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:40+07:00"
},
"raw_text": "INTRODUCTIO 01 N TO DESIGN PATTERNS 3"
},
{
"page_index": 101,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_004.png",
"page_index": 101,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:46+07:00"
},
"raw_text": "What is a design pattern? Design patterns are typical The Software Design Khalil Stemmler & Architecture Stack @stemmlerjs solutions to commonly DTOs, Domain-Models, Transaction Scripts, Enterprise Patterns Repositories, Mappers, Value Objects occurring problems in Architectural Patterns Model-View-Controller, Domain-Driven Design Layered, Client-Server, Monolithic, software design Architectural Styles Component-based Policy vs. details, Coupling & cohesion, Architectural Principles dependencies, boundaries They are like pre-made scooe Design Patterns Observer, strategy, Factory, etc Composition Over Inheritance, Hollywood Principle, blueprints that you can Design Principles encapsulate what varies, SOLID, DRY, YAGNI Object-Oriented Inheritance, Polymorphism, Encapsulation, customize to solve a Programming Abstraction Programming Structured, Object-Oriented, Functional Paradigms recurring design problem in Name, construct, structure, style. Clean Code readability your code 4"
},
{
"page_index": 102,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_005.png",
"page_index": 102,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:49+07:00"
},
"raw_text": "Why should l learn I patterns? Design patterns are a toolkit of tried and tested solutions to common problems in software design. Even if you never encounter these problems, knowing patterns is still useful because it teaches you how to solve all sorts of problems using principles of object-oriented design. Design patterns define a common language that you and your teammates can use to communicate more efficiently Good designers don't always start from scratch to solve problems. They often use existing solutions! 5"
},
{
"page_index": 103,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_006.png",
"page_index": 103,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:54+07:00"
},
"raw_text": "Organiza Creational Design Structural Design Behavioral Design Pattern Pattern Pattern For handling Object creation For identifying ways to For handling communication mechanisms realize relationships between different objects between objects Constructor Adapter Chain of Responsibility Factory Bridge Command Abstract Composite Iterator Factory Prototype Decorator Mediator Singleton Facade Memento Builder Flyweight Observer Proxy State Strategy Template method Visitor 6"
},
{
"page_index": 104,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_007.png",
"page_index": 104,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:56+07:00"
},
"raw_text": "CREATIONAL 02 PATTERNS SINGLETON 7"
},
{
"page_index": 105,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_008.png",
"page_index": 105,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:33:59+07:00"
},
"raw_text": "What is Singleton? Singleton is a creational design pattern that lets you ensure that a class has only one instance, while providing a global access point to this instance WHY? Solve 2 problems violating Sing/e Responsibility Principle Ensure a single instance Prevent multiple instances of a class Control access to shared resources (e.g., database, files) Provide global access 8 Act livo ccidonta"
},
{
"page_index": 106,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_009.png",
"page_index": 106,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:02+07:00"
},
"raw_text": "Implementation All implementations of the Singleton have these two steps in common: Make the default constructor private, to prevent other objects from using the new operator with the Singleton class. Create a static creation method that acts as a constructor. Under the hood, this method calls the private constructor to create an object and saves it in a static field. All following calls to this method return 9"
},
{
"page_index": 107,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_010.png",
"page_index": 107,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:05+07:00"
},
"raw_text": "Structure Singleton instance: Singleton - Singleton0 Client + getlnstance0: Singleton I if (instance == null) { /Note: if you're creating an app with // multithreading support,you should place a thread lock here. instance = new Singleton0 return instance 10"
},
{
"page_index": 108,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_011.png",
"page_index": 108,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:08+07:00"
},
"raw_text": "Step-by-step instructions 1. Add a private static field to the class for storing the singleton instance. 2. Declare a public static creation method for getting the singleton instance. 3. Implement \"/azy initialization\" inside the static method It should create a new object on its first call and put it into the static field. The method should always return that instance on all subsequent calls. 4. Make the constructor of the class private. The static method of the class will still be able to call the constructor, 11"
},
{
"page_index": 109,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_012.png",
"page_index": 109,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:10+07:00"
},
"raw_text": "STRUCTURAL 03 PATTERNS ADAPTER 12"
},
{
"page_index": 110,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_013.png",
"page_index": 110,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:14+07:00"
},
"raw_text": "What is Adapter? Adapter is a structural design pattern that allows objects with incompatible interfaces to collaborate WHY? Solve compatibility issue - bridge incompatible interfaces Allow two incompatible classes to work together. Convert one interface into another expected by the client 13"
},
{
"page_index": 111,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_014.png",
"page_index": 111,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:17+07:00"
},
"raw_text": "Implementation Hide complexity: Wrap an object to handle conversion behind the scenes. Bridge interface: Allow incompatible objects to work together. How it works: 1. Adapter provides an interface matching the client's needs. 2. Client calls the adapter's methods 3. Adapter translates the reguest and forwards it to 14"
},
{
"page_index": 112,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_015.png",
"page_index": 112,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:20+07:00"
},
"raw_text": "Structure - Object adapter <interface> Client Interface Client + method(data A Adapter Service adaptee: Service + method(data) + serviceMethod(specialData - specialData = convertToServiceFormat(data) return adaptee.serviceMethod(specialData) 15"
},
{
"page_index": 113,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_016.png",
"page_index": 113,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:23+07:00"
},
"raw_text": "Structure - Class adapter Existing Class Service Client + method(data + serviceMethod(specialData 4 Adapter + method(data) specialData = convertToServiceFormat(data) return serviceMethod(specialData 16"
},
{
"page_index": 114,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_017.png",
"page_index": 114,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:27+07:00"
},
"raw_text": "Step-by-step instructions 1. Make sure that you have at least two classes with incompatible interfaces: a. A useful service class, which you can't change b. One or several client classes that would benefit from using the service class 2. Declare the client interface and describe how clients communicate with the service. 3. Create the adapter class and make it follow the client interface Leave all the methods empty for now. 4. Add a field to the adapter class to store a reference to the service object 17"
},
{
"page_index": 115,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_018.png",
"page_index": 115,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:30+07:00"
},
"raw_text": "Example: Sensor problem class TS7000 native double getTempO; // New sensor device class SuperTempReader { // NoTE: temperature is Celsius tenths of a degree native double current_readingQ; double sum = 0.0; } for/(int i = 0; i < sensors.length; i++) sum +=9 sensors[i].getTemp(D; double meanTemp = sum / sensors.length; 18"
},
{
"page_index": 116,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_019.png",
"page_index": 116,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:33+07:00"
},
"raw_text": "Without adapter pattern for (int i = 0; i < sensors.length; i++){ if (sensors[i] instanceof Ts70oo) += ((Ts70oo)sensors[i]).getTemp(); sum else // Must be a SuperTemp! * 10: sum += ((SuperTempReader)sensors[i]).current_reading 19"
},
{
"page_index": 117,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_020.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_020.png",
"page_index": 117,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:37+07:00"
},
"raw_text": "Adapter to the rescue (1) TempSensor Client TS7000 getTemperature getTemp0 sensor STRAdapter TS7000Adapter getTemperature0 getTemperatureO sensorw sensor->getTemp( SuperTempReader current_reading0 sensor->current_reading 20"
},
{
"page_index": 118,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_021.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_021.png",
"page_index": 118,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:41+07:00"
},
"raw_text": "Adapter to the rescue (2) abstract class TempSensor{ class TS7oooAdapter extends TempSensor{ abstract double getTemperatureD : public double getTemperature({ } return sensor.getTempQ : } class STRAdapter extends TempSensor{ } public double getTemperatureQ{ return sensor.current_reading ? 10 ; double sum = 0.0: } for (int i = 0; i < sensors.length; i++ } sum += sensors[i]:getTemperatureD : 21"
},
{
"page_index": 119,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_022.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_022.png",
"page_index": 119,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:42+07:00"
},
"raw_text": "BEHAVIORAL 04 PATTERNS OBSERVER 22"
},
{
"page_index": 120,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_023.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_023.png",
"page_index": 120,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:47+07:00"
},
"raw_text": "What is Observer? Observer is a behavioral design pattern that lets you define a subscription mechanism to notify multiple objects about any events that happen to the object they're observing WTF?! STORE WTF?! WTF?! SOON! H H WTF?! WTF?! AY WTF?! WTF?! H 23"
},
{
"page_index": 121,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_024.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_024.png",
"page_index": 121,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:51+07:00"
},
"raw_text": "Implementation Subscriber + update0 ber Hey, sign me Publisher Publisher up, please! Subscriber Subscriber - subscribers[] notifySubscribers0 + update0 + addSubscriber(subscriber) Subscriber + removeSubscriber(subscriber) Me too! Guys, I just want Subscriber to let you know that A subscription mechanism lets something has just happened to me. + update0 individual objects subscribe to event notifications. Publisher notifies subscribers by calling the specific notification method on their objects. 24"
},
{
"page_index": 122,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_025.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_025.png",
"page_index": 122,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:54+07:00"
},
"raw_text": "Structure Publisher <interface> - subscribers: Subscriber[ Subscriber mainState foreach (s in subscribers) + update(context s.update(this) + subscribe(s: Subscriber) 4 + unsubscribe(s: Subscriber) mainState = newState + notifySubscribers0 Concrete notifySubscribers0 + mainBusinessLogic0 Subscribers s= new ConcreteSubscriber0 + update(context publisher.subscribe(s) Client 25"
},
{
"page_index": 123,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_026.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_026.png",
"page_index": 123,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:34:59+07:00"
},
"raw_text": "Step-by-step instructions 1. Separate Business Logic Identify core functionality - Acts as the Publisher Identify dependent components -> Act as Subscribers 1. Define Interfaces Subscriber Interface - Declares update() method Publisher Interface -> Methods to add/remove subscribers 1. Manage Subscriptions Store subscriber list in an abstract class (for reusability) Alternative: Use composition to separate subscription logic L. Implement Concrete Classes Publisher: Notifies all subscribers when an event occurs Subscriber: Implements update() method to react to changes 1./Register Subscribers: Clients create subscribers and attach them to publishers 26"
},
{
"page_index": 124,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_027.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_027.png",
"page_index": 124,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:01+07:00"
},
"raw_text": "05 CONCLUSION 27"
},
{
"page_index": 125,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_028.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_028.png",
"page_index": 125,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:04+07:00"
},
"raw_text": "Conclusion Design Patterns provide reusable solutions to common software design problems, improving code structure and maintainability. singleton ensures a class has only one instance and provides global access, useful for managing shared resources Adapter acts as a bridge between incompatible interfaces, enabling seamless integration of different systems 28"
},
{
"page_index": 126,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_029.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_029.png",
"page_index": 126,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:06+07:00"
},
"raw_text": "References [1] Alexander Shvets (2018). Dive /nto Design Patterns 29"
},
{
"page_index": 127,
"chapter_num": 5,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_030.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_5/slide_030.png",
"page_index": 127,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:09+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 128,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_001.png",
"page_index": 128,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:11+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Advanced Programming CO2039 Chapter 1: Stateless Programming DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 129,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_002.png",
"page_index": 129,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:13+07:00"
},
"raw_text": "CONTE NT IMPERATIVE VS 01 DECLARATIVE CORE PRINCIPLES OF FUNCTIONAL 02 PROGRAMMING 03 CONCLUSION 2"
},
{
"page_index": 130,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_003.png",
"page_index": 130,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:15+07:00"
},
"raw_text": "IMPERATIVE 01 VS DECLARATIVE 3"
},
{
"page_index": 131,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_004.png",
"page_index": 131,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:19+07:00"
},
"raw_text": "Imperative languages Based on von Neumann architecture Relies on modifying variables (state changes) Use assignment to modify program state Central Processing Unit Control Unit Figure 1: von Input Output Arithmetic/Logic Unit Neumann Device Device architecture Memory Unit 4"
},
{
"page_index": 132,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_005.png",
"page_index": 132,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:22+07:00"
},
"raw_text": "What is a state? Programs in imperative languages rely heavily on modifying the values of a collection of variables, called the state Before execution, the state has some initial value o. During execution, each command changes the state: 0=0.-01-02-...-0=0 5"
},
{
"page_index": 133,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_006.png",
"page_index": 133,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:26+07:00"
},
"raw_text": "Declarative languages No state - State-oriented computations are accomplished by carrying the state around explicitly rather than implicitly Uses expressions instead of commands Loops are replaced by recursion Functional Languages: The underlying model of computation is function. Logic Programming Languages: The underlying model of computation is predicates 6"
},
{
"page_index": 134,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_007.png",
"page_index": 134,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:30+07:00"
},
"raw_text": "Example: Factorial (1) n := X : def factorial(x) : a := 1: if x == 1: while e n > 0 do return 1 begin else : a a n; return x n : = n factorial(x-1) 1; Factodal in Imperative Factorial in Functiona Style Style The value of the program is the desired factorial rather than storing it in a store. Declarative programming is often described as expressing what is being computed rather than how. 7"
},
{
"page_index": 135,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_008.png",
"page_index": 135,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:33+07:00"
},
"raw_text": "CORE PRINCIPLES 02 OF FUNCTIONAL PROGRAMMING 8"
},
{
"page_index": 136,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_009.png",
"page_index": 136,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:36+07:00"
},
"raw_text": "Functional Programming Functions are first class values. O A data type is first class if it can be used anywhere passed to and returned from functions, assigned to variables May also have imperative constructs. O Examples: Lisp, Scheme, ML, Erlang Pure functional languages have no implicit side-effects or other imperative features. Examples: Miranda, Haskell 9"
},
{
"page_index": 137,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_010.png",
"page_index": 137,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:39+07:00"
},
"raw_text": "Example: Factorial (2) 1;x = 1 fact(x) = x * fact(x - 1) factorial : : Integer -> Integer factorial 0 1 factorial * factorial n - n (n - 1 Factorial in Haskell 10"
},
{
"page_index": 138,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_011.png",
"page_index": 138,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:42+07:00"
},
"raw_text": "Why functional programming? John Backus (Fortran Creator) argued Fp is better than imperative programming. Functional programming removes state and assignments. Enables parallel execution (Concurrency without race conditions) Algebraic laws Reason about programs Optimizing compilers 11"
},
{
"page_index": 139,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_012.png",
"page_index": 139,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:46+07:00"
},
"raw_text": "Von Neumann bottleneck Von Neumann bottleneck: pumping single words back and forth between CPU and store = Task of a program: change store in some major way It has kept us tied to word-at-a-time thinking Instead of encouraging us to think in terms of the larger conceptual units of the task at hand. The assignment statement is the von Neumann bottleneck of programming languages = Pure functional programming languages remove state and assignments. Concurrency possible: order of evaluation doesn't matter. 12"
},
{
"page_index": 140,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_013.png",
"page_index": 140,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:50+07:00"
},
"raw_text": "A referentially transparent function is a function that, given Referential transparency result - Do we have such property in imperative languages? If the function has side-effects (updating a global variable doing input or output), then f(3) + f(3) may not be the same as 2 *f(3). The second f(3) has a different meaning than the first Purely declarative languages guarantee referential transparency The importance of referential transparency is that it allows a 13"
},
{
"page_index": 141,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_014.png",
"page_index": 141,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:52+07:00"
},
"raw_text": "03 CONCLUSION 14"
},
{
"page_index": 142,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_015.png",
"page_index": 142,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:56+07:00"
},
"raw_text": "Conclusion Imperative vs Declarative Programming Imperative: State-based, step-by-step execution Declarative: Focus on \"what\" rather than \"how' Core Principles of Functional Programming Pure Functions - No side effects Immutability - Data doesn't change after creation Higher-Order Functions - Functions as first-class values Recursion replaces loops Von Neumann Bottleneck Traditional imperative programming relies on modifying shared memory Functional Programming removes mutable state - better parallelism 15"
},
{
"page_index": 143,
"chapter_num": 6,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_6/slide_016.png",
"page_index": 143,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:35:59+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 144,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_001.png",
"page_index": 144,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:01+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Advanced Programming CO2039 Chapter 2: Programming with Python DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 145,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_002.png",
"page_index": 145,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:04+07:00"
},
"raw_text": "CONTE NT 01 VARIABLES & DATA TYPES 02 DATA STRUCTURES 03 CONDITIONALS. LOOPS AND EXCEPTIONS 04 CONCLUSION 2"
},
{
"page_index": 146,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_003.png",
"page_index": 146,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:06+07:00"
},
"raw_text": "VARIABLES & 01 DATA 1TYPES 3"
},
{
"page_index": 147,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_004.png",
"page_index": 147,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:09+07:00"
},
"raw_text": "Python Syntax Overview # Python (No semicolons, indentation-based) print(\"Hello, Python!\" # Java (curly braces, semicolons) public class Main { public static void main(String[] args) { System.out.println(\"Hello, Java!\"); } Python uses indentation instead of {} No semicolons required 4"
},
{
"page_index": 148,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_005.png",
"page_index": 148,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:13+07:00"
},
"raw_text": "Variables & Data Types in Python Python is dynamically typed - No need to declare data types explicitly Data Type Example Description Integer X = 10 Whole numbers Float pi = 3.14 Decimal numbers String \"Alice\" name Text is valid = True Boolean True or False NoneType x = None Represents \"nothing 5"
},
{
"page_index": 149,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_006.png",
"page_index": 149,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:14+07:00"
},
"raw_text": "DATA 02 STRUCTURES 6"
},
{
"page_index": 150,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_007.png",
"page_index": 150,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:18+07:00"
},
"raw_text": "Python Built-in Data Structures Lists (Ordered, Mutable) fruits = [\"apple\", \"banana\", \"cherry\"] fruits.append(\"orange\") # Add element print(fruits[1]) # Output : banana - Ordered, allows duplicates, mutable Tuples (Ordered, Immutable) coordinates = (10, 20) print(coordinates[o]) # 0utput: 10 - Like lists but immutable 7"
},
{
"page_index": 151,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_008.png",
"page_index": 151,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:21+07:00"
},
"raw_text": "Python Built-in Data Structures Sets (Unordered, Unique Elements) unique_numbers = {1, 2, 3, 3} print(unique_numbers) # 0utput: {1, 2, 3} - No duplicates, unordered Dictionaries (Key-Value Pairs) student = {\"name\": \"Alice\", \"age\": 2o} print(student[\"name\"] # Output: Alice - Stores data as key-value pairs 8"
},
{
"page_index": 152,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_009.png",
"page_index": 152,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:23+07:00"
},
"raw_text": "lype conversions X = 1 10 y = str(x) # Convert int to string print(y) # Output: \"10\" Common conversions: int(\"1oo\") -> Converts string to integer float(\"3.14\") - Converts string to float str(5o) - Converts integer to string 9"
},
{
"page_index": 153,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_010.png",
"page_index": 153,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:26+07:00"
},
"raw_text": "CONDITIONAL 03 S, LOOPS & EXCEPTIONS 10"
},
{
"page_index": 154,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_011.png",
"page_index": 154,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:29+07:00"
},
"raw_text": "Conditional Statements age = 18 if age >= 18: print(\"Adult\" elif age >= 13: print(\"Teenager\") else : print(\"child\") - Indentation is required (No {} like Java or C++) 11"
},
{
"page_index": 155,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_012.png",
"page_index": 155,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:32+07:00"
},
"raw_text": "Loops for Loop (lterate over a sequence for i in range(5) : print(i) # Output: 0 1 2 3 4 - Loops through a range or collection while Loop (Repeats until condition is false) x = 0 while x < 5: print(x) X += 1 - Use break to stop the loop early 12"
},
{
"page_index": 156,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_013.png",
"page_index": 156,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:35+07:00"
},
"raw_text": "Functions Defining and calling a function def greet(name) : return \"Hello, i + name print(greet(\"Alice\")) # Output: Hello, Alice Supports default and keyword arguments def greet(name=\"Guest\") : print(greetO) # Output: Hello, Guest 13"
},
{
"page_index": 157,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_014.png",
"page_index": 157,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:39+07:00"
},
"raw_text": "Classes Defining a simple class for data storage class Student : def - init_-(self, name, age) : self.name = name self.age = age student1 = Student(\"Alice\", 20 print(student1.name) # 0utput: Alice init_) - Constructor that initializes object properties self - Refers to the instance of the class 14"
},
{
"page_index": 158,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_015.png",
"page_index": 158,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:41+07:00"
},
"raw_text": "Exception Handling Handling errors with try-except try : x = int(\"abc\" # Error: Cannot convert string to int except ValueError : print(\"Invalid input\") - Prevents program crashes due to runtime errors 15"
},
{
"page_index": 159,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_016.png",
"page_index": 159,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:43+07:00"
},
"raw_text": "03 CONCLUSION 16"
},
{
"page_index": 160,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_017.png",
"page_index": 160,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:45+07:00"
},
"raw_text": "Conclusion Python is dynamically typed and easy to use Supports various built-in data structures Uses indentation for code blocks Includes conditional statements, loops, functions, classes and exception handling 17"
},
{
"page_index": 161,
"chapter_num": 7,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_7/slide_018.png",
"page_index": 161,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:48+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 162,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_001.png",
"page_index": 162,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:51+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP. HÖ CHi MINH TP.HCM Advanced Programming CO2039 Chapter 3: List comprehension Part of the Functional Programming paradigm DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 163,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_002.png",
"page_index": 163,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:54+07:00"
},
"raw_text": "CONTE NT NTRODUCTION TO PYTHON LISTS: 01 CREATION, ACCESS, SLICING MODIEYING AND ITERATING THROUGH 02 LIsts 03 CONCLUSION 2"
},
{
"page_index": 164,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_003.png",
"page_index": 164,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:56+07:00"
},
"raw_text": "INTRODUCTIO 01 N TO PYTHON LISTS 3"
},
{
"page_index": 165,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_004.png",
"page_index": 165,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:36:59+07:00"
},
"raw_text": "Creating a Python List Create a list by placing elements inside square brackets [] separated by commas. Can also store data of different data types in a list. In Python, lists are: Ordered - They maintain the order of elements. Mutable - Items can be changed after creation Allow duplicates - They can contain duplicate values 4"
},
{
"page_index": 166,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_005.png",
"page_index": 166,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:02+07:00"
},
"raw_text": "Access List Elements The index of first item is 0, the index of second item is 1 and so on. Can also have negative indices. - The index of the last element is -1, the second last element is -2 and so on. ['Python', 'Swift', 'C++'] Index 0 1 2 Negativelndex -3 -2 -1 5"
},
{
"page_index": 167,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_006.png",
"page_index": 167,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:05+07:00"
},
"raw_text": "Slicing of a List in Python (1 The format for list slicing is list_name[start : stop : step] start is the index of the list where slicing starts. stop is the index of the list where slicing ends step allows you to select nth item within the range start to stop. 6"
},
{
"page_index": 168,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_007.png",
"page_index": 168,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:09+07:00"
},
"raw_text": "Slicing of a List in Python (2) Example my_list = ['p', 'r', 'o', 'g', 'r', 'a', 'm'] print(\"my_list =\", my_list) => full list print(\"my_list[2:5] l =\", my_list[2:5] => o, g, r print(\"my_list[2:-2] ] =\", my_list[2:-2] => o, g, r print(\"my_list[0:3] =\", my_list[0:3])=> p, r o 7"
},
{
"page_index": 169,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_008.png",
"page_index": 169,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:12+07:00"
},
"raw_text": "Omitting Start and End Indices in Slicing If you omit the start index, the slicing starts from the first element. If you omit the last index, the slicing ends at the last element Example: my_list = ['p', 'r', 'o', 'g', ' 'a', 'm'] print(\"my_list[5: ] =\", my_list[5: ] => a, m print(\"my_list[:-4] =\", my_1ist[:-4] => p, r, o print(\"my_list[:] =\", my_list[:])=> full list print(\"my_list[::2] =\", my_list[::2] => p , o, r, m 8"
},
{
"page_index": 170,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_009.png",
"page_index": 170,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:14+07:00"
},
"raw_text": "MODIFYING AND 02 ITERATING THROUGH LISTS 9"
},
{
"page_index": 171,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_010.png",
"page_index": 171,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:17+07:00"
},
"raw_text": "Add Elements to a Python List Add an item to the end of a list = append() Insert an element at the specified index to a list = insert() Add all the items of the specified iterable to the end of a list extend) Example fruits = ['apple', 'banana', 'orange'] fruits.append('cherry') fruits.insert(2, 'kiwi') favorite_fruits = ['mango', 'lemon', 'pineapple' fruits.extend(favorite_fruits 10"
},
{
"page_index": 172,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_011.png",
"page_index": 172,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:20+07:00"
},
"raw_text": "Maaifye@heimandts iint by Psyithemewistlues - - operator. Remove the specified item from a list = remove( Can also delete an item from a list = de1 statement - de1 can also be used to delete multiple elements or even the entire list. Example: names = ['John','Eva', 'Laura', 'Nick', 'Jack'] names.remove( Laura' ) del names[1] del names[1:3] 11 del names"
},
{
"page_index": 173,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_012.png",
"page_index": 173,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:23+07:00"
},
"raw_text": "Iterating Through a List Find the number of elements (length) of a list = built-in 1en( We can use a for loop to iterate over the elements of a list Example: fruits = ['apple', 'banana', 'orange'] for fruit in fruits: print(fruit) 12"
},
{
"page_index": 174,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_013.png",
"page_index": 174,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:25+07:00"
},
"raw_text": "Python List Comprehension (1) List comprehension offers a concise way to create a new list based on the values of an existing list Syntax: [expression for item in list if condition == True] for every item in list, execute the expression if the condition is True. The if statement in list comprehension is optional. 13"
},
{
"page_index": 175,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_014.png",
"page_index": 175,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:29+07:00"
},
"raw_text": "Python List Comprehension (2) Example : numbers = [1, 2, 3, 4] doubled_numbers = [num * 2 for num in numbers] print(doubled_numbers) # 0utput: [2, 4, 6, 8] Create a new list with items num*2 where num is item of numbers doubled_numbers for num 2 num in numbers X 14"
},
{
"page_index": 176,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_015.png",
"page_index": 176,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:33+07:00"
},
"raw_text": "Python List Comprehension (2 Example: numbers = [1, 2, 3, 4] doubled evens = [num n * 2 for num in numbers if num % 2 == 01 print(doubled_evens # 0utput: [4, 8] Create a new list with items num*2 where num is item of numbers doubled numbers 2 for num X num in numbers 15"
},
{
"page_index": 177,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_016.png",
"page_index": 177,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:35+07:00"
},
"raw_text": "03 CONCLUSION 16"
},
{
"page_index": 178,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_017.png",
"page_index": 178,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:38+07:00"
},
"raw_text": "Conclusion Lists in Python are versatile and mutable, making them essential for data manipulation. You can create, access, and slice lists efficiently Lists allow adding, removing, and modifying elements dynamically Iteration techniques, including loops and list comprehensions, provide powerful ways to process data. 17"
},
{
"page_index": 179,
"chapter_num": 8,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_8/slide_018.png",
"page_index": 179,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:41+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 180,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_001.png",
"page_index": 180,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:44+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Advanced Programming CO2039 Chapter 4: Lambda calculus Part of the Functional Programming paradigm DAI HQC QUÖC GIA THANH PHÖ HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 181,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_002.png",
"page_index": 181,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:47+07:00"
},
"raw_text": "CONTE NT 01 CALCULATING WITH LAMBDA CALCULUS 02 REDUCTION IMPLEMENTING BUILTEIN CONSTANTS & 03 FUNCTIONS 04 CONCLUSION 2"
},
{
"page_index": 182,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_003.png",
"page_index": 182,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:50+07:00"
},
"raw_text": "Brief History Origin: formal theory of substitution O For first-order logic, etc. More successful with computable functions Substitution - symbolic computation Church-Turing thesis cacuus in 1936 3"
},
{
"page_index": 183,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_004.png",
"page_index": 183,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:52+07:00"
},
"raw_text": "Church-Turing Test Any natural / reasonable notion of computation realizable in the physical world can be simulated by a TM (or equivalently, by lambda calculus). 4"
},
{
"page_index": 184,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_005.png",
"page_index": 184,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:54+07:00"
},
"raw_text": "CALCULATING 01 WITH LAMBDA CALCULUS 5"
},
{
"page_index": 185,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_006.png",
"page_index": 185,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:37:57+07:00"
},
"raw_text": "What is Functional Language? \"No side effects\" Pure functional language: a language with functions, but without side effects or other imperative features 6"
},
{
"page_index": 186,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_007.png",
"page_index": 186,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:00+07:00"
},
"raw_text": "No-Side-Effects Language Test begin integer x=3; integer y=4; 5*(x+y)-3 // no new declaration of x or y // 4*(x+y)+1 end 7"
},
{
"page_index": 187,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_008.png",
"page_index": 187,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:02+07:00"
},
"raw_text": "Expressions and Functions Expressions x + y x + 2*y + z Functions x.(x+y) Az.(x+2*y+z) Application (Ax.(x+y) 3) 3 + y (z.(x+2*y+z)) 5 X + 2*y + 5 Parsing: Ax.f (f x) = Ax.(f (f(x))) 8"
},
{
"page_index": 188,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_009.png",
"page_index": 188,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:05+07:00"
},
"raw_text": "Terminology Ax.t the scope of x is the term t x.x y y is free in the term Ax.x y x is bound in the term Ax.x y 9"
},
{
"page_index": 189,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_010.png",
"page_index": 189,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:08+07:00"
},
"raw_text": "Free & Bound Variables (1) Bound variable is a \"placeholder\" O Variable x is bound in x.(x+y) Function Ax. (x+y) is same function as Az. (z+y) Name of free (i.e., unbound) variable matters! Variable y is free in x. (x+y) Function Ax.(x+y) is not same as Ax.(x+z) Occurrences: y is free and bound in Ax.((y.y+2) x + y 10"
},
{
"page_index": 190,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_011.png",
"page_index": 190,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:10+07:00"
},
"raw_text": "Free & Bound Variables (2) In A Calculus all variab/es are local to function definitions Examples: x.xy: x is bound, while y is free; (x.x) (y .yx) : x is bound in the first function, but free in the second function Ax. (Ay. yx) : x and y are both bound variables. (it can be abbreviated as Axy .yx) 11"
},
{
"page_index": 191,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_012.png",
"page_index": 191,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:12+07:00"
},
"raw_text": "02 REDUCTION 12"
},
{
"page_index": 192,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_013.png",
"page_index": 192,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:15+07:00"
},
"raw_text": "CBV Operational Semantics Single-step, call-by-value Os: t - t' Values are: v : : = x.t Primary rule (B-reduction): (Ax.t)v - t[v/x] t[v/x] is the term in which all occurrences of x in t are replaced with v This replacement operation is called substitution 13"
},
{
"page_index": 193,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_014.png",
"page_index": 193,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:18+07:00"
},
"raw_text": "Examples Example 1: (Ax.x x)(y.y) X X [yy/x] (y.y)(y.y) - y [y.y/y] y.y Example 2: (x.x x)(x.x x) , X X x.x x/x] (Ax.x x)(Ax.x x) 14"
},
{
"page_index": 194,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_015.png",
"page_index": 194,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:21+07:00"
},
"raw_text": "Higher-order Functions Given function f, return function f o f: Af.Ax.f (f x) How does this work? (Af.Ax.f (f x))(y.y+1 Ax.(y.y+1)((y.y+1)x Ax.(y.y+1)(x+1) - Ax.(x+1)+1 15"
},
{
"page_index": 195,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_016.png",
"page_index": 195,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:23+07:00"
},
"raw_text": "Declaration of \"Syntactic Sugar\" def f(x): return x + 2 print(f(5)) # 0utput: 7 (f.f(5))(Ax.x+2) bock declared body func 16"
},
{
"page_index": 196,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_017.png",
"page_index": 196,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:27+07:00"
},
"raw_text": "Rules a-reduction (renaming) y.m AV.(M [y v]) = a where v does not occur in M. B-reduction (substitution) (ax.m) N =s M [x N] 17"
},
{
"page_index": 197,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_018.png",
"page_index": 197,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:29+07:00"
},
"raw_text": "Attention Some A-calculus terms can be B-reduced forever! Example: Let D be this expression: (Ax.x x) . What is the value of this expression (D D)? (D D) = (Ax.x x (Ax.x x) - (Ax.x x (Ax.x x) - .) - It NEVER terminates! The order in which you choose to do the reductions might change the result! 18"
},
{
"page_index": 198,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_019.png",
"page_index": 198,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:32+07:00"
},
"raw_text": "Attention (cont.) Now consider this expression: (Ax.3 (D D) 1. Lazy Evaluation (Call-by-name): Only evaluate the argument if it's needed. No need to evaluate (D D) because x is not used inside the body 3 Skip evaluating D D entirely and return 3 immediately 2. Eager Evaluation (Call-by-value): Evaluate the argument before calling the function - Before applying (Ax.3) to (D D), we try to compute (D D)... 19"
},
{
"page_index": 199,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_020.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_020.png",
"page_index": 199,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:34+07:00"
},
"raw_text": "IMPLEMENTING BUILT-IN 03 CONSTANTS & FUNCTIONS 20"
},
{
"page_index": 200,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_021.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_021.png",
"page_index": 200,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:38+07:00"
},
"raw_text": "WuffldiRrgenhthirgnistantsmana\"rnationsaraysing A-abstractions. Example : We can encode booleans, consider representing \"true\" and \"false\" as functions named \"tru\" and \"fls' How do we define these functions? Think about how \"true\" and \"false\" can be used. They can be used by a testing function: \"test b then else\" returns \"then\" if b is true and returns \"else\" if b is false The only thing the implementation of test will do with b is to apply it. The functions \"tru\" and \"fls\" must distinguish themselves when 21"
},
{
"page_index": 201,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_022.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_022.png",
"page_index": 201,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:42+07:00"
},
"raw_text": "Building in Constants and Functions (2) The encoding: tru =At.Af.t fls = At:Af.f test = Ax.Athen.Aelse.x then else Example: testtru (Ax.t1 (ax.t2) X (at:Af.t) (ax.t1) (ax.t2) * x.t1 22"
},
{
"page_index": 202,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_023.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_023.png",
"page_index": 202,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:46+07:00"
},
"raw_text": "Building in Constants and Functions (3) tru = At.Af.t fls = At.Af.f and : = Ab.Ac.b c fls and l tru tru 1 * tru tru fls tru and fls fls fls tru fls y * * fls 23"
},
{
"page_index": 203,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_024.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_024.png",
"page_index": 203,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:49+07:00"
},
"raw_text": "Numbers 0 := Af.Ax.x 1 := Af.Ax.f x 2 := Af.Ax.f (f x) 3 := Af.Ax.f (f (f x)) 4 := Af.Ax.f (f (f (f x)) SUM := Am.An.Af.Ax.m f (n f x PROD:= Am.An.Af.Ax.m (n f) x SUBTRACT := Am.An.n PRED m Apply the predecessor function (PRED) n times to m How to compute predecessor? Can implement using pairs! 24"
},
{
"page_index": 204,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_025.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_025.png",
"page_index": 204,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:52+07:00"
},
"raw_text": "Data Structures - Pair Let E, F be arbitrary normal form expressions. A pair (E, F) can be represented as the normal form lambda expression: Af:f E F The function to construct a pair is then: PAIR := Ax.Ay.Af.f x y If p is a pair (E, F), i.e., Af.f E F then how do we get its parts? = p TRUE gives us E,and p FALSE gives us F. FIRST := Ap.P TRUE SECOND := Ap.P FALSE 25"
},
{
"page_index": 205,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_026.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_026.png",
"page_index": 205,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:55+07:00"
},
"raw_text": "Data Structures - List Can turn our method of pairing arbitrary normal form expressions into building up lists. All we need is a way to mark the end of the list (NIL) and a way to tell if we're at the end of the list (ISEMPTY) NIL := AX.TRUE ISEMPTY := p.p (AX.y.FALSE ISEMPTY NIL = (p.P (Ax.Ay.FALSE)) (AX. TRUE) (AX.TRUE ) (AX.Ay.FALSE) - TRUE ISEMPTY (PAIR E F) = (p.p (Ax.Ay.FALSE)) (Af.f E F (Af.f E F) (AX.Ay.FALSE) - (AX.Ay.FALSE) E F - FALSE 26"
},
{
"page_index": 206,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_027.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_027.png",
"page_index": 206,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:38:59+07:00"
},
"raw_text": "Predecessor To compute m-n, apply the predecessor function n times to m SUBTRACT := Am.An.n PRED m Predecessor using pairs: PRED := An.FIRST (n NEXT (PAIR O O)) NEXT := p.PAIR (SECOND p) (SUM 1 (SECOND p) 27"
},
{
"page_index": 207,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_028.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_028.png",
"page_index": 207,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:00+07:00"
},
"raw_text": "04 CONCLUSION 28"
},
{
"page_index": 208,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_029.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_029.png",
"page_index": 208,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:03+07:00"
},
"raw_text": "Conclusion Lambda calculus is a minimal yet powerful model of computation. Encodes numbers, booleans, data structures, and even control flow In lambda calculus, some expressions can lead to infinite loops. 29"
},
{
"page_index": 209,
"chapter_num": 9,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_030.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_9/slide_030.png",
"page_index": 209,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:06+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
},
{
"page_index": 210,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_001.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_001.png",
"page_index": 210,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:09+07:00"
},
"raw_text": "DAI HOC BK QUOC GIA TP. HO CHi MINH TP.HCM Advanced Programming C02039 Chapter 5: Functions as First- Class Citizens - Lambda, Higher-Order, Currying Part of the Functional Programming paradigm DAI HQC QUOC GIA THANH PHO HO CHi MINH TRUONG DAI HOC BACH KHOA TP.HCM,03/01/2025"
},
{
"page_index": 211,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_002.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_002.png",
"page_index": 211,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:12+07:00"
},
"raw_text": "CONTE NT 01 LAMBDA FUNCTION 02 HIGHER-ORDER FUNCTION 03 CURRYING 04 CONCLUSION 2"
},
{
"page_index": 212,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_003.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_003.png",
"page_index": 212,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:13+07:00"
},
"raw_text": "LAMBDA 01 FUNCTION 3"
},
{
"page_index": 213,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_004.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_004.png",
"page_index": 213,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:17+07:00"
},
"raw_text": "ambda Function Also called anonymous function - function defined without a name No need to use def keyword = use lambda to define the functions Have its own local namespace & cannot access variables other than those in its parameter list and those in the global namespace Syntax lambda [arg [, arga, argn: expression 4"
},
{
"page_index": 214,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_005.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_005.png",
"page_index": 214,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:20+07:00"
},
"raw_text": "Example Lambda calculus: Ax.y.+ x y Python: sum = lambda arg1, arg2: arg1 + arg2 print(\"value of total : \" sum(10, 20)) print(\"value of total : \" sum(20, 20)) Q: Given a lambda expression as follows: (Af.f(5) (Ax.+ x 2) Write the corresponding Python code. 5"
},
{
"page_index": 215,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_006.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_006.png",
"page_index": 215,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:22+07:00"
},
"raw_text": "HIGHER-ORDER 02 FUNCTION 6"
},
{
"page_index": 216,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_007.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_007.png",
"page_index": 216,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:24+07:00"
},
"raw_text": "Higher-order Function (1) Given function f, return function f . f Af.Ax.f (f x) How does this work? (Af.Ax.f (f x)) (Ay.+ y 1 = Ax.(Ay.+ y 1) ((Xy.+ y 1) x =Ax.(Ay.+ y 1) (+ x 1) Ax.+ (+ x 1) 1 7"
},
{
"page_index": 217,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_008.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_008.png",
"page_index": 217,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:28+07:00"
},
"raw_text": "Higher-order Function (2) Function that takes another function as a parameter. 'Higher-order\" because it is a function of a function. Examples: 0 map 0 reduce fi1ter Lambda works great as a parameter to higher-order functions if you can deal with its limitations = What are those limitations? 8"
},
{
"page_index": 218,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_009.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_009.png",
"page_index": 218,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:31+07:00"
},
"raw_text": "Map map(function, iterable, ...) Map applies function to each element of iterable and creates a list of the results You can optionally provide more iterables as parameters to map and it will place tuples in the result list. Map returns an iterator which can be cast to list. Example: nums [0, 4, 7, 2, 1, 0 9 , 3, 5, 6, 8, 0, 3 nums = list(map(lambda x : x % 5, nums)) print(nums) #[0, 4, 2, 2, 1, 0, 4, 3, 0, 1, 3, 0, 3] 9"
},
{
"page_index": 219,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_010.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_010.png",
"page_index": 219,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:34+07:00"
},
"raw_text": "Filter filter(function, iterable) The filter runs through each element of iterable (any iterable object such as a List or another collection It applies function to each element of iterable. If function returns True for that element then the element is put into a List. Example: nums [0, 4, 7, 2, 1, 0 , 9 , 3, 5, 6, 8, 0, 3] nums = list(filter(lambda x : x != 0, nums)) print(nums) #[4, 7, 2, 1, 9, 3, 5, 6, 8, 3] 10"
},
{
"page_index": 220,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_011.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_011.png",
"page_index": 220,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:38+07:00"
},
"raw_text": "Reduce reduce(function, iterable[, initializer] Reduce will apply function to each element in iterable along with the sum so far and create a cumulative sum of the results function must take two parameters. If initializer is provided, initializer will stand as the first argument in the sum. Example: nums = [1, 2, 3, 4, 5, 6, 7, 8] : nums = list(reduce(lambda x, y : (x, y), nums)) print(nums) #(((((((1, 2), 3), 4), 5), 6), 7), 8 11"
},
{
"page_index": 221,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_012.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_012.png",
"page_index": 221,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:40+07:00"
},
"raw_text": "Another example 0 2 3 4 reduce(lambda acc, e: acc - e, 0 - 1 = -1 [1, 2, 3, 4], 0 -1 - 2 = -3 1 # 0utput: -10 -3 - 3 = -6 -6 - 4 = -10 12"
},
{
"page_index": 222,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_013.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_013.png",
"page_index": 222,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:43+07:00"
},
"raw_text": "Zip zip(iterable1, iterable2, ..:) Combine multiple iterables (like lists or tuples) into a single iterable of tuples Each tuple contains elements from the input iterables that are at the same position (index) Example: names = [\"Alice\", \"Bob\", \"Charlie\"] ages 25,30,35] combined = zip(names, ages) print(list(combined)) Results: [('Alice', 25), ('Bob', 30), ('Charlie', 35)] 13"
},
{
"page_index": 223,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_014.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_014.png",
"page_index": 223,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:45+07:00"
},
"raw_text": "03 CURRYING 14"
},
{
"page_index": 224,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_015.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_015.png",
"page_index": 224,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:50+07:00"
},
"raw_text": "Currying Function Currying is the technique of breaking down the evaluation of a function that takes multiple arguments into evaluating a sequence of single- argument functions. In mathematical notation it looks like this: If we have a function f which takes n arguments, we can \"replace\" it by a composition of n functions f,, f,' ... f, where each takes only one argument: let x = f(a a21 i ar we will get the same value x as if we call: fz = f1(a1) f3 = fz(az) and 15"
},
{
"page_index": 225,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_016.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_016.png",
"page_index": 225,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:53+07:00"
},
"raw_text": "Example def f(a1, a2, a3) : return a1 a2 * a3 def f1(a1) : def f2(a2) def f3(a3) : return f(a1, a2, a3 return f3 return f2 for i in range(1, 1o): print(f(i, i+1, i+2), f1(i)(i+1)(i+2)) # What is the output? 16"
},
{
"page_index": 226,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_017.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_017.png",
"page_index": 226,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:39:57+07:00"
},
"raw_text": "Partially Applied Function A partially applied function is a new function that is derived from an existing function by fixing a certain number of arguments in advance. The result is a function that can be called with the remaining arguments. We can use it for the composition of functions. Example: def f(a1, a a2) : r e t ur n a1 * a2 partial(f, 3)(4) # 0utput: 12 17"
},
{
"page_index": 227,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_018.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_018.png",
"page_index": 227,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:40:00+07:00"
},
"raw_text": "Decorator for Currying def curry(func) : def curried(*args) : if len(args) == func._ code_-.co_argcount: return func(*args) else : return lambda x: curried(*(args + (x,))) return curried @curry def prod3(x, y, z): return x + y + z print(prod3(1)(2)(3)) # 0utput: 6 18"
},
{
"page_index": 228,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_019.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_019.png",
"page_index": 228,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:40:02+07:00"
},
"raw_text": "04 CONCLUSION 19"
},
{
"page_index": 229,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_020.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_020.png",
"page_index": 229,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:40:05+07:00"
},
"raw_text": "Conclusion Lambda Function: Anonymous, inline functions using lambda keyword Higher-Order Function: Accept other functions as arguments or return them Examples: map(, filter, reduce Currying Convert multi-arg functions into chained single-arg functions Enables partial application 20"
},
{
"page_index": 230,
"chapter_num": 10,
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_021.png",
"metadata": {
"doc_type": "slide",
"course_id": "CO2039",
"source_file": "/workspace/data/converted/CO2039_Advanced_Programming/Chapter_10/slide_021.png",
"page_index": 230,
"language": "en",
"ocr_engine": "PaddleOCR 3.2",
"extractor_version": "1.0.0",
"timestamp": "2025-10-31T12:40:08+07:00"
},
"raw_text": "DAI HOC QUOC GIA BK TP.HO CHi MINH TP.HCM Thank you for your attention! https://www.cse.hcmut.edu.vn DAI HOC QUOC GIA THANH PHO HÖ CHi MINH TRUONG DAI HOC BACH KHOA"
}
]
}