当前位置:网站首页>1141_ SiCp learning notes_ Functions abstracted as black boxes
1141_ SiCp learning notes_ Functions abstracted as black boxes
2022-07-07 07:31:00 【grey_ csdn】
All learning summary :GitHub - GreyZhang/g_SICP: learn SICP and hack lisp.

First of all, notice , The previous repeated process of solving the square root is actually a recursive process . The design of a program depends on its own function , In the process of execution, we need to constantly make self Owen calls . Actually , This way makes me feel a little bit like feedback adjustment . Another point is that the process of solving this square root is actually a combination of a series of functions , This is also the same description as the overall to local design I thought of earlier .

Here is a clarification that is of great reference significance , Several functions are used to calculate the square root in front of the design . The design of software is actually to divide a function into several . however , The key point of this decomposition strategy is not to split a function into different functions , After all, if you force a split , A function can be split into ten lines , A large program can be divided into several functions . Such significance is not great . The premise of splitting should be that the disassembled function can become an independent module that can be reused constantly . Another point is that , The design application of this black box is likely to be used in the overall description stage considered in the previous learning process . At this stage , We can assume the existence of some functions without thinking too much about the way they are implemented . The design of function modules can hide details , This also brings another point of thinking : If you use C Language for similar design , In fact, try to avoid using global variables to interact between different functions . Or say , Try not to use the same variable for different functions , Otherwise, the coupling of functions will be enhanced . It is not easy to consider some function calls as black boxes in the understanding of software .

Although the title of this part is called local name , But it has nothing to do with local variables . Here we mainly talk about the relationship between formal parameters and arguments , Rather than the expression of local quantities . And formal parameters , Only when there is corresponding information bound with it can a scope play its corresponding role .

The initial program implementation was a set of functions , There may be conflict problems with commonly used functions . such as , A good enough method may be used in many ways , But the content of judgment is different . such , There may be conflicts when designing different software functions . And the above gives a non conflicting way , That is to make these contents into sub functions of functions . such , Its scope is also limited to the interior of a function .

further , Because each function uses the same parameters . Therefore, the design here can directly omit a parameter , Use the same parameters directly . This design is indeed a lot simpler , But I want to come here C It may still be difficult to implement in the design of language . however , Either of the latter two implementations , In fact, it further hides the details of the design , Make the whole function design more black box .
边栏推荐
- OOM(内存溢出)造成原因及解决方案
- 机器人技术创新与实践旧版本大纲
- URP - shaders and materials - light shader lit
- Stockage et pratique des données en langage C (haut niveau)
- The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
- How to * * labelimg
- 聊聊异步编程的 7 种实现方式
- Convolutional neural network -- understanding of pooling
- Communication of components
- 身边35岁程序员如何建立起技术护城河?
猜你喜欢

1、 Go knowledge check and remedy + practical course notes youth training camp notes

Release notes of JMeter version 5.5

记一个并发规则验证实现

虚拟机的作用

URP - shaders and materials - light shader lit

Pass parent component to child component: props
![[semantic segmentation] - multi-scale attention](/img/2d/652681c08e484fe232b8fb91b7194e.jpg)
[semantic segmentation] - multi-scale attention

IP address

BGP experiment (1)

Cloud backup project
随机推荐
【Liunx】进程控制和父子进程
抽丝剥茧C语言(高阶)指针进阶练习
Interviewer: what development models do you know?
Mobx knowledge point collection case (quick start)
How can a 35 year old programmer build a technological moat?
关于二进制无法精确表示小数
"Xiaodeng in operation and maintenance" meets the compliance requirements of gdpr
JS small exercise
MySQL service is missing from computer service
Apache AB stress test
1、 Go knowledge check and remedy + practical course notes youth training camp notes
Jesd204b clock network
Freeswitch dials extension number source code tracking
JS decorator @decorator learning notes
Flexible layout (II)
外包干了四年,废了...
Abnova immunohistochemical service solution
$parent (get parent component) and $root (get root component)
Bindingexception exception (error reporting) processing
Fullgc problem analysis and solution summary