当前位置:网站首页>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 .
边栏推荐
- Jesd204b clock network
- RuntimeError: CUDA error: CUBLAS_ STATUS_ ALLOC_ Failed when calling `cublascreate (handle) `problem solving
- Databinding exception of kotlin
- 4、 High performance go language release optimization and landing practice youth training camp notes
- 外包干了三年,废了...
- Paranoid unqualified company
- sql中对集合进行非空校验
- PostgreSQL source code (60) transaction system summary
- Modify the jupyter notebook file path
- 一、Go知识查缺补漏+实战课程笔记 | 青训营笔记
猜你喜欢
Role of virtual machine
毕设-基于SSM大学生兼职平台系统
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
4、 High performance go language release optimization and landing practice youth training camp notes
抽丝剥茧C语言(高阶)数据的储存+练习
Asynchronous components and suspend (in real development)
计算机服务中缺失MySQL服务
I failed in the postgraduate entrance examination and couldn't get into the big factory. I feel like it's over
How can a 35 year old programmer build a technological moat?
Pass child component to parent component
随机推荐
一、Go知识查缺补漏+实战课程笔记 | 青训营笔记
[explanation of JDBC and internal classes]
Simple example of ros2 planning system plansys2
$parent (get parent component) and $root (get root component)
记一个并发规则验证实现
3、 High quality programming and performance tuning practical youth training camp notes
Advanced practice of C language (high level) pointer
$refs: get the element object or sub component instance in the component:
软件验收测试
Blue Bridge Cup Netizen age (violence)
[cloud native] how to give full play to memory advantage of memory database
JS small exercise
SQLMAP使用教程(四)实战技巧三之绕过防火墙
URP - shaders and materials - simple lit
Common function detect_ image/predict
按键精灵采集学习-矿药采集及跑图
About some details of final, I have something to say - learn about final CSDN creation clock out from the memory model
【云原生】内存数据库如何发挥内存优势
Several important steps to light up the display
Abnova immunohistochemical service solution