Every computer program deals with managing data. How you choose to represent these data within your program can have far-reaching implications on every other part of your application; consequently, reversing those decision becomes more and more costly over time, as the program becomes more complex. For this reason, thinking carefully in advance about how you want to model your data within your application can pay very big dividends.
One of the first challenges in modeling data is deciding what data to model. Let's consider an app we want to make, called Senior Paws. Senior Paws is an app for dog sitters taking care of old dogs, where you can track the dog's information, like its name, favorite treat, medication, and its owners. What attributes are most important to include in our data model?
Data Modeling Round 2! Take a look at each of the app descriptions below. For each description:
- Create a data model for the app by listing at least two relevant entities/abstractions (e.g. Senior Paws app, above) that the app might use, and list properties that make sense for that use case. You don't have to list all of them.
- Create Javascript objects of those entities and assign what data type the value of those properties should be
- Give an example of a relationship of the model. Keep in mind, not everything has to be connected to everything.
This app allows you to track movies you want to watch on different streaming platforms in one app. The app helps keep track of what movies you want to watch and where you can stream them (Netflix, HBO, Hulu, Amazon Prime, etc). Each streaming platform lists the movies that platform has to offer.
Write your answer here or in a separate js file.
This app hosts a ton of radio stations, each featuring their own playlists of songs. The radio stations can be listed by genre or popularity.
Write your answer here or in a separate js file.
This app will be a tool for managing all of your favorite bands' concerts; it will keep track of their tour dates, ticket purchasing, and next recommended show.
Write your answer here or in a separate js file.
This app will allow customers to browse a list of coffeeshops nearby, order drinks off of their menu, add those drinks to a shopping cart, and save that cart as a past order once the purchase is complete.
This app shows you all the latest stats from your favorite sports teams. You can view individual player stats and full team stats.
Write your answer here or in a separate js file.
Q. When you were creating relationships between the models, what were some thoughts or questions you had to help guide a connection between them?
Write your answer here or in a separate js file.
Now that you've had some practice really thinking about the data design of an app, we're going to learn about MongoDB, a no-SQL database. Starting tomorrow, our Express apps will be talking to the Mongo database through Mongoose. Since we're covering a LOT of ground tomorrow, take some time to introduce yourself to concepts and lingo surrounding MongoDB and Mongoose. You will not have to memorize the technical details here.
- MongoDB's Ridiculously Cheery Promo video: 2mins video
- The Good and Bad of MongoDB: 30mins video
- What is Mongoose? 2 min Video
- Official Mongoose Website
- Official Mongoose Docs
When you're ready to submit your work,
- Add, commit, and push your code.
- Submit your link to GA Grader