Code Book 2 Reading Notes 04-Chapter 9 the pseudo code programming process

Source: Internet
Author: User

Chapter 9 The pseudo code programming process
PseudoCodeProgramming process

9.1 Summary of steps in building classes and routines
Create a class and a subaccountProgramSteps
Steps in creating a class
To create a class:
1. Overall Design of creating classes
2. Create a subroutine in the class
3. Review and test the entire class

Steps in building a routine
Procedure for creating a subroutine
Design a subroutine, check the design, write the subroutine code, and check the code.

9.2 pseudo code for pros
Pseudocode

· Use statements similar to English to accurately describe specific operations.
· Avoid using syntax elements in the target language.
· Write pseudocode at the intent level.
· Write pseudocode at a low enough level so that code can be generated almost automatically from it.

9.3 constructing routines by using the PPP
Create a subroutine through the pseudo-code programming process

· Design the routine design subroutine
1. Check prerequisites
2. define the issues to be solved by subprograms
3. Name the subroutine
4. Search for available functions in the standard library
5. Consider error handling
6. Consider efficiency issues
7. ResearchAlgorithmAnd Data Types
8. Write pseudocode
9. Consider data
10. Check pseudocode
11. Experiment with some ideas in pseudo-code and leave the best idea (iteration ).

Code the routine code for writing subprograms
1. Write the declaration of a subroutine
2. Fill in the code below each view
3. Check whether the Code needs further decomposition.
4. Check program errors in your mind
5. Compile a subroutine
6. Execute Code line by line in the debugger
7. Test code
8. Eliminate errors in the program

Cleaner up leftovers finishing work
1. Check the subprogram Interface
2. Check the overall design quality
3. Check the variables in the subroutine
4. Check the statements and logic in the subroutine
5. Check the subroutine Layout
6. Check the sub-program documentation.
7. Code for outgoing Redundancy

Repeat steps as needed repeat the above steps as needed

9.4 alternatives to the PPP
Alternative to the pseudo-code writing process

1. Test-first Development)
Test first is a popular development method. When developing with this method, you must write test cases before any code.
2. refactoring)
Refactoring is also a development method that improves the code quality by performing a series of semantic transformations and adjustments to the code.
3. Design by contract)
Each program has preconditions and postconditions ).
4. binning (hacking)
 
Key Points
· Creating classes and subprograms is usually an iterative process. The knowledge gained in the process of creating a subroutine often affects the design of the class in turn.
· The prepared pseudocode must be in easy-to-understand English, so avoid using specificProgramming LanguageOnly some features, at the same time writing pseudo code at the intent level (that is, to describe what to do

Instead of how to do it)
· The pseudo-code programming process is an effective tool for detailed design. It also makes coding easier. Pseudo code is directly converted into comments to ensure accuracy of comments.

Accuracy and practicality.
· Do not just stay on the first design you think. Use pseudocode repeatedly to make a variety of solutions, and then select the best one to start encoding.
· Check your work results after each step is completed, and encourage others to help you check the results. In this way, you will find errors at the lowest cost when you invest the least energy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.