官术网_书友最值得收藏!

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;
}
}
}
主站蜘蛛池模板: 长兴县| 扶绥县| 寻乌县| 金昌市| 景洪市| 西昌市| 嘉鱼县| 房产| 察雅县| 包头市| 弋阳县| 辽阳市| 华宁县| 南皮县| 兴国县| 五华县| 溧阳市| 辽阳县| 阜宁县| 拜泉县| 宿州市| 炎陵县| 彭山县| 八宿县| 攀枝花市| 阿荣旗| 金秀| 肃南| 乐至县| 铁力市| 安远县| 鄂托克前旗| 富宁县| 高唐县| 乌拉特后旗| 连山| 巫山县| 黄冈市| 泰兴市| 博客| 英吉沙县|