Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 2.1 KB

2021-12-04.md

File metadata and controls

37 lines (28 loc) · 2.1 KB

2021年12月4日のリファクタリングについて

Issue #167 で行われた整理を元に、リファクタリングを行った。

役割ベースの分類

cerke_online のフロントエンドがやることというのは、以下の三種類しかない。

  • matching: マッチングを行う
  • decision: 自分側のユーザーの決断をサーバーに送り、それゆえ発生した事象を描画する
  • poll: 相手側のユーザーの決断がされたかをサーバーに問い、決断が発生していたなら、それゆえ発生した事象を描画する

ということで、matching, decision, poll の三つに再編成することで、見通しを大幅に改善した。

POST 先の改名および分割

POST 先を改名。あと /slow を二つに分割した。

before after
/mainpoll /poll/main
/infpoll /poll/inf
/whethertymok/tymok /decision/tymok
/whethertymok/taxot /decision/taxot
/whethertymokpoll /poll/whethertymok
/slow /decision/main
/slow /decision/afterhalfacceptance
/random/entry /matching/random/entry
/random/poll /matching/random
/random/cancel /matching/random/cancel
/random/entry/staging /matching/random/entry/staging
/random/poll/staging /matching/random/poll/staging
/random/cancel/staging /matching/random/cancel/staging
/vs_cpu/entry /matching/vs_cpu/entry
/vs_cpu/entry/staging /matching/vs_cpu/entry/staging

poll 側では main という語を NormalMove | InfAfterStep の意味に使っていたが、一方で decision 側では NormalMove | InfAfterStep | AfterHalfAcceptance を表すのに main だったり空文字列だったりを用いており、統一感がなかった。ということで、 /slow を 2 種に分割し、main という語の語義を NormalMove | InfAfterStep に統一した。なおこの main という名前は非常に分かりにくいので、良い名称が提案され次第それに改名される予定である。