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

Summary

In this chapter, we have built an application that responded to what the user was typing into a text area, and updated a label with converted text. The conversion of this text was handled by classes, each of which had a single responsibility. The reason we concentrated on producing classes that only did one thing was to learn, right from the start, how to use industry best practices to make our code cleaner and less prone to errors, since a well-designed class that only does one thing is less likely to have problems than classes that do lots of different things.

We introduced the visitor and chain-of-responsibility patterns in order to see how we could separate the text processing into deciding whether a line contained markdown and adding the appropriate HTML-encoded text. We started introducing patterns because patterns occur in so many different software development problems. Not only do they provide clear details about how to solve a problem; they also provide a clear language so that if someone says that a piece of code needs a particular pattern, there is no ambiguity for other developers about what that code needs to do.

In the next chapter, we are going to look at our first application using React.js, for when we build a personal contacts manager.

主站蜘蛛池模板: 瑞金市| 孟津县| 伊川县| 海晏县| 新昌县| 铅山县| 海丰县| 门头沟区| 灵石县| 镇赉县| 梅河口市| 永兴县| 从江县| 武威市| 垫江县| 保山市| 崇阳县| 吉安市| 达尔| 连山| 海丰县| 肥西县| 乌兰县| 六枝特区| 马尔康县| 五原县| 莱阳市| 通渭县| 扎鲁特旗| 冀州市| 灵山县| 峨边| 丘北县| 游戏| 亳州市| 平邑县| 云安县| 乌兰察布市| 江都市| 莱西市| 容城县|