jueqingsizhe66 / jueqingsizhe66.github.io

my hugo blogs
0 stars 0 forks source link

post/%E6%95%B0%E6%8D%AE%E8%AE%BE%E8%AE%A1%E7%A8%8B%E5%BA%8F/ #13

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

数据设计程序-装饰者模式 | 30年磨一剑

问题: 我们生活在海量的数据库中,如何高效梳理和归纳我们接触到

http://localhost:1313/post/%E6%95%B0%E6%8D%AE%E8%AE%BE%E8%AE%A1%E7%A8%8B%E5%BA%8F/

jueqingsizhe66 commented 2 years ago

以上代码均测试通过

jueqingsizhe66 commented 2 years ago

装饰器:本质是函数,每个函数都有目的,装饰器的目的就是为了装饰其他函数,附加其他功能。 装饰器原则:不能修改装饰的函数, 不能被修改函数的调用方式 装饰器对被装饰的函数完全透明,用了这个函数的人,并没有发现这个函数被装饰了

jueqingsizhe66 commented 2 years ago

理解:

  1. 高阶函数(函数当做参数来使用) 2.函数嵌套

装饰器等于高阶函数+嵌套函数

进一步理解闭包的概念、局部作用域的概念

jueqingsizhe66 commented 2 years ago

https://irreal.org/blog/?p=10612

A really powerful Emacs feature for those who know a bit of Elisp in the ability to advise functions. Historically, the defadvice macro allowed the specification of code to run before, after, or around a function call. It’s really handy for modifying the action of a function without changing the function itself or getting into the details of how a function works. I have advice for 7 functions in my init.el, an indication that it’s more useful than you might think.

jueqingsizhe66 commented 2 years ago

https://www.jianshu.com/p/602f9f42891f

jueqingsizhe66 commented 2 years ago

jfinal AOP https://jfinal.com/doc/4-3 // 配置一个Class级别的拦截器,她将拦截本类中的所有方法 @Before(AaaInter.class) public class BlogController extends Controller {

// 配置多个Method级别的拦截器,仅拦截本方法 @Before({BbbInter.class, CccInter.class}) public void index() { }

// 未配置Method级别拦截器,但会被Class级别拦截器AaaInter所拦截 public void show() { } }