More Related Content
Similar to インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~ (20)
More from JustSystems Corporation (20)
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~
- 2. 自己紹介
• 株式会社ジャストシステム 福嶋 航
• Twitter @fukushiw
• Java歴約20年、JavaでWebサービス作っています
• #Java100 本ノックの人
https://github.com/JustSystems/java-100practices
- 6. 1.instanceof
2.parseInt / parseLong / toString
3.substring
4.unchecked parameters on public methods
5.non-private fields
6.code convention ignored
7.resources without try-with-resources
8.Date / Calendar / SimpleDateFormat
9.methods over 30 lines / classes over 1000 lines
10.throws RuntimeException / throws Exception
コードレビュー指摘頻出ポイント10
- 7. 1.instanceof
2.parseInt / parseLong / toString
3.substring
4.unchecked parameters on public methods
5.non-private fields
6.code convention ignored
7.resources without try-with-resources
8.Date / Calendar / SimpleDateFormat
9.methods over 30 lines / classes over 1000 lines
10.throws RuntimeException / throws Exception
コードレビュー指摘頻出ポイント10
インパス!あのこれダメッス!
- 11. 4. unchecked parameters
on public methods
【匂い】
メソッドを呼ぶ順序など前提に暗黙のルールがある可
能性がある。
【確認ポイント】
APIドキュメントに詳細な説明があるか?
NullPointerExceptionや
IndexOutOfBoundsExceptionが起きないか?
- 13. 6. code convention ignored
【匂い】
クセのあるコードが生産されメンテナンスできなくなる
可能性がある。
【確認ポイント】
守られない理由は何か? (ツール、環境、…)
不条理なルールはないか?
- 15. 8. Date / Calendar /
SimpleDateFormat
【匂い】
マルチスレッド動作時や防御的プログラムでない場
合にバグが出現する可能性がある。
【確認ポイント】
Mutable考慮済/シングルスレッド前提か?
Java 8 以降にアップデートできないか?
- 16. 9. methods over 30 lines /
classes over 1000 lines
【匂い】
密連携されたメンテナンスが困難なコードの可能性
がある。
【確認ポイント】
メソッドやクラスの役割が大きすぎないか?
業務とコードが対応できているか?
- 18. 1.instanceof
2.parseInt / parseLong / toString
3.substring
4.unchecked parameters on public methods
5.non-private fields
6.code convention ignored
7.resources without try-with-resources
8.Date / Calendar / SimpleDateFormat
9.methods over 30 lines / classes over 1000 lines
10.throws RuntimeException / throws Exception
コードレビュー指摘頻出ポイント10
インパス!あのこれダメッス!