- 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;
}
}
}
推薦閱讀
- Java程序設計與開發
- Android Development with Kotlin
- Java從入門到精通(第5版)
- R語言編程指南
- Python編程實戰
- 劍指Java:核心原理與應用實踐
- 學習OpenCV 4:基于Python的算法實戰
- Modern C++ Programming Cookbook
- Python語言科研繪圖與學術圖表繪制從入門到精通
- Kotlin極簡教程
- JavaScript程序設計:基礎·PHP·XML
- Oracle Data Guard 11gR2 Administration Beginner's Guide
- QlikView Unlocked
- Java EE項目應用開發
- ASP.NET Core and Angular 2