SessionLifecycleListener 取名不规范,你们怎么看 #4397
Unanswered
jianchengfeng
asked this question in
Q&A
Replies: 1 comment
-
规划整改中,确实有歧义 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
SessionLifecycleListener 对象主要在 GlobalSession 使用,通过 addSessionLifecycleListener() 调用 Set 的 add() 添加元素对象,构建 Set,然后在 begin()、changeStatus、addBranch()、end() 等方法遍历。这里 SessionLifecycleListener
的作用就是维持一个全局 Session 整个过程,不应该取名带 Listener ,应该取名 SessionLifecycleEvent/Ops 等, 因为没有因 addSessionLifecycleListener() 立马触发动作,类似监听者模式或观察者模式 来触发其他的动作,取名容易让人产生误解,同时也不符合 OOP 思想。个人见解,不知广大开发者如何看?
Beta Was this translation helpful? Give feedback.
All reactions