Course Title: Object-Oriented Programming with PHP
Course Lecturer: Jacob Chidi Eugene
Course Code: (BIT-6083)
Course Title: Object Oriented Programming
Credit Units: 3
Course Description:
This course introduces students to the principles and practices of Object-Oriented Programming (OOP)
using PHP. Students will learn about classes, objects, inheritance, polymorphism, encapsulation, and
other core OOP concepts. Practical programming assignments will reinforce theoretical concepts,
focusing on PHP applications in web development.
Prerequisites:
Introduction to Programming
Data Structures
Course Objectives:
By the end of this course, you as a student should be able to:
Understand the principles of Object-Oriented Programming.
Design and implement OOP solutions to programming problems using PHP.
Use classes and objects effectively in PHP.
Implement inheritance and polymorphism in their PHP programs.
Apply encapsulation and abstraction in software design.
Develop web applications using OOP concepts in PHP.
Week 1: Introduction to Object-Oriented Programming with PHP
Overview of OOP
History and evolution of OOP
Benefits of OOP
Basic OOP concepts in PHP
Week 2: Classes and Objects in PHP
Defining classes in PHP
Creating objects
Class members (properties and methods)
Constructors and destructors in PHP
Week 3: Encapsulation and Data Hiding
Public, private, and protected access specifiers in PHP
Getters and setters
Information hiding
Week 4: Inheritance in PHP
Concept of inheritance
Parent and child classes
Overriding methods
The parent keyword
Week 5: Polymorphism in PHP
Static vs. dynamic polymorphism
Method overloading and method overriding
Abstract classes and interfaces
Week 6: Advanced Class Design
Composition vs. inheritance
Static properties and methods
Final classes and methods
Traits in PHP
Week 8: Exception Handling in PHP
Error handling and exceptions
Try, catch, and finally blocks
Creating custom exceptions
Week 9: Collections and Iterators
Arrays vs. collections in PHP
SPL (Standard PHP Library) data structures
Iterators and generators
Week 10: File I/O and Serialization
Reading from and writing to files in PHP
Serialization and deserialization of objects
Week 11: Web Development with OOP in PHP
Basics of PHP for web development
Using OOP in web applications
MVC (Model-View-Controller) pattern
Week 12: Design Patterns
Introduction to design patterns
Singleton, Factory, Observer, and other common patterns
Week 13: UML and OOP Design Principles
Introduction to Unified Modeling Language (UML)
Class diagrams, sequence diagrams, etc.
SOLID principles
Week 14: Project Work and Review
In-class project work
Code reviews and feedback
Week 15: Final Exam
Assessment Methods:
Homework Assignments: XX%
Midterm Exam: XX%
Final Exam: XX%
Project: XX%
Policies:
Attendance and participation
Academic integrity
Late submission policy
Collaboration policy
This outline focuses on teaching Object-Oriented Programming using PHP, integrating practical web
development examples to make the concepts more relevant and engaging for you as a students.
Week 1: Introduction to Object-Oriented Programming with PHP
Overview of OOP
Introduction
Object-Oriented Programming (OOP) is a programming paradigm that uses objects and classes to design
and develop applications. It is centered around the concept of objects, which can contain data in the
form of fields (often known as properties or attributes) and code in the form of procedures (methods).
History and Evolution
OOP was developed to overcome the limitations of procedural programming. The key milestones in the
evolution of OOP include:
Simula (1960s): Considered the first object-oriented language, that introduced the concept of classes
and objects.
Smalltalk (1970s): Popularized OOP and introduced many concepts that are standard in OOP today.
C++ (1980s): Extended the C programming language with OOP features.
Java (1990s): Emphasized portability and security, becoming widely used in web and enterprise
applications.
Modern OOP Languages: Including Python, Ruby, and PHP, have made OOP more accessible and
integrated into various programming environments.
Benefits of OOP
Modularity: Code can be divided into reusable classes and objects.
Reusability: Existing code can be reused through inheritance and polymorphism.
Scalability: OOP makes it easier to manage and maintain larger software projects.
Productivity: Promotes better organization of code, making development faster and reducing errors.
Maintainability: Encapsulation helps protect data and methods, making the codebase easier to
maintain and modify.
Basic OOP Concepts
Classes and Objects:
Class: A blueprint for creating objects. It defines a set of attributes and methods that the created
objects will have.
Object: An instance of a class. It contains data and behavior as defined by the class.
Encapsulation:
Encapsulation is the concept of wrapping data and methods that operate on the data within a single unit
(class).
It restricts direct access to some of the object’s components, which is a means of preventing accidental
interference and misuse of the data.
Inheritance:
Inheritance is a mechanism by which one class (child class) can inherit the attributes and methods of
another class (parent class).
It promotes code reusability and establishes a relationship between the parent and child classes.
Polymorphism:
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
It enables a single interface to represent different underlying forms (data types).
Abstraction:
Abstraction means hiding the complex implementation details and showing only the essential features
of the object.
It helps in reducing programming complexity and effort.
OOP in PHP
PHP, a popular server-side scripting language, supports OOP features, making it suitable for both
procedural and object-oriented programming. Key OOP features in PHP include:
Classes and Objects
Constructors and Destructors
Inheritance
Polymorphism
Interfaces and Abstract Classes
Traits
Namespaces
Example of OOP in PHP:
In this example:
A Car class is defined with properties make, model, and year.
A constructor method initializes the properties when a new Car object is created.
A method displayInfo outputs the car's details.
An instance of the Car class is created, and its information is displayed using the displayInfo method.
This overview provides a foundational understanding of OOP concepts, the benefits of OOP, and how
these concepts are implemented in PHP. Subsequent lessons will delve deeper into each of these
concepts with more detailed examples and exercises.
Week 2: Classes and Objects in PHP
Introduction
In PHP, a class is a blueprint for creating objects, providing initial values for state (member variables or
properties) and implementations of behavior (member functions or methods). An object is an instance
of a class.
Defining Classes in PHP
A class is defined using the class keyword followed by the class name and a pair of curly braces {}
containing the class properties and methods.
In this example:
The Car class has three properties: make, model, and year.
The class has one method: displayInfo(), which outputs the car's details.
Creating Objects in PHP
Objects are instances of a class. You create an object using the new keyword.
In this example:
An object $car1 is created from the Car class.
The properties of the object are set to specific values.
The displayInfo() method is called to display the object's details.
Class Members (Properties and Methods)
Properties: Variables that belong to the class.
Methods: Functions that belong to the class.
in this example:
setMake and getMake are methods used to set and get the value of the make property.
The $this keyword refers to the current object instance.
Constructors and Destructors
Constructor: A special method called when an object is instantiated. It is defined using the
__construct keyword.
Destructor: A special method called when an object is destroyed. It is defined using the __destruct
keyword.
in this example:
The __construct method initializes the properties of the Car class when a new object is created.
The __destruct method is called when the object is destroyed, either at the end of the script or when
the object is unset.
Visibility
Properties and methods can have different levels of visibility:
public: Accessible from anywhere.
protected: Accessible only within the class itself and by inherited and parent classes.
private: Accessible only within the class itself.
In this example:
The make property is public, so it can be accessed from outside the class.
The model property is protected, so it can only be accessed within the class and its subclasses.
The year property is private, so it can only be accessed within the class.
This section covers the fundamental concepts of classes and objects in PHP, including how to define
classes, create objects, and use properties and methods. It also introduces constructors, destructors,
and visibility levels, which are essential for encapsulating and managing data within an object-oriented
program.
Week 3: Encapsulation and Data Hiding
Introduction
Encapsulation is one of the fundamental principles of Object-Oriented Programming (OOP). It refers to
the bundling of data (attributes) and methods (functions) that operate on the data into a single unit, or
class. Encapsulation helps to protect the internal state of an object from unintended interference and
misuse by restricting access to the object's data.
Data hiding is a related concept that enforces encapsulation by controlling access to the internal state of
an object. This is typically achieved through the use of access specifiers: public, protected, and
private.
Access Specifiers
public: Members declared as public are accessible from anywhere, both inside and outside the class.
protected: Members declared as protected are accessible only within the class itself and by inherited
and parent classes.
private: Members declared as private are accessible only within the class itself.
Getters and Setters in PHP
Getters and setters are methods used to access and modify the properties of a class. They provide a
controlled way to read and update the value of private or protected properties, ensuring encapsulation
and data integrity.
Why Use Getters and Setters?
Encapsulation: They help in hiding the internal representation of the object and only expose what is
necessary.
Validation: Getters and setters can include validation logic to ensure that the data being assigned to
the properties is valid.
Control: They provide control over how properties are accessed and modified.
Flexibility: They allow changes to the internal implementation without affecting external code.
The example below says it all.
Example of Encapsulation and Data Hiding in PHP
Below is the continuation code…..
In this example:
The make, model, and year properties are private, meaning they cannot be accessed directly from
outside the class.
Public methods getMake, setMake, and displayInfo are provided to access and modify the
private properties. This ensures that any interaction with the object's data is controlled and can be
validated if necessary.
Benefits of Encapsulation
Control: Encapsulation allows the class to control how its data is accessed and modified.
Maintainability: By hiding the internal state and requiring all interactions to occur through well-
defined methods, the class can change its internal implementation without affecting other parts of the
program.
Security: Encapsulation can prevent unauthorized access and modification of data, thus enhancing
the security of the application.
Flexibility: Encapsulation allows for easy addition of validation or other processing logic whenever a
property is accessed or modified.
Practical Example: Bank Account
Consider a more practical example involving a bank account:
Continuation…
In this example:
The balance property is private to prevent direct modification.
Public methods deposit, withdraw, and getBalance are provided to interact with the balance property.
The deposit and withdraw methods include validation logic to ensure the integrity of the account's
balance.
This section illustrates the principles of encapsulation and data hiding in PHP. By controlling access to an
object's internal state and requiring interactions through public methods, encapsulation helps ensure
that objects are used in a controlled and predictable manner, enhancing the robustness and
maintainability of the code. Getters and setters enhance encapsulation and ensure data integrity,
making them essential tools in OOP.
Week 4: Inheritance in PHP
Concept of Inheritance
Inheritance is a fundamental concept in Object-Oriented Programming (OOP) that allows a class to
inherit properties and methods from another class. The class that is inherited from is called the parent
class (or base class or superclass), and the class that inherits is called the child class (or derived class or
subclass).
Inheritance promotes code reuse and establishes a natural hierarchy between classes. It allows new
classes to be created with minimal changes by extending existing classes.
Parent and Child Classes
Parent Class: The class whose properties and methods are inherited by another class.
Child Class: The class that inherits properties and methods from the parent class
Example of Parent and Child Classes
In this example:
The ‘Vehicle’ class is the parent class with properties ‘make’ and ‘model’ and a method displayInfo.
The ‘Car’ class is the child class that extends the ‘Vehicle’ class, adding a new property year and
overriding the displayInfo method.
Overriding Methods
Overriding is a feature in OOP that allows a child class to provide a specific implementation of a method
that is already defined in its parent class. When a method in a child class has the same name and
parameters as a method in the parent class, the child class's method overrides the parent class's
method.
Example of Method Overriding
In this example:
The Car class overrides the displayInfo method of the Vehicle class to include the year property in
its output.
The parent Keyword
The parent keyword in PHP is used to access properties or methods from the parent class. This is
particularly useful when a child class overrides a method and needs to call the parent class's version of
the method.
Example of Using the parent Keyword
In this example:
The Car class's displayInfo method calls the Vehicle class's displayInfo method using parent::displayInfo()
to include the parent class's output before adding its own.
This section covers the concept of inheritance in PHP, demonstrating how to create parent and child
classes, override methods, and use the parent keyword to access parent class methods. Understanding
these concepts is crucial for creating well-structured, reusable, and maintainable code in an object-
oriented programming paradigm.
Week 5: Polymorphism in PHP
Introduction
Polymorphism is a core concept in object-oriented programming that allows objects of different types to
be treated as objects of a common super type. It provides a way to perform a single action in different
forms.
Static vs. Dynamic Polymorphism
Static Polymorphism: Also known as compile-time polymorphism. It is achieved through method
overloading and operator overloading. PHP does not support method overloading in the traditional
sense as some other languages do.
Dynamic Polymorphism: Also known as runtime polymorphism. It is achieved through method
overriding and interfaces, where a method call is resolved at runtime.
Method Overloading and Method Overriding
Method Overloading
Method overloading refers to the ability to create multiple methods with the same name but different
parameters. PHP does not support method overloading natively, but you can achieve similar
functionality using magic methods like __call.
In this example:
The __call method is a magic method that handles calls to undefined methods. It allows simulating
method overloading by checking the method name and the number of arguments.
Method Overriding
Method overriding allows a child class to provide a specific implementation of a method already defined
in its parent class.
In this example:
The Dog class overrides the makeSound method of the Animal class to provide a specific
implementation.
Abstract Classes and Interfaces
Abstract Classes
An abstract class is a class that cannot be instantiated on its own and must be extended by a child class.
It can contain abstract methods, which are methods declared without a body and must be implemented
by the child class.
In this example:
The Animal class is an abstract class with an abstract method makeSound.
The Dog class extends Animal and provides an implementation for the makeSound method.
Interfaces
An interface defines a contract that classes must adhere to. It can only contain method declarations
(without bodies) and constants. Classes that implement an interface must define all the methods
declared in the interface.
In this example:
The Animal interface declares a method makeSound.
The Dog and Cat classes implement the Animal interface and provide specific implementations for
the makeSound method.
Polymorphism with Abstract Classes and Interfaces
Polymorphism allows objects to be treated as instances of their parent class or interface, enabling
flexible and reusable code.
In this example:
The describeAnimal function accepts an Animal interface type, allowing it to work with any object that
implements the Animal interface, demonstrating polymorphism.
This section covers the concept of polymorphism in PHP, differentiating between static and dynamic
polymorphism, and exploring method overloading, method overriding, abstract classes, and interfaces.
Understanding these concepts is essential for writing flexible, reusable, and maintainable object-
oriented code.
Week 6: Advanced Class Design
Composition vs. Inheritance
Inheritance
Inheritance is a relationship where a child class inherits properties and methods from a parent class. It is
used to model an "is-a" relationship.
Example:
Composition
Composition is a relationship where a class is composed of one or more objects of other classes. It is
used to model a "has-a" relationship.
Example:
Static Properties and Methods
Static properties and methods belong to the class rather than any object instance. They can be accessed
without creating an instance of the class.
Example:
Final Classes and Methods
A final class cannot be extended, and a final method cannot be overridden by child classes. This is
useful for ensuring that the class or method's implementation remains unchanged.
Example:
Traits in PHP
Traits are a mechanism for code reuse in single inheritance languages like PHP. They allow you to
include methods in multiple classes.
Example:
In this example, the Logger trait is used in both User and Product classes, enabling code reuse and
avoiding duplication.
This section covers advanced class design in PHP, exploring composition vs. inheritance, static properties
and methods, final classes and methods, and traits. These concepts are essential for creating robust,
maintainable, and flexible object-oriented code in PHP.
Week 8: Exception Handling in PHP
Error Handling and Exceptions
Error handling in PHP involves managing and responding to runtime errors that occur in a script. PHP
provides error handling mechanisms through error reporting, error logs, and exceptions.
Types of Errors:
Parse Errors: Occur during compilation, such as syntax errors.
Fatal Errors: Occur during execution and halt the script, such as calling a non-existent function.
Warning Errors: Do not stop script execution but alert about potential issues.
Notice Errors: Inform about possible issues but do not halt script execution.
Exceptions:
Exceptions provide a more robust error handling mechanism. They allow developers to handle errors
gracefully and provide more control over how errors are managed.
Try, Catch, and Finally Blocks
Syntax:
Example:
Creating Custom Exceptions
Custom exceptions allow you to create specific exceptions tailored to your application's needs. They can
extend the base Exception class or any existing exception class.
Example:
In this example:
A custom exception class CustomException is defined by extending the Exception class.
The checkNumber function throws a CustomException if the number is greater than 1.
The try block calls checkNumber, and the catch block handles the CustomException.
Best Practices for Exception Handling:
Use Exceptions for Exceptional Cases: Use exceptions to handle unexpected situations, not
for regular control flow.
Provide Meaningful Messages: Ensure exception messages are clear and provide useful
information for debugging.
Catch Specific Exceptions: Catch specific exceptions rather than the base Exception class to
handle different error types appropriately.
Avoid Silent Failures: Ensure that exceptions are logged or reported, so issues do not go
unnoticed.
Clean Up Resources: Use finally blocks to clean up resources, such as closing file handles or
database connections, regardless of whether an exception occurred.
Handling Multiple Exceptions:
You can catch multiple types of exceptions by adding multiple catch blocks or by catching multiple
exceptions in a single block (PHP 7+).
Example:
In this example:
Two custom exception classes DivideByZeroException and NegativeNumberException are defined.
The checkNumber function throws these exceptions based on the input.
Multiple catch blocks handle the specific exceptions, allowing for different responses to different error
types.
This section covers the essentials of exception handling in PHP, including error handling basics, try-
catch-finally blocks, creating custom exceptions, and best practices. Proper exception handling ensures
that your application can gracefully manage unexpected situations and maintain robust error
management.
Week 9: Collections and Iterators
Arrays vs. Collections in PHP
Arrays in PHP
Arrays in PHP are versatile data structures that can hold multiple values, indexed by either
integers or strings.
Example:
Collections in PHP
PHP provides specialized data structures for more complex collections through the Standard PHP
Library (SPL). These structures include SplStack, SplQueue, SplHeap, and more, which offer
more functionality compared to regular arrays.
SPL (Standard PHP Library) Data Structures
SplStack
SplStack implements a stack, which follows the Last-In-First-Out (LIFO) principle.
Example:
SplQueue
SplQueue implements a queue, which follows the First-In-First-Out (FIFO) principle.
Example:
SplHeap
SplHeap provides an abstract implementation of a heap, which can be used to manage a
collection of elements based on priority.
Example:
Iterators and Generators
Iterators
Iterators allow you to traverse through a collection of data. PHP provides several iterator classes
in the SPL, such as ArrayIterator, DirectoryIterator, and more.
Example:
Iterators and Generators
Iterators
Iterators allow you to traverse through a collection of data. PHP provides several iterator classes
in the SPL, such as ArrayIterator, DirectoryIterator, and more.
Example:
Custom Iterators
You can create custom iterators by implementing the Iterator interface, which requires you to
define methods like current(), key(), next(), rewind(), and valid().
Example:
Generators
Generators provide a simpler way to implement iterators. They allow you to yield values one at a
time, maintaining state between each yield.
Example:
Generators are particularly useful for creating iterators without the overhead of implementing the
Iterator interface manually.
Summary
This section covers the basics of collections and iterators in PHP. It differentiates between arrays
and more complex collections provided by SPL, demonstrates how to use various SPL data
structures, and explains iterators and generators for efficient data traversal and manipulation.
Understanding these concepts is crucial for effective data management in PHP applications.
Week 10: File I/O and Serialization
Reading from and Writing to Files in PHP
Reading from Files
PHP provides several functions to read from files, including fopen(), fread(), fgets(), and
file_get_contents(). Here's a basic example:
Example: Reading a File Line by Line
Example: Reading an Entire File into a String
Writing to Files
PHP functions for writing to files include fopen(), fwrite(), and file_put_contents().
Here's how to write data to a file:
Example: Writing Data to a File
Example: Appending Data to a File
Example: Writing Data with file_put_contents()
Serialization and Deserialization of Objects
Serialization is the process of converting an object into a format that can be easily stored or
transmitted. Deserialization is the reverse process, converting the serialized data back into an
object.
Serialization
PHP provides the serialize() function to convert an object to a storable string.
Example: Serializing an Object
Deserialization
The unserialize() function converts the serialized string back into an object.
Example: Deserializing an Object
JSON Serialization
Another common format for serialization is JSON, using json_encode() and json_decode()
functions.
Example: JSON Encoding and Decoding
Example: JSON Decoding
Summary
This section covers the basics of file I/O and serialization in PHP. It explains how to read from
and write to files, both line-by-line and in whole. It also introduces serialization and
deserialization, focusing on converting objects to storable formats and back. Proper
understanding of these concepts is crucial for managing data persistence and transmission in
PHP applications.
Week 11: Web Development with OOP in PHP
Basics of PHP for Web Development
PHP is a server-side scripting language designed for web development. It can be embedded in
HTML to create dynamic web pages. Here are the basics of using PHP for web development:
Embedding PHP in HTML
Example: Basic PHP in HTML
Handling Forms
Example: Form Handling in PHP
Connecting to a Database
Example: Connecting to MySQL with PDO
Using OOP in Web Applications
Object-oriented programming can be used to structure web applications more effectively by
encapsulating related functionality within classes and objects.
Creating a Simple User Class
Example: User Class
Example: Using OOP for Form Handling
MVC (Model-View-Controller) Pattern
The MVC pattern is a design pattern commonly used in web development to separate concerns,
making applications more modular and easier to maintain.
Model
The Model represents the data and the business logic of the application.
Example: Model Class
View
The View represents the presentation layer. It displays the data provided by the Controller.
Example: View File
Controller
The Controller handles user input and updates the Model and View accordingly.
Example: Controller Class
Putting It All Together
In a real application, you would have a more complex structure, possibly using an autoloader and
a front controller to handle routing. Here's a basic example:
[Link] (Front Controller)
[Link] (View)
This setup demonstrates the MVC pattern's structure, separating the data handling (Model), the
user input handling (Controller), and the presentation (View).
Summary
This section covers the basics of using PHP for web development, demonstrates how to apply
OOP principles in web applications, and introduces the MVC pattern. Understanding these
concepts is essential for building scalable, maintainable, and organized web applications.
Week 12: Design Patterns
Introduction to Design Patterns
Design patterns are reusable solutions to common problems in software design. They provide a
template for how to solve a problem in various contexts and help improve code readability,
maintainability, and scalability. Design patterns are categorized into three main types:
1. Creational Patterns: Deal with object creation mechanisms.
2. Structural Patterns: Deal with object composition.
3. Behavioral Patterns: Deal with object interaction and responsibility distribution.
Common Design Patterns
Singleton Pattern
The Singleton pattern ensures that a class has only one instance and provides a global point of
access to it.
Example: Singleton Pattern in PHP
Factory Pattern
The Factory pattern provides a way to create objects without specifying the exact class of the
object that will be created.
Example: Factory Pattern in PHP
Observer Pattern
The Observer pattern defines a one-to-many dependency between objects so that when one
object changes state, all its dependents are notified and updated automatically.
Example: Observer Pattern in PHP
Other Common Patterns
Strategy Pattern
The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them
interchangeable.
Example: Strategy Pattern in PHP
Decorator Pattern
The Decorator pattern allows behavior to be added to individual objects, either statically or
dynamically, without affecting the behavior of other objects from the same class.
Example: Decorator Pattern in PHP
Summary
This section covers the basics of design patterns, focusing on the Singleton, Factory, Observer,
Strategy, and Decorator patterns. Understanding these patterns helps in building more robust,
maintainable, and scalable PHP applications by providing standardized solutions to common
problems in software design.
Week 13: UML and OOP Design Principles
Introduction to Unified Modeling Language (UML)
Unified Modeling Language (UML) is a standardized visual language for creating models of
object-oriented software. UML provides a variety of diagrams to represent different aspects of a
system.
Common UML Diagrams
1. Class Diagrams: Show the static structure of a system, including classes, attributes, methods,
and relationships between classes.
2. Sequence Diagrams: Show how objects interact in a particular sequence, focusing on the order
of messages.
3. Use Case Diagrams: Represent the functional requirements of a system and the interactions
between users (actors) and the system.
4. Activity Diagrams: Model the workflow of a system or a business process.
5. State Diagrams: Show the states of an object and the transitions between those states.
Class Diagrams
Class diagrams are the backbone of UML. They represent the classes in a system and the
relationships between them.
Example: Simple Class Diagram
This diagram shows two classes, User and Admin, with Admin inheriting from User.
Sequence Diagrams
Sequence diagrams show the interaction between objects over time.
Example: Simple Sequence Diagram
This diagram illustrates the sequence of messages between the User, Controller, and Model
during a login process.
OOP Design Principles
OOP design principles guide the design and implementation of software to ensure it is robust,
maintainable, and scalable. The SOLID principles are a set of five design principles intended to
achieve these goals.
SOLID Principles
1. Single Responsibility Principle (SRP)
o A class should have only one reason to change, meaning it should have only one job or
responsibility.
Example:
Open/Closed Principle (OCP)
Software entities should be open for extension but closed for modification.
Example:
Liskov Substitution Principle (LSP)
Subtypes must be substitutable for their base types without altering the correctness of the
program.
Example:
Interface Segregation Principle (ISP)
Clients should not be forced to depend on interfaces they do not use.
Example:
Dependency Inversion Principle (DIP)
High-level modules should not depend on low-level modules; both should depend on
abstractions. Abstractions should not depend on details; details should depend on
abstractions.
Example:
Summary
This section introduces UML and OOP design principles, focusing on creating visual models
using UML and understanding the SOLID principles for robust software design. Mastery of these
concepts helps in designing scalable, maintainable, and efficient object-oriented applications.
Week 14: Project Work and Review
Project: Online Library Management System
Project Overview
Design and implement an Online Library Management System using PHP, focusing on object-
oriented programming (OOP) principles. The system should allow users to browse and borrow
books, and librarians to manage the library's inventory.