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

  • Clean Code in C#
  • Jason Alls
  • 215字
  • 2021-06-18 18:28:11

Summary

In this chapter, we learned about organizing our namespaces in folders and packages, and how good organization can help to prevent namespace classes. We then moved on to classes and responsibility and looked at why classes should only have one responsibility. We also looked at cohesion and coupling and why it is important to have high cohesion and low coupling.

Good documentation requires public members to be correctly commented on in documentation tools, and we saw how to do this using XML comments. The importance of why you should design for change was also discussed with basic examples of DI and IoC.

The Law of Demeter showed you how to not to talk to strangers, but only immediate friends, and how to avoid chaining. And finally, we looked at objects and data structures and what they should hide and what they should make public.

In the next chapter, we will briefly cover functional programming in C# and how to write clean methods that are small. We will also learn to avoid having more than two parameters in our methods, as methods with many parameters can become unwieldy. Plus we will learn to avoid duplication which can be a troublesome source of bugs when fixed in one location, but still exist elsewhere in your code.

主站蜘蛛池模板: 通许县| 清苑县| 嵊泗县| 沅陵县| 开鲁县| 海原县| 太湖县| 乌苏市| 郎溪县| 区。| 泰兴市| 北海市| 大兴区| 和龙市| 宜州市| 石屏县| 常州市| 乌鲁木齐县| 梧州市| 绥江县| 库尔勒市| 阿尔山市| 浮梁县| 南昌市| 抚松县| 乡宁县| 增城市| 南澳县| 徐州市| 土默特左旗| 元氏县| 曲靖市| 会泽县| 桦南县| 武功县| 祥云县| 莱西市| 疏附县| 夏河县| 疏勒县| 尼玛县|