0% found this document useful (0 votes)
2 views

Comp1752-Oop 3

Uploaded by

kali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Comp1752-Oop 3

Uploaded by

kali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

COMP-1752 Object Oriented Programming

Student name: Phung Danh Khoa


ID Number: GCS230203
Academic year: 2024-2025
Module: COMP-1752 Object Oriented Programming
Module Assessment Title: Coursework Report
Submission Date:
Due Date: 14/08/2024

1
COMP-1752 Object Oriented Programming

TABLE OF CONTENTS
I. Introduction......................................................................................................................... 3
II. Design and Development.................................................................................................. 3
1. create_video_list.py:.......................................................................................................3
2. update_video.py:............................................................................................................ 7
III.TESTING AND FAULTS...................................................................................................... 9
1. Unit test (Library Item):...................................................................................................9
2. create_video_list.py test cases:....................................................................................11
3. update_video.py test cases:.........................................................................................12
IV. INNOVATION, CONCLUSION AND FURTHER DEVELOPMENT...................................12
1. Innovation:....................................................................................................................12
2. Conclusion and Further Development:.........................................................................13
3. Reflection:.................................................................................................................... 13
Appendix A:.......................................................................................................................... 14
Appendix B:.......................................................................................................................... 15

2
COMP-1752 Object Oriented Programming

I. Introduction
The aim of this coursework was to create a simulation of a video player, similar to a
simplified version of Windows Media Player. The project entailed the creation and execution
of graphical user interfaces (GUIs) for interacting with a video collection. These interfaces
allowed users to generate playlists, modify video ratings, and access video information. The
project focused on fundamental principles of object-oriented programming (OOP), the
building of graphical user interfaces (GUI) using Tkinter, and the implementation of testing
procedures.

Source code:
Demo clip:

II. Design and Development


The building process was directed by the coursework requirements and the given template
code. The template consisted of a basic GUI (graphical user interface) for a video player
(video_player.py), a GUI for verifying videos (check_videos.py), and a video library
(video_library.py). The check_videos.py file was used as a guide to comprehend graphical
user interface (GUI) interactions and the process of retrieving data from the movie library.
1. create_video_list.py:
Design stage: (Fig.1)
User Interface (UI): The UI has input areas for the video number, a button to append
the video to the playlist, and a window to exhibit the current playlist.

Visual Design: The interface employs a pink background, establishing a lively and
captivating atmosphere for the user. This design decision improves the aesthetic
appeal while also preserving clarity.

Playlist Management: The design includes a section where users can see the playlist
while adding videos, providing instant feedback and interaction.

3
COMP-1752 Object Oriented Programming

Fig.1: GUI of create_video_list.py

Development stage:(Fig.2)

Establishing the Graphical User Interface (GUI) Framework:


The Tkinter library was utilized to construct the graphical user interface (GUI), with
the dimensions of the window set to 600x400 and the title designated as "Create
Video Playlist."
A pink background was selected to align with the design specifications, resulting in a
visually distinctive interface.

Generating input fields, buttons, and display areas:


A video number input area was incorporated, accompanied by a corresponding label
to provide user guidance. A "Add Video" button was added to enable users to include
the input video in the playlist.
An input field was incorporated to exhibit the present playlist, offering consumers
immediate updates on the videos they have included.
Developing Playlist Management:The key feature revolves around the inclusion of
video identifiers into a playlist. The application handles the management of the
playlist, and any new additions are immediately shown in the display area.

Error Handling: The application incorporates checks to address potential difficulties,


such as the input of an invalid video number. The user is presented with error
warnings to assist them in rectifying their input.

Software testing and debugging: The application underwent rigorous testing to


verify its proper functionality. Similar to the update_video.py script, a few issues were
detected as a result of the meticulous design of the interface and individual functions.
The program was optimized to accommodate various user activities and deliver a
seamless user experience.

4
COMP-1752 Object Oriented Programming

Fig.2: create_video_list.py GUI implementation

5
COMP-1752 Object Oriented Programming

2. update_video.py:
Design stage:(Fig.3)
The GUI of the update_video.py is designed with a primary emphasis on simplicity
and user-friendliness, enabling users to efficiently update video ratings with minimal
exertion. The primary elements of the design comprise:
● User Interface (UI): An uncluttered and uncomplicated design, featuring
input boxes for the video number and the new rating. Labels provide
instructions to the user regarding the specific data to be entered.
● Visual Design: The layout employs a light blue background to establish a
serene and aesthetically pleasing experience, improving usability without
inundating the user.
● Error Handling: Although not explicitly demonstrated in the above code
snippet, the design will have error handling mechanisms to effectively handle
erroneous video numbers or ratings. This will enable the system to deliver
direct feedback to the user within the graphical user interface (GUI).

Fig.3: GUI of update_video_.py

Development stage:(Fig.4)
● Establishing the Graphical User Interface (GUI) Framework:
The Tkinter library was selected due to its user-friendly nature and seamless
integration with Python, rendering it well-suited for the development of
uncomplicated desktop applications.
The initial configuration involved establishing a window with predetermined
dimensions and assigning it a user-friendly title.
● Generating input fields and labels:
The graphical user interface (GUI) consists of labels and entry widgets that
allow the user to input the video number and the new rating. The positioning
of these elements was achieved using the grid layout manager, which
guarantees a structured and organized interface.
● Implementing Update Logic:

6
COMP-1752 Object Oriented Programming

The central feature focuses on the modification of video data. Upon entering
the video number and new rating, the user can click the "Update" button to
initiate the system's validation of the information.
Subsequently, the system will engage with a video_library module in order to
execute the upgrade. By adopting a modular approach, the graphical user
interface (GUI) and the business logic are separated, resulting in a codebase
that is easier to maintain.
● Error handling: In the event that the user inputs erroneous data, such as a
non-existent video number or an inappropriate rating format, the system will
promptly display an error notice. This guarantees that the user is cognizant of
any problems and can rectify them swiftly.
● Software testing and debugging: The application underwent testing to verify
the proper functioning of all its components. The testing process involved
validating the input, verifying the update capability, and ensuring the GUI
responded accurately to different user inputs.

Fig.4: update_video.py GUI implementation


7
COMP-1752 Object Oriented Programming

III.TESTING AND FAULTS


Following the completion of the development and testing phases, only a small number of
mistakes were identified. The majority of these difficulties were successfully fixed by making
adjustments to the interface and clearly specifying the functions of each component
separately. The complexity of this method stems from the potential for multiple scenarios to
occur during user contact with the software. It is essential to anticipate these possibilities and
adapt the functions and messages accordingly. After the examination stage, the results are as
follows:
1. Unit test (Library Item):(Fig.5)
The LibraryItem class was initially established to represent a media item, encompassing
information such as name, director, rating. In order to guarantee strong and reliable
functionality, the class constructor incorporates validation tests. Specifically, it verifies that
the name and director are not empty strings, and that the rating is an integer ranging from 1 to
5. Subsequently, I incorporated many techniques, including the stars() function, which
provides a string representation of the rating using stars, and the play() method, which
advances the play count with each invocation.

In order to validate the accuracy of this class, I conducted a set of unit tests via PyTest. The
tests encompassed several circumstances, such as correct initialization, incorrect inputs for
the name, director, rating, and the anticipated functionality of the stars() and play()
functions. Upon doing the tests, I have verified that all of them have been successfully
passed, thus confirming that the LibraryItem class functions as intended in both typical and
exceptional scenarios. By conducting comprehensive testing, I can confirm that the class is
capable of effectively managing different inputs and maintaining consistent functionality.
This establishes a strong basis for future development.

8
COMP-1752 Object Oriented Programming

Fig.5: Unit test

9
COMP-1752 Object Oriented Programming

Fig.6: Unit test result

Fig.7: Unit test result for each section


2. create_video_list.py test cases:

Test Sample action Sample Expected Actual Output Pass/Fai


Case Input Output l

1 Type a valid Video "Video 'Video "Video 'Video 1' added Pass
number video Number: 01 1' added to to playlist"
playlist"

2 Click "Play - "Playlist is "Playlist played Fail


Playlist" button empty" (simulated). Play counts
incremented."

3 Click "Reset - "Playlist reset" "Playlist reset" Pass


Playlist" button

10
COMP-1752 Object Oriented Programming

3. update_video.py test cases:

Test Sample Sample


Case action Input Expected Output Actual Output Pass/Fail

Type valid Video Status label: "Video Status label: "Video


1 video number Number: 01, 'Video 1' updated! 'Video 1' updated! Pass
and rating Rating: 5 Rating: 5, Plays: 0" Rating: 5, Plays: 0"

Video Status label:


Type invalid Status label: "Invalid
2 Number: 99, "Invalid video Pass
video number video number"
Rating: 5 number"

Type Video
Status label: Status label: "Invalid
3 non-numeric Number: 01, Pass
"Invalid rating" rating"
rating Rating: abc

IV. INNOVATION, CONCLUSION AND FURTHER


DEVELOPMENT
1. Innovation:
To elaborate on stage 5, I successfully integrated the functionalities of
create_video_playlist.py and update_video.py into a single GUI. This combined
application not only enables users to manage video playlists and update video
information seamlessly but also includes a visually appealing feature where images
corresponding to the videos are displayed. This enhancement provides a more
engaging and intuitive experience by visually illustrating the videos that have been
added to the playlist.

Fig.8: GUI of Single GUI

11
COMP-1752 Object Oriented Programming

2. Conclusion and Further Development:


I effectively created an extensive video player simulation that allows users to engage
with a video collection through features like playlist generation and movie rating
modifications. I utilized object-oriented programming principles and Tkinter for GUI
development. Additionally, I implemented thorough testing techniques to ensure
functionality and stability. One of my key accomplishments was successfully merging
create_video_playlist.py and update_video.py into a unified and coherent graphical
user interface (GUI). This integration not only simplified the application's flow but
also significantly improved the user experience by incorporating visual depictions of
the videos in the playlist. The development process was challenging, characterized by
numerous problems and errors, yet I overcame each hurdle by implementing efficient
solutions. The considerable time and effort I dedicated to this project resulted in a
resilient and user-friendly program, demonstrating both my tenacity and technical
expertise. If given an extra three months, I suggests implementing various
improvements:
Enhanced Video Player: Current modeling might develop into an entirely
operational media player capable of engaging videos right away within the
application.
Search Functionality: The inclusion of a search bar would allow users to swiftly find
particular videos within their library.
User Accounts and Data Persistence: Using account logins and databases would
allow consumers to keep their playlists, evaluations; and choices, giving an individual
experience across sessions.
Enhanced Functionality: The program has the potential to integrate advanced
features such as personalized video recommendations derived from user ratings and
watching history, as well as the ability to facilitate online video streaming.

3. Reflection:

12
COMP-1752 Object Oriented Programming

Appendix A:

Fig.9: check_video.py comment

Appendix B:

13

You might also like