0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

オブジェクト指向の勘違い

0
Posted at

オブジェクト指向の勘違い

オブジェクト指向は極論 「責務を分けよう」 という話です。
隠蔽する、ネストを深くする(継承)、なんでも class で実装しオブジェクト指向だとしている人を結構見かけます。

対策としては書こうとしている処理を次のカテゴリで分類して実装します

  • リソースに依存している処理
  • ドメインに依存している処理(業務に依存している)
  • 純粋な処理

このような分類を常に考えていれば自ずとオブジェクト指向に近づくと思います。
GoFパターンにしたければ基本的な責務分けの後にGoF見ながら考えたほうがまとまりやすく、先に「GoFで実装しよう」と思って書くと失敗しやすいように思います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?