当前位置:网站首页>Hooks' design philosophy
Hooks' design philosophy
2022-06-11 01:21:00 【zhen12321】
hooks The word "hook" means "hook" . There is such a word in many frameworks . It is essentially a Callback function .
Why do you call him a hook ? Is it just for the convenience of understanding ?
It's not like that .
The main purpose of the word hook is to indicate a set of operations at a specific time in the software life cycle .
Software engineering is a very large and complex subject , It is the methodology of software development .
The general execution process of a software is divided into some specific time , for example : Before the object is created , After creation , Before some instances of the object are called , After being invoked .
hooks It is a concentrated embodiment of the programming mode of functional programming , It describes the principle that software is invoked according to time .
however , I think functional programming is a variation of class programming , Their essence is to enhance the operation of components . However, the feature of functional programming makes it necessary to add some functions only in certain areas chain To insert in the middle of , But in the class, we can enhance the method without any scruple .
Just like functional programming is more flexible than object-oriented , So there are fewer things to consider .
So we can expose some callback functions at a specific time , Make some enhancements in these callback functions .
Compare face objects AOP For the design idea of , This obviously adds some enhancements to the original code . Is actually inserted into the code some new Code for .
In a classic software framework , The advantages of this design idea can be magnified infinitely .
for example , In one use C++ Written in a classic framework that won't change much , Everything is very stable .
If the hooks This way to interfere , To enhance a corresponding software design , So back to this excellent and stable framework , You can really enhance the design idea of such a software .
The key is not to pollute the software . Although in series , But I can be pluggable . This is the most magical place .
This line of thinking , It's also webpack,react17 An important train of thought and thought in .
Let's return programming to functions , Remove the heavy runtime of face objects .
边栏推荐
- 【VBA脚本】提取word文档中所有批注的信息和待解决状态
- Inventory management and strategy mode
- 網絡基礎(1)-----認識網絡
- dma_buf_export
- Support standard for cultivation of high-tech enterprises in Changping District, Beijing, with a subsidy of 100000 yuan
- Beijing Yanqing District high tech enterprise cultivation support standard, with a subsidy of 100000 yuan
- SSH Remote Login configuration sshd_ Config file details
- What are the advantages of increased life insurance products? Is the threshold high?
- Recruitment | Nanjing | triostudio Sanli Agency - Interior Designer / construction drawing deepening Designer / device / Product Designer / Intern, etc
- How to write this with data and proc without SQL
猜你喜欢

中间件_Redis_06_Redis的事务

最好的創意鼓工具:Groove Agent 5
[ROS tutorial] - 02 ROS installation

对多线程的理解

Network foundation (1) -- understanding the network

Cosine similarity calculation summary
WSL automatically updates the IP hosts file

Viewpager and dot of bottom wireless loop

The best creative drum tool: groove agent 5

云呐|PDA无线固定资产盘点管理系统
随机推荐
Beijing Mentougou District high tech enterprise cultivation support standard, with a subsidy of 100000 yuan
Network foundation (1) -- understanding the network
Bad RequestThis combination of host and port requires TLS.
2022年高考加油 那年我的高考如此兴奋
Millions of visits - resolution of high concurrency problems
Embedded learning materials and project summary
项目_基于网络爬虫的疫情数据可视化分析
hooks的设计哲学
北京密云区高新技术企业培育支持标准,补贴10万
立个flag--重构promise
Le meilleur outil de tambour créatif: Groove agent 5
2022北京怀柔区新技术新产品(服务)认定要求
部分 力扣 LeetCode 中的SQL刷题整理
北京延庆区高新技术企业培育支持标准,补贴10万
網絡基礎(1)-----認識網絡
限流与下载接口请求数控制
IRS应用发布之十五:应用安全自测指南
table_ exists_ Action=append and table_ exists_ action=truncate
Docking of express bird system
配置化自定义实现1.实现接口,2.自定义配置3.默认配置