From the course: Programming Foundations: Object-Oriented Design
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Jukebox class diagrams - Python Tutorial
From the course: Programming Foundations: Object-Oriented Design
Solution: Jukebox class diagrams
- Let's take a look at our solution and how we converted our conceptual model into a class diagram for a spaceship jukebox. There wasn't an obvious place to start here so we arbitrarily decided to begin with the song class because, well, songs are pretty essential to a jukebox. In regards to attributes, at a minimum, each song should have a title, so the user knows which song they're choosing and it should have an artist because one of our requirements was being able to sort songs by artist. Both of those attributes could be represented as strings and we decided to keep them private to the class. That means we should include a public get method for other objects to retrieve the song's title and artist. Finally, the song isn't very useful if it can't be played. So, we included a play method. Now, how that song actually gets played, is it on a record, a cd, an mp3 stored in a database? It doesn't matter here, they will all get handled under the hood in the implementation of the song…
Contents
-
-
-
-
-
-
-
(Locked)
Creating class diagrams: Attributes2m 24s
-
(Locked)
Creating class diagrams: Behaviors3m 9s
-
(Locked)
Converting class diagrams into code4m 29s
-
(Locked)
Instantiating classes3m 39s
-
(Locked)
Class with multiple constructors2m 29s
-
(Locked)
Static attributes and methods4m 19s
-
(Locked)
Challenge: Jukebox class diagrams1m 21s
-
(Locked)
Solution: Jukebox class diagrams5m 8s
-
(Locked)
-
-
-