正在加载图片...
6.001 Structure and Interpretation of Computer Programs. Copyright o 2004 by Massachusetts Institute of Technology 6.001 Notes: Section 7.1 Slide 7.1.1 In the past few lectures, we have seen a series of tools for helping us create procedures to compute a variety of Good programming practices computational processes. Before we move on to more complex issues in computation, it is useful to step back and look at more general issues in the process of creating procedures In particular, we want to spend a little bit of time talking about good programming practices. This sounds a little bit like lecturing about"motherhood and apple pie", that is, a bit like lking about things that seem obvious, apparent, and boring in that everyone understands and accepts them. However, it is surprising how many"experienced" programmers don't execute Le 8n20 60015e good programming practices, and we want to get you started on the right track Slide 7.1.2 Good programming practices Thus, in this lecture we are going to look briefly at several methodological aspects of creating procedures: designing the Code design components of our code, debugging our code when it doesnt Debugging run correctly, writing documentation for our code, and testing · Documentation our code. We will highlight some standard practices for each stage, and indicate why these practices lead to efficient and Types as tools for debugging effective generation of code 6001 SICP Slide 7.1.3 Lets start with the issue of how to design code, given a problem statement. There are many ways to do this, but most Code layout and design of them involve some combination of the following steps Design of Design of data structures Data structures Design of computational modules Natural collections of information Design of interfaces between modules Suppression of detail from use of data Procedural modules Once we have laid out the general design of these stages, we follow by creating specific instantiations of the actual components. We have not yet talked about data structures in Scheme, and will return to this issue in a few lectures. For our e mnao 60015e purposes here, the key thing to note is that when designing a computational system, it is extremely valuable to decide what kinds of information naturally should be grouped together, and to then create structures that perform that grouping, while maintaining interfaces to the structures that hide the details. For example, one thinks naturally of a vector as a pairing of an x and y coordinate. One wants to6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. 6.001 Notes: Section 7.1 Slide 7.1.1 In the past few lectures, we have seen a series of tools for helping us create procedures to compute a variety of computational processes. Before we move on to more complex issues in computation, it is useful to step back and look at more general issues in the process of creating procedures. In particular, we want to spend a little bit of time talking about good programming practices. This sounds a little bit like lecturing about "motherhood and apple pie", that is, a bit like talking about things that seem obvious, apparent, and boring in that everyone understands and accepts them. However, it is surprising how many "experienced" programmers don't execute good programming practices, and we want to get you started on the right track. Slide 7.1.2 Thus, in this lecture we are going to look briefly at several methodological aspects of creating procedures: designing the components of our code, debugging our code when it doesn't run correctly, writing documentation for our code, and testing our code. We will highlight some standard practices for each stage, and indicate why these practices lead to efficient and effective generation of code. Slide 7.1.3 Let’s start with the issue of how to design code, given a problem statement. There are many ways to do this, but most of them involve some combination of the following steps: • Design of data structures • Design of computational modules • Design of interfaces between modules Once we have laid out the general design of these stages, we follow by creating specific instantiations of the actual components. We have not yet talked about data structures in Scheme, and will return to this issue in a few lectures. For our purposes here, the key thing to note is that when designing a computational system, it is extremely valuable to decide what kinds of information naturally should be grouped together, and to then create structures that perform that grouping, while maintaining interfaces to the structures that hide the details. For example, one thinks naturally of a vector as a pairing of an x and y coordinate. One wants to
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有