OOC keynote: Object Oriented Diversity

E37b4344ef4bfd0fc4826c04971e54fb?s=47 nrs
February 16, 2020

OOC keynote: Object Oriented Diversity

Object Oriented Conference の基調講演です。

# URL
HomePage: https://nrslib.com
Twitter: https://twitter.com/nrslib

E37b4344ef4bfd0fc4826c04971e54fb?s=128

nrs

February 16, 2020
Tweet

Transcript

  1. Object Oriented Diversity Masanobu Naruse

  2. あなたのオブジェクト指向は何ですか 2

  3. 3

  4. 4

  5. 5

  6. 6

  7. 7

  8. 8 オブジェクト指向

  9. 9 なんか違う

  10. 10 それ オブジェクト指向 じゃないよ

  11. 11 それ オブジェクト指向 じゃないよ いや オブジェクト指向 だよ

  12. 12

  13. 13 それ オブジェクト指向 じゃないよ いや オブジェクト指向 だよ

  14. 14 それ オブジェクト指向 じゃないよ いや オブジェクト指向 だよ C++ Smalltalk

  15. 15 それ オブジェクト指向 じゃないよ いや オブジェクト指向 だよ 抽象データ型 メッセージ パッシング

  16. Object Oriented Diversity Masanobu Naruse

  17. Object Oriented Diversity Masanobu Naruse

  18. 18 Diversity

  19. 19 多様性

  20. 多様性を上手く扱うには? 20

  21. 多様性を上手く扱うには? 21

  22. 多様性 22

  23. Polymorphism 23

  24. オブジェクト指向プログラミングを見てみよう! 24

  25. 25 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  26. 26 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  27. 27 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  28. 28 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  29. 29 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  30. 30 public interface IProposalRepository { Proposal Find(ProposalId id); void Save(Proposal

    proposal); void Delete(Proposal proposal); }
  31. 31 public interface IProposalRepository { Proposal Find(ProposalId id); void Save(Proposal

    proposal); void Delete(Proposal proposal); }
  32. 32 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  33. 33 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  34. 34 public class ProposalSubmitService { private readonly IProposalRepository proposalRepository; public

    ProposalSubmitService(IProposalRepository proposalRepository) { this.proposalRepository = proposalRepository; } public void Handle(ProposalSubmitCommand command) { ... var proposal = new Proposal(command.Title, command.Outline); proposalRepository.Save(proposal); ... } }
  35. 35 public void Main(string input) { var repository = CreateRepository(input);

    var proposalSubmitService = new ProposalSubmitService(repository); var command = new ProposalSubmitCommand(); proposalSubmitService.Handle(command); } private IProposalRepository CreateRepository(string input) { switch (input) { case "local" : return new InMemoryProposalRepository(); case "production" : return new SqlProposalRepository(); default: throw new ArgumentOutOfRangeException(); } }
  36. 36 public void Main(string input) { var repository = CreateRepository(input);

    var proposalSubmitService = new ProposalSubmitService(repository); var command = new ProposalSubmitCommand(); proposalSubmitService.Handle(command); } private IProposalRepository CreateRepository(string input) { switch (input) { case "local" : return new InMemoryProposalRepository(); case "production" : return new SqlProposalRepository(); default: throw new ArgumentOutOfRangeException(); } }
  37. 37 public void Main(string input) { var repository = CreateRepository(input);

    var proposalSubmitService = new ProposalSubmitService(repository); var command = new ProposalSubmitCommand(); proposalSubmitService.Handle(command); } private IProposalRepository CreateRepository(string input) { switch (input) { case "local" : return new InMemoryProposalRepository(); case "production" : return new SqlProposalRepository(); default: throw new ArgumentOutOfRangeException(); } }
  38. 38 public void Main(string input) { var repository = CreateRepository(input);

    var proposalSubmitService = new ProposalSubmitService(repository); var command = new ProposalSubmitCommand(); proposalSubmitService.Handle(command); } private IProposalRepository CreateRepository(string input) { switch (input) { case "local" : return new InMemoryProposalRepository(); case "production" : return new SqlProposalRepository(); default: throw new ArgumentOutOfRangeException(); } }
  39. 39 public void Main(string input) { var repository = CreateRepository(input);

    var proposalSubmitService = new ProposalSubmitService(repository); var command = new ProposalSubmitCommand(); proposalSubmitService.Handle(command); } private IProposalRepository CreateRepository(string input) { switch (input) { case "local" : return new InMemoryProposalRepository(); case "production" : return new SqlProposalRepository(); default: throw new ArgumentOutOfRangeException(); } }
  40. 40 オブジェクト指向

  41. 41 public interface オブジェクト指向 { }

  42. 42 それ オブジェクト指向 じゃないよ いや オブジェクト指向 だよ C++ Smalltalk

  43. 43

  44. コードを小説として捉えたとき 44

  45. Polymorphism の役割は? 45

  46. 46 文脈

  47. 47 コンテキスト

  48. IT技術分野には多くのコンテキストがある 48

  49. モデル 49

  50. エンティティ 50

  51. ドメイン 51

  52. コンテキストが存在することを意識しよう 52

  53. プログラミングでも便利 53

  54. UserContext 54

  55. HttpContext 55

  56. コンテキストを恐れないで 56

  57. 57 重要なのはどのコンテキストなのかを意識すること

  58. 58 多様性を受け入れよう

  59. 多様性を恐れないための心構え 59

  60. 60

  61. 61

  62. 62

  63. あなたの考えを あなたのコンテキストで 63

  64. 64

  65. 65

  66. Object Oriented Diversity Masanobu Naruse

  67. Auther Masanobu Naruse HomePage https://nrslib.com Twitter @nrslib