我试图提高我的 OOD 思维。这是我的问题。
假设您要设计一个音乐 mp3 播放器。我上了一个包含播放列表集合的课程。
class Player {
    Map<String, List<Song>> playlists;    // <Name, PlayList>
    public void play (Song song) {
        // decode song
        // play song
    }
    public void play (String playlistName) {
        // play a playlist
        for (Song song : playlists.get(playlistName)) {
            play (song);
        }
    }
    public void stop () {
        // stop playing
    }
    public void pause () {
        // pause, resume playing the last song when hit play again
    }
}
假设“Song”已经包含了歌曲的所有元数据。已经描述了方法的所有功能。当我试图实现“暂停”方法时,我被卡住了。你会怎么做才能意识到这一点?
谢谢!