Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OOP-in-python

A collection of Python programs demonstrating Object-Oriented Programming (OOP) concepts such as classes, objects, inheritance, polymorphism, encapsulation, and abstraction.

This repository was created for learning and practicing OOP in Python.

🎵 Object-Oriented Music Library in Python

Overview

This project is a simple Music Library Management System built using Object-Oriented Programming (OOP) concepts in Python. It demonstrates how classes and objects can be used to model real-world entities such as songs, artists, and a music library.

The project focuses on organizing songs by artists and displaying them in a structured format while applying core OOP principles.

Features

  • Create song objects with:

    • Title
    • Duration (minutes and seconds)
    • Release date
  • Create artist objects that can manage multiple songs.

  • Store multiple artists in a music library.

  • Display all artists along with their songs.

  • Search for artists in the library (basic implementation).

OOP Concepts Used

1. Classes and Objects

The project defines three main classes:

  • Song – Represents a song with its title, duration, and release date.
  • Artist – Represents an artist and maintains a collection of songs.
  • MusicLibrary – Represents the overall music library containing multiple artists.

2. Encapsulation

Each class stores its own data and provides methods to interact with that data instead of accessing it directly.

3. Composition

An Artist contains multiple Song objects, and a MusicLibrary contains multiple Artist objects. This demonstrates object composition, where larger objects are built using smaller related objects.

4. Constructors (__init__)

Each class initializes its attributes through constructors, ensuring every object starts with the required information.

5. Instance Methods

Methods such as add_songs(), add_artist(), pr_song(), pr_artist(), and list_all_songs() define the behavior of each object.

Project Structure

MusicLibrary
│
├── Artist
│   ├── Song 1
│   ├── Song 2
│   └── ...
│
├── Artist
│   ├── Song 1
│   └── ...

Example Output

--- Library Song List ---

Artist of these songs is: "Kaavish" | Songs are 2
The title of song is "dekkho" and the duration is 3:45 minutes and song released on 2008-03-01.
The title of song is "morey saiyan" and the duration is 4:05 minutes and song released on 2008-03-01.

Artist of these songs is: "Atif" | Songs are 1
The title of song is "Tery bin" and the duration is 4:13 minutes and song released on 2006-08-07.

Technologies Used

  • Python 3
  • datetime module

Future Improvements

  • Improve the artist search functionality.
  • Add support for albums and playlists.
  • Read and save data using files or a database.
  • Implement song deletion and editing.
  • Add a menu-driven or graphical user interface.

Learning Outcomes

This project helped reinforce the following Python concepts:

  • Object-Oriented Programming (OOP)
  • Classes and Objects
  • Constructors
  • Lists of Objects
  • Composition
  • Method Design
  • Working with Python's datetime module

This project was created as a practice exercise to strengthen Python OOP fundamentals by building a simple yet organized music library system.

About

Object-Oriented Programming (OOP) concepts and examples implemented in Python.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages