[System Design] 系统设计 (3) -- OOD
单例模式 Singleton使用场景
特点 Features
实现 ImplementationAn implementation of the singleton pattern must: ensure that only one instance of the singleton class ever exists; and class Solution { private static Solution instance = null; public static Solution getInstance() { if (instance == null) { instance = new Solution(); } return instance; } private Solution() {} }; 工厂模式 Factory PatternIOC injection -- Google 停车场设计 Parking LotEntities 哪些实体?
Manager 管理员
Blackjack AI 21点游戏EntitiesGameManager
GameRoom
Dealer
Player
Gamer (Player + Dealer)
Deck CardBox
Pack 装了4副牌or so
card
BlackJackCard
Elevator 电梯设计Entities
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |