摘 要
面向对象(Object Oriented, OO)是当前计算机界关注的焦点,作为一种新兴的软件开发技术,正在逐渐取代传统的方法,日益成为当前软件工程领域的主流方式。与传统的开发技术相比,OO开发流程具有较高的可维护性,可重用性和满足用户需求的优点。作为面向对象的主要建模语言UML,是一种定义良好、易于表达、功能强大且普适的建模语言大学论文网www.wnwu.com.txt。
路线追踪器是在LEGO公司提供的硬件和操作系统的基础之上进行开发的,实现这样一个功能:在平面上对黑色线路进行探测,并沿着黑色线路自律行走。本系统是针对面向对象的开发流程(OO开发流程)在嵌入式系统中的应用。采用OO思想对分析、设计阶段的成果物进行建模,用UML来描述建模结果,即采用完全可视化的建模方式描述需求分析和设计,让整个系统易于理解和维护;通过使用Case工具来提高开发的效率;运用Rational Rose进行需求分析建模、设计建模、代码生成、代码重构与维护,使系统具有很好的重用性、扩展性大学论文网www.wnwu.com.txt。
通过整个开发流程(绘制UML图、成果物的文档化、编码实现、测试)的体验大学论文网www.wnwu.com.txt,对OO开发有了更深刻的了解,为以后类似系统的开发积累了丰富的经验。
关键字:面向对象,嵌入式系统,UML,Rational Rose,EC++
ABSTRACT
OO (Object-oriented) is current attention focus in computer domain, as a new software development technology, is gradually replacing traditional methods and becoming the mainstream in software engineering domain. Being compared with the traditional development technology, the OO development flow has the benefits of high maintainability, reusability and meets the user need. UML, as the main object-oriented modeling language, is a modeling language with many advantages, e.g., having well definition, being easy to express information and possessing powerful and universal modeling function.
Line Tracer is developed above the hardware and the operating system which is provided by LEGO Corporation and achieves such function: detecting the black line in the plane, then walking along the black line automatically. The system is the applications of the object-oriented (OO development process) development flow in embedded system. It uses OO thought to model the results of analysis and design phase and describe the modeling result with UML, that is, uses a complete visualization modeling method to describe requirement analysis and the design, so that the system becomes easy to be understood and maintained. The system can improve the efficiency of development by adopting the case tool. In the whole process of development, Rational Rose is utilized to finish requirement analysis modeling, the modeling design and code generation, reconstruction and maintenance. Apparently, the system has outstanding advantages of reusability and scalability.
Through experiencing the entire development flow (drawing up the UML chart, achievement documents, coding and testing), I have a more profound understanding to the OO development flow, accumulate rich experience for developing similar system in the future.
Keywords: OO (Object Oriented), Embedded System, UML, Rational Rose, EC++
目 录
第1章 绪论大学论文网www.wnwu.com.txt 1
1.1 面向对象机制 1
1.2.1 面向对象(Object Oriented, OO) 1
1.2.2 OO开发 2
1.2.3 面向对象的嵌入式开发 3
1.2.4 EC++(嵌入式C++) 3
1.2 UML(统一建模语言) 3
1.3 系统建模 4
1.4 Rational Rose工具 5
1.5 开发环境介绍 6
1.6 技术提示 6
第2章 系统分析 7
2.1系统开发的流程图 7
2.2需求分析 8
2.2.1 路线追踪器需求式样书 8
2.2.2 系统功能要素的模型化 9
2.2.3 实现限制的商讨 10
2.3静态分析 10
2.3.1找出作为类候补的对象 10
2.3.2 抽象化成为类 11
2.4动态分析 12
2.4.1 状态类的分析 12
2.4.2 从脚本出发描述系统的运行 14
2.5类图 16
2.6 小结 16
第3章大学论文网www.wnwu.com.txt 系统设计建模 17
3.1机制设计 17
3.1.1任务设计 17
3.1.2 task机制 18
3.2各种规则的制定 21
3.2.1决定共通部分的方针 21
3.2.2 决定规则 22
3.3 类与类之间的设计 22
3.3.1类设计 22
3.3.2 Act系设计 24
3.3.3 类之间设计 24
3.4工厂模式 25
3.5代码生成 25
3.6类图 26
3.7小结 27
第4章大学论文网www.wnwu.com.txt 系统实现 28
4.1实现上的注意点 28
4.2 common部分代码实现 29
4.2.1 Linetracer类 29
4.3.2 Steer类 30
4.3.3 Drive类 31
4.3.4 LightSensor类 32
4.3.5 Motor类 32
4.3.6 AbtFactory类 32
4.3.7 初始化(init)代码 32
4.4仿真 33
4.4.1 仿真部分的组成 34
4.4.2 MFC的应用 36
4.5实机 37
4.5.1 硬件接口 37
4.5.2 实机组成部分 39
4.5.3 编译文件 40
4.6小结 40
第5章 系统测试 41
5.1仿真部分测试 41
5.1.1 checklist的设计 41
5.1.2 测试步骤 42
5.2实机部分测试 42
5.2.1 checklist的设计 42
5.2.2 测试步骤 43
5.3小结 43
总 结 44
参考文献 45
致 谢 46