Summarizes chapter one of datastructures and program design in C++
2013-08-20 20:54
651 查看
Summarizes chapter one of datastructures and program design in C++
The chapter one has summarizes importantprinciples of good programming aim at large projects, and introduces somemethods for discovering effective algorithms.
First, the problems of large program arethat depends on the basic tasks. Each part of large program must be wellorganized, clearly written, and thoroughly understand.
We shall distinguish between methods andfunctions as convention: Methods of a class are public. Functions in a classare private.
Second, summarizes some good program as follow:
Programming Precept:
☆ Include precise preconditionsand post conditions with every program, function, and method that you write. (Asimilar list should be including with every program, function, or method.)
☆ Always name your classes,variables and functions with the greatest care, and explain them thoroughly.(The careful choice of name can go a long way in clarifying a program and in helping to avoid misprints and common errors.)
☆ Keep your documentation concisebut descriptive.
▪Place a program at thebeginning of each function.
▷Identification
▷Statement of the purpose of thefunction and algorithm used.
▷The changes the function makesand what data it uses,
▷Reference to furtherdocumentation external to the program.
▪When each variable, constant,or class is declared, explain what it is and how it is.
▪Introduce each significantsection, paragraph and function of the program with a comment stating brieflyits purpose or action.
▪Indicate the end of each significantsection if it is not otherwise obvious.
▪Avoid comments that parrot whatthe code does or that meaningless jargon.
▪Explain any statement thatemploys a trick or whose meaning is unclear.
▪The code itself should explain howthe program works. The documentation should explain why it works and what itdose.
▪Whenever a program is modified,be sure that the documentation is corresponding modified.
▪The reading time for programsis much more than the writing time. Make reading easy to do.
☆ Don’t lose sight of the forestfor its tree.
☆ Use classes to model thefundamental concepts of the program. (The verbs that we use will often signifythe important functions.)
☆ Each function should do onlyone task, but do it well. (The function itself will undoubtedly contain manydetails, but they not appear until the next stage of refinement.)
☆ Each class or function shouldhide something. (we should practice information hiding.)
☆ Keep your connections simple. Avoidglobal variables whenever possible.
Never cause side effects if you can avoidit. If you must use global variables as input, document them thoroughly.
☆ Keep your input and output asseparate functions, so they can be changed easily and can be custom tailored toyour computing system.
☆ The quality of test data ismore important than its quantity. Program testing can be used to show thepresence of bugs, but never their absence.
☆ Testing methods: There are atleast three general philosophies that are used in the choice of test data. TheBlack-Box Method, The Glass-Box Method, the Ticking-box Method.
☆ For a large and importantprogram, more than half the work comes in the maintenance phase, after it hasbeen completely debugged, tested, and put into use.
☆ Be sure you understand your problem completely. If you must change its terms, explain exactly what you have down.
☆ Design the user interface withthe greatest care possible. A program’s success depends greatly.
☆ Do not optimize you code unless it isnecessary to do so. Do not start to optimize code until it is complete andcorrect. Most programs spend 90 percent of their time doing 10 percent of theirinstructions. Find this 10 percent, and concentrate your
efforts for efficiency there
☆ Keep your algorithms as youcan. When in doubt, choose the simple way.
☆ Sometimes postponing problemssimplifies their solution.
☆ Never code until thespecifications are precise and complete.
☆ Act in haste and repent atleisure. Program in haste and debug forever.
☆ Starting afresh is often easierthan patching an old program.
☆ Always plan to build aprototype and throw it away. You’ll do so whether you plan to or not.
The chapter one has summarizes importantprinciples of good programming aim at large projects, and introduces somemethods for discovering effective algorithms.
First, the problems of large program arethat depends on the basic tasks. Each part of large program must be wellorganized, clearly written, and thoroughly understand.
We shall distinguish between methods andfunctions as convention: Methods of a class are public. Functions in a classare private.
Second, summarizes some good program as follow:
Programming Precept:
☆ Include precise preconditionsand post conditions with every program, function, and method that you write. (Asimilar list should be including with every program, function, or method.)
☆ Always name your classes,variables and functions with the greatest care, and explain them thoroughly.(The careful choice of name can go a long way in clarifying a program and in helping to avoid misprints and common errors.)
☆ Keep your documentation concisebut descriptive.
▪Place a program at thebeginning of each function.
▷Identification
▷Statement of the purpose of thefunction and algorithm used.
▷The changes the function makesand what data it uses,
▷Reference to furtherdocumentation external to the program.
▪When each variable, constant,or class is declared, explain what it is and how it is.
▪Introduce each significantsection, paragraph and function of the program with a comment stating brieflyits purpose or action.
▪Indicate the end of each significantsection if it is not otherwise obvious.
▪Avoid comments that parrot whatthe code does or that meaningless jargon.
▪Explain any statement thatemploys a trick or whose meaning is unclear.
▪The code itself should explain howthe program works. The documentation should explain why it works and what itdose.
▪Whenever a program is modified,be sure that the documentation is corresponding modified.
▪The reading time for programsis much more than the writing time. Make reading easy to do.
☆ Don’t lose sight of the forestfor its tree.
☆ Use classes to model thefundamental concepts of the program. (The verbs that we use will often signifythe important functions.)
☆ Each function should do onlyone task, but do it well. (The function itself will undoubtedly contain manydetails, but they not appear until the next stage of refinement.)
☆ Each class or function shouldhide something. (we should practice information hiding.)
☆ Keep your connections simple. Avoidglobal variables whenever possible.
Never cause side effects if you can avoidit. If you must use global variables as input, document them thoroughly.
☆ Keep your input and output asseparate functions, so they can be changed easily and can be custom tailored toyour computing system.
☆ The quality of test data ismore important than its quantity. Program testing can be used to show thepresence of bugs, but never their absence.
☆ Testing methods: There are atleast three general philosophies that are used in the choice of test data. TheBlack-Box Method, The Glass-Box Method, the Ticking-box Method.
☆ For a large and importantprogram, more than half the work comes in the maintenance phase, after it hasbeen completely debugged, tested, and put into use.
☆ Be sure you understand your problem completely. If you must change its terms, explain exactly what you have down.
☆ Design the user interface withthe greatest care possible. A program’s success depends greatly.
☆ Do not optimize you code unless it isnecessary to do so. Do not start to optimize code until it is complete andcorrect. Most programs spend 90 percent of their time doing 10 percent of theirinstructions. Find this 10 percent, and concentrate your
efforts for efficiency there
☆ Keep your algorithms as youcan. When in doubt, choose the simple way.
☆ Sometimes postponing problemssimplifies their solution.
☆ Never code until thespecifications are precise and complete.
☆ Act in haste and repent atleisure. Program in haste and debug forever.
☆ Starting afresh is often easierthan patching an old program.
☆ Always plan to build aprototype and throw it away. You’ll do so whether you plan to or not.
相关文章推荐
- Data Structures and Program Design in C++
- Data Structures And Algorithms With Object-Oriented+Design+Patterns in C#
- 20162314 《Program Design & Data Structures》Learning Summary Of The Eighth Week
- Structure of a C-Program in Memory | How Heap,Stack,Data and Code segments are stored in memory?
- Data Structures and Other Objects Using C++ (Chapter 1) 学习笔记一
- 20162314 《Program Design & Data Structures》Learning Summary Of The First Week
- 数据结构与程序设计——C++语言描述(Data Structures & Program Design in C++) by Robert L.Kruse & Alexander J.Ryba
- Implementation codes of Data Structures and Algorithm Analysis in C (1)
- Data Structures and Other Objects Using C++ (Chapter 2) 学习笔记五
- More on Variables and Data Types(Chapter 10 of Programming in Objective-C 2.0)
- Data Structures and Other Objects Using C++ (Chapter 1) 学习笔记三
- 20162314 《Program Design & Data Structures》Learning Summary Of The Fifth Week
- Data Structures and Other Objects Using C++ (Chapter 2) 学习笔记四
- 20162314 《Program Design & Data Structures》Learning Summary Of The Second Week
- Aggregrate:Initialization of structures and arrays in C++
- 数据结构与程序设计——C++语言描述(Data Structures & Program Design in C++) by Robert L.Kruse & Alexander J.Ryb
- 20162314 《Program Design & Data Structures》Learning Summary Of The Ninth Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Eleventh Week
- Data Structures and Other Objects Using C++ (Chapter 1) 学习笔记二
- 20162314 《Program Design & Data Structures》Learning Summary Of The Ninth Week