How to design a program? From how to design programs
By Matthias felleisen/Robert Bruce findler/Matthew Flatt/Shriram krishnamurthi Liu Jianwen translated (http://blog.csdn.net/keminlau
)
Key: Programming Methodology, scientific methodology, vocational innovation, Basic Education
Preface
It goes against the grain of modern education to teach children to program. What fun is there in making plans, acquiring discipline in organizing thoughts, indexing attention to detail and learning to be self-critical?
-- Alan Perlis, epigrams in programming
It is contrary to modern pedagogy to teach children procedural design knowledge. Plan. Learn teaching rules. Pay attention to details. What is the pleasure of strict self-discipline?
-- Alan Petley (winner of the 1966 Turing Award)
Extends comprehensions require some form of computer programming. Accountants program spreadsheets
And word processors; photographers program photo editors; musicians program synthesizers; and professional programmers instruct plain computers. programming has become a required skill.
Many occupations require some form of computer "Programming ". Accountants use workbooks and word processing programming, photographers use picture editing programming, musicians use audio synthesis programming, and professional programmers directly design computers. "Program Design" has become a skill that everyone needs to master.
Kemin: the author means that everyone has to work and is abstracted as a common concept-program design.
Yet programming is more than just a vocational skill. indeed, good programming is a fun activity, a creative outlet, and a way to express abstract ideas in a tangible (entity, tangible) form. and designing programs teaches a variety of skills that are important in all kinds of comprehensions: Critical Reading, analytical thinking, creative synthesis, and attention to detail. we therefore believe that the study of Program Design deserves the same central role in general education as mathematics and English. or, put more succinctly, everyone shocould learn how to design programs.
Programming is not just a professional skill. In fact, programming is an interesting activity, a creative means, and a tangible way to express abstract concepts. By designing programs, you can hone your professional skills, such as reading, analyzing, hands-on, and listening (focusing on details. Therefore, in basic education, the status of programming curriculum should be as important as mathematics and Chinese. Or in a more concise way, everyone should learn how to design the program. Why?
On one hand, Program Design teaches the same analytical skills as mathematics. but, unlike mathematics, working with programs is an active approach to learning. interacting with software provides immediate feedback and thus leads to evaluation, experimentation, and self-evaluation. furthermore, designing programs produces useful and fun things, which vastly increases the sense of accomplishment when compared to drill exercises in mathematics. on the other hand, Program Design teaches the same analytical reading and writing skills as English. even the smallest programming tasks are formulated as word problems. without critical reading skills, a student cannot design programs that match the specification. conversely, good Program Design Methods force a student to articulate thoughts about programs in proper English.
On the one hand, programming, like mathematics, can train people's analytical capabilities. What's different is that programming is a positive learning method. During the interaction with software, students can directly get feedback for exploration, experimentation, and self-evaluation. Compared with studying mathematical exercises, the results of programming, computer software, are more interesting and useful. They can greatly increase students' sense of accomplishment. On the other hand, programming, like Chinese, can enhance students' reading and writing abilities. Even the smallest programming task is expressed in words. Without good judgment and reading skills, it is impossible to design a program that complies with the specifications. Otherwise, good programming practices will force students to clearly express their thinking processes in appropriate languages.
Programming Design prescription
Our guidelines are formulated as a number of Program Design recipes.1 a design recipe guides a beginning programmer through the entire problem-solving process. with Design recipes, a beginner almost never again stares at a blank piece of paper or a blank computer screen. instead, the student will check the design recipe and use the question-and-answer guidelines to make some progress.
This book proposes a programming guide called programming design recipe to introduce the concept of programming methodology. The Programming Design Department can guide beginners in programming to practice the whole process of problem solving. With the design prescription, beginners of programming don't have to stare at the blank paper or computer screen, and they can check themselves and check the design prescription, use the Q & A method to design programs and make progress.
We created the Design recipes by identifying categories of problems. the identification of a problem category is based on the classes of data that are used to represent the relevant information. starting from the structure of this class description students derive the programs with a checklist. figure 1 shows the basic six steps of a design recipe checklist. each step produces a well-defined intermediate product:
- 1. The description of the class of problem data;
- 2. The informal specification of a program's behavior;
- 3. the authentication of the behavior with examples;
- 4. The development of a program template or layout;
- 5. The transformation of the template into a complete definition; and
- 6. The discovery of errors through testing.
The major difference concerns the relationship of steps 1 and 4.
We create various design prescriptions based on the problem category, and the classification of the problem category is based on the data used to describe the problem and the type of relevant information (class ). Starting from a data-type structure, students can use a checklist to semi-automatic export programs. The following are the six basic steps for designing a prescription. Each step produces a well-defined intermediate result:
- 1. Write down the type of the problem Data
- 2. Write down the informal specification of program behavior (specification)
- 3. Examples of program behavior
- 4. Develop the template or overall framework of the program
- 5. Convert the above program Template into a complete definition
- 6. Errors discovered through testing
The major difference between different design prescriptions lies in steps 1 and 2.
Design recipes help beginners and teachers alike. teachers can use the recipes to inspect a beginner's problem-solving skills, to diagnose weaknesses, and to suggest specific remedial steps. after all, each stage of the design recipe yields a well-defined, checkable product. if a beginner is stuck, a teacher can inspect the intermediate products and determine what the problem is. based on this analysis, the teacher can then provide guidance for a specific step in the recipe, raise appropriate questions, and recommend additional practice exercises.
Designing prescriptions is not only helpful for beginners, but also helpful for teachers' teaching. The instructor can use the list to check the beginner's ability to solve the problem and diagnose the weakness of the student's ability, so as to strengthen the student's ability. In addition, each step of the design prescription will produce a clearly defined and verifiable result; if a beginner is pinned in the design process, the instructor can use the list to check his intermediate results, determine the problem. Based on this targeted analysis, teachers can provide targeted learning guidance to students, such as asking some questions and recommending some additional exercises.
Design prescription
Cooking is at once Child's play and adult joy. And cooking done with care is an act of love.
-- Craig Claiborne (1920-2000), Food Editor, New York Times
Cooking is both a child's game and an adult's pleasure, and careful cooking is a love action.
-- Craig kalebonn (1920--2000), editor of The New York Times diet Edition
Learning to design programs is like learning to play soccer. A player must learn to trap a ball, to dribble with a ball, to pass, and to shoot a ball. once the player knows those basic skills, the next goals are to learn to play a position, to play certain strategies, to choose among feasible strategies, and, on occasion, to create variations of a strategy because none of the existing strategies fits.
Learning design programs are like learning to play football. They must practice ball capturing, dribbling, passing, and shooting. Once you have mastered these basic skills, the next goal is to learn to assume a role and select and implement appropriate strategies ,. In this way, when you encounter a strategy that does not fully conform to the situation, you can adjust the strategy that meets the situation as appropriate.
A programmer is also very much like an effecect, a composer, or a writer. they are creative people who start with ideas in their heads and blank pieces of paper. they conceive conception of an idea, form a mental outline, and refine it on paper until their writings reflect their mental image as much as possible. as they bring their ideas to paper, they employ Basic Drawing, writing, and instrumental skills to express certain style elements of a building, to describe a person's character, or to formulate portions of a melody. they can practice their trade because they have honed uses a sharpening stone to grind their basic skills for a long time and can use them on an instinctive instinct, intuitive level.
Programmers are creative people like architects, writers, and writers. Their Innovation started with an idea in the brain and a White Paper in their hands. They repeat, describe, and refine the idea on paper until they are as close as possible to the prototype. In the process from conception to implementation, they will use some basic vocational skills for work (such as drawing and writing ), for example, architects draw to express the architectural style and writers describe the characteristics of people. They are competent for their profession because they have honed these basic skills for a long time and can use these skills instinctively at work.
Programmers also form outlines, translate them into first designs, and iteratively refine them until they truly match the initial idea. indeed, the best programmers edit and rewrite their programs evaluate times until they meet certain aesthetic standards. and just like soccer players, javasts, composers, or writers, programmers must practice the basic skills of their trade for a long time before they can be truly creative.
The program designer also started from the conception and initially translated it into the first design version, and then revised it repeatedly until it was consistent with the original conception. In fact, excellent programmers have high requirements on their works. They edit and modify their programs multiple times to meet certain aesthetic standards. From the point of view of the work process, programmers, like football players, architects, composite and writers, need to carry out their professional work and even innovative work, they must first practice the basic skills required for the profession for a long time.
Design recipes are the equivalent of soccer ball handling techniques, writing techniques, techniques of arrangements, and drawing skills. A single design recipe represents a point of the program design space. we have studied this space and have identified into important categories. this book selects the most fundamental and the most practical recipes and presents them in increasing order of difficulty.2
(Kemin: This section is not translated by myself) Designing prescriptions is like ball control techniques, writing techniques, music arrangement techniques, and drawing techniques. Through study and research, in the field of programming, computer scientists have accumulated many important methods and skills. This book selects the most important and practical ones and explains them one by one.
About half the Design recipes focus on the connection between input data and programs. more specifically, they show how the template of a program is derived from the description of the input data. we call this data-driven program design, and it is the most frequently used form of design. data-driven designs are easy to create, easy to understand, and easy to extend and modify. other Design recipes introduce the notion of generative recursion, accumulation, and history sensitiation.
(Kemin: This section is not translated by myself) about half of the design tips in this book involve the relationship between input data and programs. More accurately, they describe how to derive the entire program template from the input data description. This data-driven programming method is the most common and easy to create. Understanding. Extension and modification. Other design tricks include generative recursion ). Accumulation and history sensitivity ).
The first one produces recursive Programs that generate new instances of problems as they recur; accumulator-style programs collect data as they process inputs; and history-sensitive programs remember information between additional applications. last, but not least, we also introduce a design recipe for processing acting over programs. abstracting is the act of generalizing two (or more) similar designs into one and of deriving the original instances from it.
(Kemin: This section is not translated by myself.) recursive Programs can be called repeatedly to handle new problems. Programs with accumulators collect data during input processing, historical sensitive programs can remember the information that a program is called multiple times. Last, but not least, it is the design know-how of abstract programs. Abstraction refers to the generalization of two (or more) similar designs into one and derived from the original example.
On every occasions, a problem naturally suggests one design recipe. on others, a programmer must choose from among several possibilities; each choice may produce programs with vastly different organizations. making choices is natural for a creative programmer. but, unless a programmer is thoroughly familiar with the bag of Design recipes to choose from and completely understands the consequences of choosing one over the other, the process is necessarily ad hoc and leads to whimsical, bad designs. we hope that by mapping out a collection of Design recipes, we can help programmers understand what to choose from and how to choose.
In many cases, a problem is often only applicable to a specific design prescription. Sometimes, there may be several alternative design prescriptions for one problem, and different design Prescriptions may produce completely different program organizations. Making a choice is a creative embodiment of the programmer (Kemin: designing a prescription is just a semi-automatic assistance design method), so unless the programmer is very familiar with all the optional design prescriptions, a complete understanding of the consequences of choosing a prescription instead of another prescription. Otherwise, the programmer must trim unsuitable existing prescriptions and design them as needed. Simply put it bluntly, he will only get an odd design.
Now that we have explained what we mean by ''programming ''and '''program design, ''the reader can see why and how teaching program design instills thinking skills that are important in a variety of comprehensions. to design a program properly, a student must:
- 1. Analyze a problem statement, typically stated as a word problem;
- 2. Express its essence, abstractly and with examples;
- 3. Formulate statements and comments in a precise language;
- 4. evaluate and revise these activities in light of checks and tests; and
- 5. Pay attention to details.
All of these are activities that are useful for a businessman, a lawyer, a journalist, a scientist, an engineer, and other others.
Now, I think you should start to understand what I meant by the so-called "program design. You should also understand why "Program Design" is useful for every profession and how to teach "program design ". To properly design the program, you must:
- 1. Analyze the statement of a problem (usually expressed in words );
- 2. grasp the essence of the problem and express it in an abstract and concrete way;
- 3. formalizing the problem statement and commenting on the fuzzy location in a precise language;
- 4. evaluate and revise the above activities through inspections and tests; and
- 5. Pay attention to the details.
The above process is almost similar to the general scientific methodology, so it is effective for all occupations, including businessmen, lawyers, journalists, scientists and engineers.
While traditional programming requires these skills, too, beginners often don't understand this connection. the problem is that traditional programming languages and traditional forms of programming force students to perform a large amount of book-keeping work and to memorize a large number of language-specific facts. in short, menial work drowns the teaching of essential skills. to avoid this problem, teachers must use a programming environment that imposes as little overhead as possible and that accommodates beginners. because such tools didn't exist when we started, we developed them.
Methodology is very valuable, but "people do not know how to use it", especially for beginners. Generally, programmers sink into technical details (such as language details), which is harmful to productivity and career development. However, we cannot simply talk about method theory without details. How can we find a good compromise between the two? The author of this book claims to be developing an auxiliary tool. Well, we will wait and see that Wen GE will start to work ......