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

Putting it all together into high-quality code

Now that we have the fundamentals about analyzing data with descriptive statistics, we're going to improve our code's structure and flexibility by breaking it up into functions. Even though this is common knowledge among efficient programmers, it's not a common practice among data analysts. Many data analysts would simply paste the code we have developed all together, as-is, into a single file, and run it every time they wanted to perform the analysis. We won't be adding new features to the analysis. All we'll do is reorder code into functions to encapsulate their inner-workings and communicate intention with function names (this substantially reduces the need for comments).

We'll focus on producing high-quality code that is easy to read, reuse, modify, and fix (in case of bugs). The way we actually do it is a matter of style, and different ways of arranging code are fit for different contexts. The method we'll work with here is one that has served me well for a variety of situations, but it may not be the best for yours. If it doesn't suit your needs, feel free to change it. Whichever style you prefer, making an investment in creating a habit of constantly producing high-quality code will make you a more efficient programmer in the long run, and a point will come where you will not want to program inefficiently any more.

主站蜘蛛池模板: 新民市| 汉川市| 夹江县| 灵寿县| 盐边县| 潮州市| 鄂尔多斯市| 东阳市| 新闻| 宕昌县| 于都县| 根河市| 南康市| 丹凤县| 镇赉县| 弋阳县| 托克逊县| 临江市| 太白县| 驻马店市| 抚顺县| 闽侯县| 丽水市| 齐河县| 曲松县| 扶绥县| 茂名市| 和静县| 抚顺县| 东丰县| 宁德市| 芦溪县| 正安县| 腾冲县| 喀什市| 和田县| 迭部县| 改则县| 防城港市| 华蓥市| 祁阳县|