UML实例--HELLO, WORLD!(一)
Brian Kernighan and Dennis Ritchie, the authors of the C programming language, point out that “the only way to learn a new programming language is by writing programs in it.” The same is true of the UML. The only way to learn the UML is by writing models in it.
The first program many developers write when approaching a new programming language is a simple one, involving little more than printing the string “Hello, World!” This is a reasonable starting point, because mastering this trivial application provides some instant gratification. It also covers all the infrastructure needed to get something running.
This is where we begin with the UML. Modeling “Hello, World!” is about the simplest use of the UML you’ll ever find. However, this application is deceptively easy because underneath it all there are some interesting mechanisms that make it work. These mechanisms can easily be modeled with the UML, providing a richer view of this simple application.
布赖恩·克尼汉和丹尼斯·里奇,C程序语言的作者,指出”学习一门新程序语言的唯一方法就是用这门语言编程.”这对于UML也同样适用.学习UML的唯一方法就是用它建模.
大多数的开发人员在接触一门新程序设计语言时所写的第一个程序通常都是打印字符串”你好,世界!”这是个合理的开端,因为熟练掌握这种小应用能获得即时的满足感.它也涵盖了为让某些东西运行起来的所有的基础需要.
我们也从这里开始学习使用UML吧.模型”你好,世界!”是你所能找到的关于UML最简单的应用.不管怎样,这个应用是很容易因为下面它拥有的一些有趣的机制让它工作.这些机制用UML建模是很容易的事,这个简单的应用提供了丰富的视图.