Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Pythonソースコードの構造可視化とそれがもたらすもの

yosu
August 28, 2020

 Pythonソースコードの構造可視化とそれがもたらすもの

yosu

August 28, 2020
Tweet

Other Decks in Programming

Transcript

  1. PI = 3.1415926535 class Circle: def __init__(self, radius): self.radius =

    radius def area(self): return PI * self.radius ** 2
  2. import sys from figure import Circle def main(): radius =

    float(sys.argv[1]) circle = Circle(radius) print(circle.area())
  3. ステップ1: 解析・情報収集 "common.bind" -> "common.group.application"; "common.context.builder" -> "common.context.domain"; "event.application.event_history" ->

    "framework.paginator"; "event.application.repository" -> "event.domain"; "feedback.application.announcement" -> "common.exceptions"; "feedback.application.idea" -> "framework.logging"; "feedback.domain.idea" -> "event.domain"; "feedback.domain.idea" -> "notify.domain.email_builder"; "framework.paginator" -> "framework.logging"; "integration.bind" -> "event.domain.event_handler_setting"; "main" -> "framework"; "main" -> "task.routes"; "notify.application" -> "common.user.application"; "task.domain.notification" -> "common.system_setting.application"; "test_helpers.feedback" -> "common.user.domain";
  4. ステップ2: トップレベルに集約 "common.bind" -> "common.group.application"; "common.context.builder" -> "common.context.domain"; "event.application.event_history" ->

    "framework.paginator"; "event.application.repository" -> "event.domain"; "feedback.application.announcement" -> "common.exceptions"; "feedback.application.idea" -> "framework.logging"; "feedback.domain.idea" -> "event.domain"; "feedback.domain.idea" -> "notify.domain.email_builder"; "framework.paginator" -> "framework.logging"; "integration.bind" -> "event.domain.event_handler_setting"; "main" -> "framework"; "main" -> "task.routes"; "notify.application" -> "common.user.application"; "task.domain.notification" -> "common.system_setting.application"; "test_helpers.feedback" -> "common.user.domain";
  5. ステップ2: トップレベルに集約 "common" -> "common"; "common" -> "common"; "event" ->

    "framework"; "event" -> "event"; "feedback" -> "common"; "feedback" -> "framework"; "feedback" -> "event"; "feedback" -> "notify"; "framework" -> "framework"; "integration" -> "event"; "main" -> "framework"; "main" -> "task"; "notify" -> "common"; "task" -> "common"; "test_helpers" -> "common";
  6. ステップ3: 重複の除去 "common" -> "common"; "common" -> "common"; "event" ->

    "framework"; "event" -> "event"; "feedback" -> "common"; "feedback" -> "framework"; "feedback" -> "event"; "feedback" -> "notify"; "framework" -> "framework"; "integration" -> "event"; "main" -> "framework"; "main" -> "task"; "notify" -> "common"; "task" -> "common"; "test_helpers" -> "common";
  7. "common" -> "common"; "event" -> "framework"; "event" -> "event"; "feedback"

    -> "common"; "feedback" -> "framework"; "feedback" -> "event"; "feedback" -> "notify"; "framework" -> "framework"; "integration" -> "event"; "main" -> "framework"; "main" -> "task"; "notify" -> "common"; "task" -> "common"; "test_helpers" -> "common"; ステップ3: 重複の除去
  8. ステップ4: セルフループの削除 "common" -> "common"; "event" -> "framework"; "event" ->

    "event"; "feedback" -> "common"; "feedback" -> "framework"; "feedback" -> "event"; "feedback" -> "notify"; "framework" -> "framework"; "integration" -> "event"; "main" -> "framework"; "main" -> "task"; "notify" -> "common"; "task" -> "common"; "test_helpers" -> "common";
  9. ステップ4: セルフループの削除 "event" -> "framework"; "feedback" -> "common"; "feedback" ->

    "framework"; "feedback" -> "event"; "feedback" -> "notify"; "integration" -> "event"; "main" -> "framework"; "main" -> "task"; "notify" -> "common"; "task" -> "common"; "test_helpers" -> "common";
  10. 変 更 頻 度 依存されている数 多 い 少 な い

    多い 少ない アプリケーション基盤 エントリーポ イント ビジネス ロジック
  11. 変 更 頻 度 依存されている数 多 い 少 な い

    多い 少ない アプリケーション基盤 ビジネス ロジック エントリーポ イント ここを 他と隔離しつつ きちんと保つ ことが重要