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

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.

主站蜘蛛池模板: 隆回县| 灵武市| 仁化县| 武宣县| 贞丰县| 革吉县| 湾仔区| 寿光市| 永州市| 天长市| 双峰县| 都昌县| 拜泉县| 社会| 永善县| 株洲县| 朝阳区| 黔江区| 德庆县| 工布江达县| 治县。| 南昌县| 白河县| 万州区| 建瓯市| 吴旗县| 武汉市| 恭城| 临洮县| 文昌市| 峨山| 惠安县| 称多县| 河西区| 丽水市| 原阳县| 大荔县| 屯留县| 焦作市| 星子县| 镇平县|