The Comment Class
Explore how to enhance a social media app by adding a Comment class to support interactive conversations. Learn object composition by linking comments to users and posts, and practice managing comments through encapsulated methods for cleaner, realistic designs.
Chirpy is coming together nicely. So far, users have created posts and liked them. Let’s see the list of tasks that Chirpy can do so far!
Add a user.
Post a chirp.
Like a chirp.
But what about the conversation that follows a chirp?
Social media isn’t just about posting and liking—it’s about dialogue.
Today, we’ll add that conversational element by introducing a Comment class. ...
Now that you’ve identified the problem and are heading in the right direction toward a solution, let’s take the next step and start building the Comment class to bring conversations to life on Chirpy!
The Comment class
The idea is simple: each comment will have text and an associated commenter (a user). This demonstrates composition in that a comment is built by combining ...