- 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 OpenCV Android Application Programming
- 圖解Java數據結構與算法(微課視頻版)
- Java應用開發與實踐
- Instant Typeahead.js
- jQuery從入門到精通 (軟件開發視頻大講堂)
- Hands-On C++ Game Animation Programming
- 高級C/C++編譯技術(典藏版)
- Functional Kotlin
- JavaScript:Moving to ES2015
- 大模型RAG實戰:RAG原理、應用與系統構建
- PySide 6/PyQt 6快速開發與實戰
- JavaScript動態網頁編程
- GitHub入門與實踐
- 工業機器人離線編程
- C#面向對象程序設計(第2版)