Top-Down Design

 
Top-Down Design

A good strategy for attacking a complex problem is to devise a clever way of breaking up the problem into sub-problems, and the sub-problems into smaller and smaller sub-problems until eventually they are so small and trivial that they can be solved individually.

Of course how that can be done is in general not necessarily trivial.

Exactly the same is true in writing complex computer programs. This strategy is often called top-down design.

C++ allows one to decompose a complex program into smaller sub-programs called functions.

There are many good reasons for using functions:

  1. Better Management of Large Projects -- Large and complex programs can be broken up into smaller more manageable pieces. Each piece can be worked on independently and at the same time by different groups of programmers.

  2. Code Reusability -- After a function has been coded and fully tested, it can be reused by any other programmers.

  3. Procedural Abstraction or Information Hiding -- In order to use a thoroughly tested function, the user only needs to know what the functions does, and not how the function actually accomplishes the task. The function can be treated as a "black-box".

 link:http://cis.poly.edu/~mleung/CS1114/s07/ch04/top_down.htm

posted on 2008-03-25 13:46 zmj 阅读(355) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理