如何设计面向对象的项目? [英] How do you design object oriented projects?

查看:126
本文介绍了如何设计面向对象的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个大项目(对我来说)这将有许多类,将需要可扩展的,但我不知道如何规划出我的程序和类需要如何进行交互。

I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact.

我花了一个OOD课程几个学期回来,并从中学到了很多东西;就像写UML,和翻译要求文档转换成对象和类。我们了解到序列图过,但不知何故我错过了讲座什么的,他们并没有真正坚持和我在一起。

I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objects and classes. We learned sequence diagrams too but somehow I missed the lecture or something, they didn't really stick with me.

使用previous项目使用我从我的过程中学会了方法做过尝试,但通常与code,一旦我可以说结束了是啊,看起来像什么,我脑子里想的我有没有欲望通过渣土挖增加新的功能。

With previous projects I've tried using methods I learned from the course but usually end up with code that as soon as I can say "yeah that looks something like what I had in mind" i have no desire to dig through the muck to add new features.

我已经得到了史蒂夫·麦康奈尔的的 code的完整副本的我不断听到的是惊人的,这里和其他地方。我读设计章和似乎没有拿出我正在寻找的信息。我知道他说,这是不是一个切,风干过程中,它主要是基于启发式,但我似乎无法把他的所有信息,并把它应用到我的项目。

I've got a copy of Steve McConnell's Code Complete which I continually hear is amazing, here and elsewhere. I read the chapter on design and didn't seem to come out with the information I'm looking for. I know he says that it's not a cut and dried process, that it's mostly based on heuristics, but I can't seem to take all his information and apply it to my projects.

所以您在高水平的设计阶段做(你开始编程之前)是什么东西,以确定哪些是你需要的类(尤其是那些不基于任何在现实世界中的对象),他们将如何互动相互

具体我感兴趣的是你使用的方法?什么是你按照通常yeilds一个良好的,干净的设计,将密切重新present最终产品的过程中?

Specifically I'm interested in what are the methods you use? What is the process you follow that usually yeilds a good, clean design that will closely represent the final product?

推荐答案

这是我使用的初步设计(获得一类图)的步骤,分别是:

The steps that I use for initial design (getting to a class diagram), are:


  1. 收集需求。聊到客户端,并分解出的用例来定义软件应该具备哪些功能。

  1. Requirements gathering. Talk to the client and factor out the use cases to define what functionality the software should have.

撰写的个人用例的叙述。

Compose a narrative of the individual use cases.

通过叙述去,并强调名词(人,地,事),作为候选类和动词(动作),由于方法/行为。

Go through the narrative and highlight nouns (person, place, thing), as candidate classes and verbs (actions), as methods / behaviors.

舍弃重复的名词,并分解出常见的功能。

Discard duplicate nouns and factor out common functionality.

创建一个类图。如果你是一个Java开发人员,NetBeans的6.7 Sun有一个UML模块,允许图表以及往返工程,它是免费的。日食(一个开源的Java IDE),也有一个建模框架,但我与它没有任何经验。您也可以尝试的ArgoUML,一个开源工具。

Create a class diagram. If you're a Java developer, NetBeans 6.7 from Sun has a UML module that allows for diagramming as well as round-trip engineering and it's FREE. Eclipse (an open source Java IDE), also has a modeling framework, but I have no experience with it. You may also want to try out ArgoUML, an open source tool.

应用OOD的原则来组织你的类(分解出常见的功能,建立层次结构,等等。)

Apply OOD principles to organize your classes (factor out common functionality, build hierarchies, etc.)

这篇关于如何设计面向对象的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆