当前位置:网站首页>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 .
边栏推荐
- Outsourcing for four years, abandoned
- Bindingexception exception (error reporting) processing
- Software acceptance test
- 外包幹了三年,廢了...
- Stack Title: nesting depth of valid parentheses
- Torefs API and toref API
- Kuboard无法发送邮件和钉钉告警问题解决
- Redis data migration
- How to reduce inventory with high concurrency on the Internet
- 【云原生】内存数据库如何发挥内存优势
猜你喜欢
Dynamics CRM server deployment - restore database prompt: the database is in use
外包干了三年,废了...
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
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
At the age of 20, I got the ByteDance offer on four sides, and I still can't believe it
FPGA course: application scenario of jesd204b (dry goods sharing)
freeswitch拨打分机号源代码跟踪
我理想的软件测试人员发展状态
SQLMAP使用教程(四)实战技巧三之绕过防火墙
Implementing data dictionary with JSP custom tag
随机推荐
Introduction to abnova's in vitro mRNA transcription workflow and capping method
L'étape avancée du pointeur de langage C (haut de gamme) pour l'enroulement des cocons
Blue Bridge Cup Netizen age (violence)
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
Flexible layout (II)
面试官:你都了解哪些开发模型?
Deep learning Flower Book + machine learning watermelon book electronic version I found
sql中对集合进行非空校验
Communication of components
Advanced level of C language (high level) pointer
[explanation of JDBC and internal classes]
Pass child component to parent component
Circulating tumor cells - here comes abnova's solution
freeswitch拨打分机号源代码跟踪
JS small exercise
Precise space-time travel flow regulation system - ultra-high precision positioning system based on UWB
虚拟机的作用
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
抽丝剥茧C语言(高阶)数据的储存+练习