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

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.

主站蜘蛛池模板: 临颍县| 长宁区| 太湖县| 蕉岭县| 梅河口市| 科尔| 老河口市| 平陆县| 遂川县| 泸水县| 遵化市| 垣曲县| 桓台县| 石门县| 平凉市| 油尖旺区| 鄂伦春自治旗| 綦江县| 洛川县| 时尚| 天祝| 瓮安县| 苍梧县| 林芝县| 青海省| 贡嘎县| 运城市| 金沙县| 灌阳县| 新民市| 双流县| 明水县| 锡林郭勒盟| 略阳县| 卫辉市| 故城县| 甘洛县| 乐陵市| 东乌珠穆沁旗| 巴里| 开鲁县|