当前位置:网站首页>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 .
边栏推荐
- js小练习
- L'étape avancée du pointeur de langage C (haut de gamme) pour l'enroulement des cocons
- Advanced practice of C language (high level) pointer
- Le Service MySQL manque dans le service informatique
- Communication of components
- URP - shaders and materials - simple lit
- 机器人技术创新与实践旧版本大纲
- gatk4中的interval是什么??
- C language (high-level) data storage + Practice
- JS decorator @decorator learning notes
猜你喜欢

抽絲剝繭C語言(高階)數據的儲存+練習

A concurrent rule verification implementation

At the age of 20, I got the ByteDance offer on four sides, and I still can't believe it

English translation is too difficult? I wrote two translation scripts with crawler in a rage

Robot technology innovation and practice old version outline

Apache AB stress test

Wechat applet full stack development practice Chapter 3 Introduction and use of APIs commonly used in wechat applet development -- 3.9 introduction to network interface (IX) extending the request3 met

Mutual conversion between InputStream, int, shot, long and byte arrays

Simple example of ros2 planning system plansys2

Release notes of JMeter version 5.5
随机推荐
Flexible layout (I)
Release notes of JMeter version 5.5
Causes and solutions of oom (memory overflow)
Dynamics CRM server deployment - restore database prompt: the database is in use
Détailler le bleu dans les tâches de traduction automatique
FullGC问题分析及解决办法总结
A concurrent rule verification implementation
机器人技术创新与实践旧版本大纲
L'étape avancée du pointeur de langage C (haut de gamme) pour l'enroulement des cocons
js小练习
BGP experiment (1)
C language (high-level) data storage + Practice
How can a 35 year old programmer build a technological moat?
Kuboard can't send email and nail alarm problem is solved
[Linux] process control and parent-child processes
面试官:你都了解哪些开发模型?
Le Service MySQL manque dans le service informatique
【云原生】内存数据库如何发挥内存优势
一、Go知识查缺补漏+实战课程笔记 | 青训营笔记
Software acceptance test