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

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.

主站蜘蛛池模板: 南开区| 长葛市| 抚远县| 恩施市| 筠连县| 灵台县| 长海县| 顺昌县| 镇宁| 岑巩县| 剑河县| 东阳市| 临汾市| 侯马市| 信丰县| 昭平县| 额济纳旗| 浙江省| 陆川县| 大余县| 同江市| 石台县| 肥东县| 呼图壁县| 阿城市| 德惠市| 平湖市| 南投市| 泰州市| 江城| 贵阳市| 翼城县| 潮安县| 台东市| 张家界市| 衡东县| 讷河市| 敦煌市| 精河县| 东海县| 崇左市|