- C# and .NET Core Test Driven Development
- Ayobami Adewole
- 142字
- 2021-06-25 22:00:27
Sound architecture and design
Bad code can be avoided through the use of a good development architecture and design strategy. This will ensure that development teams and organizations have a high-level architecture, strategy, practices, guidelines, and governance plans that team members must follow to prevent cutting corners and avoiding bad code throughout the development process.
Through continuous learning and improvement, software development team members can develop thick skins towards writing bad code. The sample code snippet in the Bad or broken designs section can be refactored to be thread-safe and avoid thread-related issues, as shown in the following code:
public class SMTPGateway
{
private static SMTPGateway smtpGateway=null;
private static object lockObject= new object();
private SMTPGateway()
{
}
public static SMTPGateway SMTPGatewayObject
{
get
{
lock (lockObject)
{
if (smtpGateway==null)
{
smtpGateway = new SMTPGateway();
}
}
return smtpGateway;
}
}
}
推薦閱讀
- Mastering OpenLayers 3
- 大學計算機基礎(第三版)
- C語言程序設計(第3版)
- Boost C++ Application Development Cookbook(Second Edition)
- Python數據分析(第2版)
- Visual Basic學習手冊
- Learning Python by Building Games
- C#程序設計教程(第3版)
- App Inventor少兒趣味編程動手做
- Tableau Desktop可視化高級應用
- Greenplum構建實時數據倉庫實踐
- 零基礎學Java第2版
- Visual Basic程序設計基礎
- Java 11 and 12:New Features
- Mapping with ArcGIS Pro