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

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;
}
}
}
主站蜘蛛池模板: 莱州市| 永仁县| 屯门区| 马山县| 棋牌| 朔州市| 嘉定区| 盐山县| 东丰县| 磴口县| 句容市| 眉山市| 柳江县| 安义县| 胶州市| 安吉县| 新安县| 郎溪县| 揭阳市| 平度市| 乐平市| 垣曲县| 平昌县| 通榆县| 宁强县| 沙洋县| 九江市| 保德县| 聂荣县| 鲁山县| 清河县| 乐安县| 六枝特区| 天门市| 雅安市| 隆化县| 临朐县| 扶沟县| 息烽县| 临夏市| 正定县|