- C# 7 and .NET Core Cookbook
- Dirk Strauss
- 155字
- 2021-07-03 00:12:04
How it works...
If you have code that looks like the preceding one, you are in contravention of the SRP. The StarShip class is no longer responsible for just itself and things that have to do with star ships. It now has to fulfill the role of logging errors to the database too. You see the problem here is that the database-logging code does not belong in the catch clause of the SetMaximumTroopCapacity method. A better approach would be to create a separate DatabaseLogging class with methods to create connections and write exceptions to the appropriate log table. You will also find that you are going to have to write that logging code in multiple places (in every catch clause). If you are finding that you are repeating code (by copying and pasting from other areas), you probably need to put that code into a common class, and you have likely broken the SRP rule.
- UNIX編程藝術
- 精通Nginx(第2版)
- Mastering OpenCV Android Application Programming
- Visual Basic程序開發(學習筆記)
- Visual C++數字圖像模式識別技術詳解
- Learning C++ Functional Programming
- Animate CC二維動畫設計與制作(微課版)
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- 人人都是網站分析師:從分析師的視角理解網站和解讀數據
- 概率成形編碼調制技術理論及應用
- AppInventor實踐教程:Android智能應用開發前傳
- Unity 2D Game Development Cookbook
- C#開發案例精粹
- 計算機應用基礎教程(Windows 7+Office 2010)
- Access 2010數據庫應用技術實驗指導與習題選解(第2版)