Peruse SICP 3 : Modularity, Objects, and State

Modularity, Objects, and State

Why name it as Modularity, objects and State?
Because the logic of their relationship, is that, the Modularity is purpose, the Objects is methodology, and the State is the key point of implement that is different from the previous way which is Procedures.

The preceding chapters introduced the basic elements from which programs are made. We saw how primitive procedures and primitive data are combined to construct compound entities, and we learned that abstraction is vital in helping us to cope with the complexity of large systems.

This is what we have already had, of which, abstraction for complexity of large systems.

But these tools are not sufficient for designing programs.

Problem comes, which is, not good for designing.
Why?

Effective program synthesis also requires organizational principles that can guide us in formulating the overall design of a program. In particular, we need strategies to help us structure large systems so that they will be modular, that is, so that they can be divided “naturally” into coherent parts that can be separately developed and maintained.

A better feature for a good design, which is, can be divided.

One powerful design strategy, which is particularly appropriate to the construction of programs for modeling physical systems, is to base the structure of our programs on the structure of the system being modeled.

Simulate the physical world. why physical world? Because it is already runnable.

For each object in the system, we construct a corresponding computational object. For each system action, we define a symbolic operation in our computational model. Our hope in using this strategy is that extending the model to accommodate new objects or new actions will require no strategic changes to the program, only the addition of the new symbolic analogs of those objects or actions. If we have been successful in our system organization, then to add a new feature or debug an old one we will have to work on only a localized part of the system.

To a large extent, then, the way we organize a large program is dictated by our perception of the system to be modeled. In this chapter we will investigate two prominent organizational strategies arising from two rather different “world views” of the structure of systems. The first organizational strategy concentrates on objects, viewing a large system as a collection of distinct objects whose behaviors may change over time. An alternative organizational strategy concentrates on the streams of information that flow in the system, much as an electrical engineer views a signal-processing system.

Both the object-based approach and the stream-processing approach raise significant linguistic issues in programming. With objects, we must be concerned with how a computational object can change and yet maintain its identity. This will force us to abandon our old substitution model of computation (section 1.1.5) in favor of a more mechanistic but less theoretically tractable environment model of computation. The difficulties of dealing with objects, change, and identity are a fundamental consequence of the need to grapple with time in our computational models. These difficulties become even greater when we allow the possibility of concurrent execution of programs. The stream approach can be most fully exploited when we decouple simulated time in our model from the order of the events that take place in the computer during evaluation. We will accomplish this using a technique known as delayed evaluation. {{footnotes}}

 
0
Kudos
 
0
Kudos

Now read this

第五章.闭包 (5.Closing in on closures)[完成]

这章写得极为精彩,让我明白了好多以前根本不知道的概念。 闭包是一个神奇的东西,新果说过,闭包就是可以当作鞭子来用,可以打出鞭子头一样的力道。 所谓的函数化这个概念中,闭包是一个很重要并且很精髓的概念。 想要理解函数化编程,就要深刻的理解闭包。 本章重点: 1.闭包的定义,闭包是什么,闭包如何工作 2.利用闭包来实现一些简单的开发 3.利用闭包实现性能上的增强 4.利用闭包实现私有域 5.1 闭包如何工作(How closures work) # 问:闭包是什么? 答:... Continue →