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

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;
}
}
}
主站蜘蛛池模板: 任丘市| 陆良县| 昆明市| 泰来县| 通州市| 彭泽县| 赤壁市| 梁山县| 海南省| 镇原县| 盱眙县| 涟水县| 会理县| 淮阳县| 馆陶县| 天柱县| 依安县| 珲春市| 新巴尔虎左旗| 新绛县| 潜山县| 广水市| 新宁县| 万州区| 恭城| 兰西县| 来宾市| 贵州省| 甘泉县| 金堂县| 株洲市| 利辛县| 信丰县| 黄梅县| 丰都县| 花莲县| 武清区| 富川| 广州市| 德安县| 祥云县|