KEMBAR78
Scientist Paper Spotify | PDF | Class (Computer Programming) | Method (Computer Programming)
0% found this document useful (0 votes)
37 views4 pages

Scientist Paper Spotify

This document discusses the development of a music playback website inspired by Spotify, detailing the methodologies, design patterns, and testing strategies employed to ensure software quality. It covers the implementation of various design patterns such as Singleton and Command, as well as the identification and resolution of code smells and anti-patterns. The paper concludes that the project maintained good software quality, meeting established standards and demonstrating functionality through unit tests.

Uploaded by

munozdaniela11a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views4 pages

Scientist Paper Spotify

This document discusses the development of a music playback website inspired by Spotify, detailing the methodologies, design patterns, and testing strategies employed to ensure software quality. It covers the implementation of various design patterns such as Singleton and Command, as well as the identification and resolution of code smells and anti-patterns. The paper concludes that the project maintained good software quality, meeting established standards and demonstrating functionality through unit tests.

Uploaded by

munozdaniela11a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1

Music Streaming platform - ”Spotify”


L.D Muñoz, Student member, J.D Álvarez, Student member,

Abstract—Currently with the growth of music industries the structure and behavior of the system, improving communi-
demand for music platforms has also grown with great boom, so cation and development efficiency. In turn, by implementing
this paper is based on the creation of a music playback website them, concrete classes, interfaces and relationships between
with great similarities to one of the most popular platforms
globally, which is Spotify. This paper explains the methodologies classes can be identified.
and tools used that were taken into account which lead us to UML implementation diagrams are as follows:
good software quality metrics, in addition to this, it ends with • Activity diagram: The activity diagram is a diagram used
the performance of unit tests and testing to show the quality of to model the workflow or behavior of a system or busi-
the website and the development that this had.
ness process. These diagrams are useful for representing
Index Terms—keywords, temperature, xxxx equation, etc. complex processes, procedures and algorithms in a visual
and easy to understand manner.
I. I NTRODUCTION

I N these moments of the present time the music distribution


has increased a lot, for the same reason the market that
offers these services has grown a lot, with all this to create a Music website
login
Diagrama de actividades Spotify
Modelos de programacion | April 10, 2024

music platform can be very risky if it is not carried out with [If you already have a
registered account]
[If you do not have an
account]

the due care, for that reason a music playback website was Log in sing up

developed with some functionalities and some similarities to Enter username


and password
Enter email,
password,

one of the most known platforms worldwide, Spotify. username, date


of birth

Already
registered, enter
the musical
genres of Enter artist name,

To achieve this and to have a good realization and structure preference musical genre, city of
origin, bibliography,
discography,
Upload an album
with your songs
discography Complete Play music from the

of software, patterns, anti-patterns, code smells, solid princi- Login to the home
page as user
[If you want to create an
premium profile
creation
playList only in
random order and
without rewinding.
profile

ples and crud operations were taken into account, so that in artist profile] Enter the options
menu
Press '''Create an
artist''' option
Artist profile
creation
completed Pay monthly fee A playList of
songs with likes is
created.

this way a good quality of software can be achieved. We also [If you wish to have a
premium account] Enter
"subscription Search for songs

made use of databases and to demonstrate that the software If you do not want to create
an artist profile
[Still have a free profile]
payament" option and listen to
music with
advertising

complies with the requirements we performed unit tests and


tests in virtual environments.
Fig. 1. Activity Diagram.
II. S PECIFICATION OF REQUIREMENTS
• We want a person who wants to enter the music platform • entity-relationship model: It is s a graphical repre-
to have two options, a log in or a sign up. sentation that illustrates how “entities” (such as people,
• If the person indicates that he/she wants to log in be- objects, or concepts) relate to each other within a peo-
cause he/she already has a registered account, the system ple, objects or concepts) relate to each other within a
verifies that the account has been registered before. system. system. These diagrams are used to design or
• If the person indicates to register, the system saves the debug relational databases in fields such as software in
data provided by the user. fields such as software engineering, business information
• There are two types of users, a free user and a subscribed systems, education and information systems, education
user. The user becomes a subscriber when he/she makes a and research.
monthly payment to the platform, which provides certain
benefits, such as listening to music without ads, returning
songs and playing songs from a playlist randomly.
• When a user wants to be an artist he/she goes to a menu
of options in which he/she indicates his/her artist data
and has to upload an album with songs.
• A user (regardless of the state he/she is in) can make a
playList with the songs he/she likes.

III. METHODOLOGY AND MATERIALS


Taking into account the requirements, a software design and
analysis phase follows. This part is crucial to visualize the Fig. 2. entity-relationship model.
2

• Class diagram:The class diagram is a fundamental part a different memory space for the same song. It is
in the implementation of a software development. This is convenient to use a singleton pattern in which you
the one that outlines the software structure, determining have a single object that is instantiated only once
the interacting classes, their attributes and methods. In and for each user who needs the information of
addition to this, it is possible to visualize the design this object that has been instantiated by another
patterns which are being implemented. user (artist) obtains the same information.This
helps in memory consumption performance by not
having to instantiate so many objects with the same
information.

Fig. 3. ClassDiagram. Fig. 4. Without using singleton pattern: Example diagram of how several
classes trying to access different instances of objects with the same charac-
teristics behave.
IV. D ESIGN PATTERNS
Design patterns are models or templates that guide devel-
opers in finding solutions to common problems in software
development and other areas of interaction or interface design.
These patterns provide standard and reusable solutions to
complex problems regardless of the programming language
used.
Design patterns are divided into three:
• Creational patterns:solve problems related to the cre-
ation of object instances.
• Structural patterns:focus on the composition of classes
and objects to form larger, more flexible structures.
• Behavioral patterns:focus on how the objects interact
Fig. 5. Using singleton pattern: Example diagram in which several classes
and distribute responsibilities. access the instance of a single object .

• Creational patterns used: • Behavioral patterns used:


– State:
– Singleton: The State pattern allows an object to change its
To guarantee the maintainability and flexibility of behavior according to its current state, so the object
the service, we chose to use the singleton pattern, will appear to change its class. This is achieved
which allows a concrete class, which does not by polymorphism and obeys the solid principles of
change its state, to be instantiated only once. open closed and single responsability.

This pattern adapts perfectly to the “Song” class, This pattern is implemented since a user can take two
which has the attributes of the song; to the “Album” forms of state: “FreeUser” and “SubscribedUser”.
class, which contains certain songs of an artist and
the “Add” class which is responsible for adding ads A free user does not allow you to have certain
to the Free User class. benefits that a subscribed user would have, so when
a user makes a monthly payment to the platform
If we detail the class “song”, the objects that it automatically adopts other methods that the free
are in this class are static, so it would not make user would not have.
sense to give each user that plays a certain song
3

– Command: counterproductive, the ideal is to leave the album class


The command pattern is a behavior pattern whose in a concrete form without it changing its state. The user
functionality is to encapsulate a request for some class depending on its state changes its methods and
operation under a method, which converts a request applies them to the static album class, which is achieved
into an independent object containing all the with the pattern State.
information about the request. This transformation
allows you to pass requests as an argument to a • Proxy pattern:
method, delay or queue the execution of a request, There are several types of proxy, including the protection
and support operations that can be undone. focus proxy, which controls access to the original object,
on the composition of classes and objects to form and the intelligent reference proxy pattern, which is a
larger, more flexible structures. substitute for a simple pointer that performs additional
What you want to do by implementing this design operations when an object is accessed, both of which
pattern is that a user chooses a song to play and allow additional maintenance tasks to be performed
when listening to a song continues adding songs to when an object is accessed.
listen to later, so it would be adding objects with
internal requests in a queue of requests. To handle the access control we wanted to use the
When the user selects to play or queue a song this proxy pattern that works as an intermediary between the
request becomes a separate object containing all the “Stateuser” class and the “song” class. When a user tries
information about the request. to access the class “song” what the proxy pattern does
is to control the access to the concrete class “song” and
obtain the information, performing additional operations
V. A NTIPATTERNS depending on the state of the user without damaging the
logic of the class that is being accessed. Therefore, if a
A design antipattern is a design pattern that invariably free user wants to listen to music, what the proxy pattern
leads to a bad solution to a problem. Unlike design patterns, does is to verify the state of the user and as it is a free
which offer good solutions, anti-patterns instead of solving a user, it performs the function of adding advertisements
problem quickly and optimally add complexity to the code to the song that the user is going to listen to without
without the need for it. affecting the functionalities or the internal logic of the
class “song”.
For the realization of this web service we wanted to
implement many more patterns, however it was analyzed Implementing the proxy pattern gave more difficulties
that implementing them became counterproductive. This than solutions since “song” and “proxy” would have
respects the principle of “Smokes and Mirrors” what its use to inherit from the “user” class, which by structure is
is to show how a functionality will be before it is implemented. wrong. The solution given to this anti-pattern is to create
an “Add” class which directly adds advertisements to
Besides this, containing many patterns in the same code the “FreeUser” class.
does not mean that the code is well implemented, on the
contrary, it runs the risk of being overloaded, this because
it lacks more knowledge in implementing certain “Bad
Management” patterns. VI. C ODE S MELLS
Code Smells are traces in the code that indicate a deeper
Some anti-patterns that allowed us to take successful paths problem in the application or code base. They are not
are the following: bugs or errors, but tangible and observable violations of
the fundamentals of code design/development that could
• Observer Pattern: ultimately lead to poor code quality and technical debt.
The observer is an example of antipatterns, since we
must not force a pattern to the program implementation. To fix the code smells that existed at the time of developing
it is used when you need to notify state changes to the software, we had to refactor, splitting functions that were
an object. It is composed of three classes, the subject very long and simplifying complex structures, as when we
(object under observation), the observer and the client wanted to implement the proxy, since this was a complex
(who receives the notifications). structure that could be solved in a better way by adding a
class that added additional operations to one of the User states.
For the project we wanted to implement it in such a way
that the user would be the observed class, since a user To make the code readable and understandable by anyone
can change its state from free user to susbcritedUser. other than those who were making the software, we tried to
As the user is the class which is changing the observer handle variables and class names that are intuitive and easy
notifies the album class so that it could in this way to understand. In addition to this we tried to avoid making
change its state as well, however, this would be somewhat “spaghetti code” and added comments necessary to describe
4

certain features that the code had. At the time of making As a result, running a virtual environment for python
comments should be only to what is necessary, since to abuse “pyenv”, when performing unit tests of the small parts that
this can become a code Smell. make up the system can be seen that the software works as
expected and follows a good linearity with the requirements
In addition to this, to maintain code quality, a Python linter and user stories.
called “PyLint” was used, which helped in verifying errors
and imposing coding standards.
IX. C ONCLUSIONS
Finally, to ensure code optimization, unit tests were For the development of the music player web page, it can
performed, which when executed in isolation are designed to be concluded that a good software quality was maintained,
verify that the code executes as expected, according to the thus meeting the established standards and expectations.
logic that must respect the requirements. It is demonstrated that the code is functional, since with
the unit tests it is verified that the functions are executed
correctly and meets the expected requirements.
VII. S OLID P RINCIPLES It is also seen the quality of performance since using the
singleton pattern allows us to make a better use of system
In addition to the identification of code smells for clean
memory. In addition to this, the maintainability of the
code, there are the SOLID principles, which are defined as
software is seen, since by implementing code smells and a
a set of rules and concepts that help developers write clean,
good documentation it is possible to maintain and modify the
scalable and maintainable code.
code.
Design patterns along with the application of code smells
are closely related to the implementation of SOLID principles,
X. R EFERENCES
significantly improving service design and maintainability.
[1] C. A. Sierra (2024, March 19). Software model-
When implementing the State pattern the Single ing [Online]. Available: https://github.com/EngAndres/ud-
Responsibility Principle is respected, since each state public/tree/main/courses/software-modeling
can have its own class, which means that each class has a [2]Refactoring Guru - Design Patterns: Refactoring Guru.
single responsibility, which is to handle the behavior of that Design Patterns, Inc web https://refactoring.guru/es/design-
specific state. patterns
[3]SourceMaking - Design Patterns: SourceMaking. Design
The Open/Closed Principle (OCP) is also obeyed, as this Patterns, Inc web https://sourcemaking.com/design-patterns
principle indicates that a class or functionality must be
open for extension, but closed for modification. With the
State pattern, new states can be added without modifying
existing classes. When applying the command pattern, the
Single Responsibility Principle is also respected, since each
command has a single responsibility, which is to execute a
specific action. In addition to this, the Dependency Inversion
Principle (DIP) is respected, since high-level modules can
depend on abstractions (command interfaces) instead of
concrete details.

Code smells like “Inappropriate inheritance” (which was


seen when using the proxy pattern), may indicate that derived
classes cannot replace their base classes correctly. Correcting
this implements Liskov Substitution Principle

VIII. R ESULTS
For the music platform service to work and store
information, a database was connected to a docker, using the
Postgres database engine. In this database is stored all the
information of the users, whether they are subscribed or free,
the information of the artists, the albums and the songs in
audio format is stored.

You might also like