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

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;
}
}
}
主站蜘蛛池模板: 平湖市| 金川县| 南汇区| 丹棱县| 沙雅县| 榕江县| 武功县| 南华县| 焉耆| 靖安县| 西峡县| 保康县| 咸宁市| 青州市| 合肥市| 古田县| 平谷区| 麻栗坡县| 和顺县| 广安市| 黎川县| 盐山县| 张家港市| 城固县| 连江县| 西华县| 华宁县| 昌图县| 聊城市| 凤山市| 桐城市| 绵竹市| 三河市| 潞城市| 彭泽县| 化州市| 西安市| 靖宇县| 枝江市| 木兰县| 阿克苏市|