# 4.3 Create modules and develop points of interaction that can apply to multiple situations and reduce complexity 创建通用模块, 来减少复杂度, 并使其适用于更广泛的问题
After students have had some experience identifying patterns (P4.1), decomposing problems (P3.2), using abstractions (P4.2), and taking advantage of existing resources (P4.2), they should begin to develop their own abstractions. As they progress, students should take advantage of opportunities to develop generalizable modules. For example, students could write more efficient programs by designing procedures that are used multiple times in the program. These procedures can be generalized by defining parameters that create different outputs for a wide range of inputs. Later on, students should be able to design systems of interacting modules, each with a well-defined role, that coordinate to accomplish a common goal. Within an object-oriented programming context, module design may include defining the interactions among objects. At this stage, these modules, which combine both data and procedures, can be designed and documented for reuse in other programs. Additionally, students can design points of interaction, such as a simple user interface, either text or graphical, that reduces the complexity of a solution and hides lower-level implementation details.
当学生有了一些识别模式(P4.1)、分解问题(P3.2)、使用抽象(P4.2)和利用已有资源(P4.2)的经验之后, 他们应该开始发展自己的抽象能力.
- 随着学生成长, 他们应该利用机会开发通用模块. 比如说, 编写程序时, 通过设计可以重复使用的流程, 来提高程序效率. 这些流程可以通过定义参数来获得不同的输出, 从而可以用于更广泛的地方
- 之后, 学生应该能够设计由互动模块组成的系统, 每个模块都有明确定义的角色, 这些模块协调完成一个共同任务. 在“面向对象编程”[1]中, 模块设计包括定义模块之间的交互行为. 在这个阶段, 可以设计和记录这些包含数据和处理流程的模块, 以便在不同程序中重复使用. 此外, 学生还可以设计交互点, 比如一个简单的用户界面, 可以是文字或者图像, 来隐藏底层的实现细节, 减少复杂性
“面向对象”的反面是“面条式编程”, 是指从头到尾一步步地编写程序, 而“面向对象编程”是指将程序抽象成一个个对象模块, 数据在对象之间传递和处理, 最终完成编程任务 ↩︎