Purpose and task Objective: familiar with the UML, familiar with the singleton, builder mode. Tasks: in accordance with the requirements of the experiment content, done using the singleton, builder model to achieve experimental content. |
|||||||||||
Content preview Review the contents of UML course, familiar with the Singleton pattern, using the builder pattern. |
|||||||||||
Experiment contents and requirements
Please read in conjunction with singleton pattern achieved (refer to JSP course code) based txt profile. Txt file you can create your own, for example: 1 2003 Spring Soccer League (Spring '03) 2 2003 Summer Summer Soccer Fest 2003 3 2003 Autumn Autumn Soccer League (2003) 4 2004 Spring Soccer League (Spring '04) 5 2005 Summer The Summer of Soccer Love 2005 6 2006 Autumn Autumn Soccer League (2006) Please put the file in a directory, and reads information using a single embodiment of the file mode (note that the file format and content, self-defined), placed in memory for the system to call other modules.
You can use the existing computer products according to customer demand without CPU, RAM, motherboard form games on your computer and office computer, try builder described the scene mode, it requires the drawing class diagrams and Coding. |
|||||||||||
The results (available Continued) One:
two: Abstract builder (Bulid): ComputerBulider.java: Specific builder (ConcreteBulid): GameComputerBulider.java: officeComputerBulider.java:
Director ( director): Director.java: Product ( Product): Computer.java: CPU.java: MotherBoard.java:
RAM.java: Main: Main.java:
类图: 思考题:
2、单例模式分为饿汉式和懒汉式,如何区别? 饿:上来就创建好实例对象,直接返回 3、请给出实验内容2中的时序图,请问如果增加一种中档电脑,系统如何变化?给出类图。
|
Singleton, the builder pattern
Guess you like
Origin blog.csdn.net/yszbrzdd/article/details/93520922
Recommended
Ranking