{"id":39,"date":"2016-02-20T06:35:36","date_gmt":"2016-02-20T06:35:36","guid":{"rendered":"http:\/\/lennycheng.com\/blog\/?p=39"},"modified":"2017-01-04T06:38:02","modified_gmt":"2017-01-04T06:38:02","slug":"similarities-between-english-and-programming","status":"publish","type":"post","link":"http:\/\/lennycheng.com\/blog\/2016\/02\/20\/similarities-between-english-and-programming\/","title":{"rendered":"Similarities between English and Programming"},"content":{"rendered":"<p><span class=\"transparent\">I recently attended an English lecture about writing good English. While listening to the professor, I suddenly realized that some strategies for writing good English also applies to writing good code! I don\u2019t profess to be an excellent coder yet (feel free to critique my projects on <a href=\"https:\/\/github.com\/nanobreeze\" target=\"_blank\" data-content=\"https:\/\/github.com\/nanobreeze\" data-type=\"external\">Github<\/a>) but I think learning techniques for writing scalable code and seeing the relationships between programming and other topics will help one quicker developer one\u2019s coding skills.<\/span><\/p>\n<h2>Structure<\/h2>\n<p class=\"font_8\"><span class=\"transparent\">Each book contains at least an index, dedication, conclusion, and main content. The content for some books are divided into sections, which may contain chapters, which may be further divided into headings and subheadings. Code also has structure. There are various files and subfiles, each with a clear focus. One files can be dedicated for updating the database; another file for keeping track of the state of the program; and another file for storing a list of every other file in the program!<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0Configuration files are the index pages; constructors are the opening paragraphs where we define our terms; destructors are the closing paragraphs where we wrap up the ideas we had communicated; comments are explanations of complicated content.<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0In essays and books, we often organize similar ideas under an overarching category instead of viewing them in solo silos. For example, \u201cReptilian digestion system\u201d, \u201cMammalian digestive system\u201d, and \u201cAmphibian digestive system\u201d can be grouped in a section called \u201cAnimal digestive systems\u201d. As a result, we help readers who read \u201cAnimal digestive systems\u201d understand the relationship between various digestive systems and how they are similar to each other instead of portraying each as an independent topic. In programming, we also group similar ideas together. We can place similar blocks of code in overloaded functions, use abstractions to represent concepts, such as creating the classes ReptilianDigestiveSystem, MammalianDigestiveSystem, and AmphibianDigestiveSystem to inherit from the class AnimalDigestiveSystem, or create projects that complete similar tasks. Grouping similar code together increases the maintainability of the program because developers can more quickly understand the purpose of and relationships between various chunks of code.<\/span><\/p>\n<h2>Implementation<\/h2>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_def_2_child\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$0\"><\/div>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_WholeSinglePost\" class=\"flex_display flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_def_4_child\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$0\"><\/div>\n<div id=\"CategoriesList_MediaPost__0_0\" class=\" \" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_def_0_false\" class=\" flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_categoryBox\" class=\"flex_display\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_categories\" class=\"s7\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_categoriesinlineContent\" class=\"s7inlineContent\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_0_def_3\" class=\"\" data-isfirst=\"true\" data-iseven=\"false\" data-islast=\"true\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0.$0\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_0_def_4\" class=\"flex_display\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0.$0.$0\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_0_def_5\" class=\" flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0.$0.$0.0.$0\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_0_category\" class=\"s10\" data-align=\"center\" data-disabled=\"false\" data-margin=\"0\" data-should-use-flex=\"false\" data-proxy-name=\"Button2\" data-state=\"desktop  center\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0.$0.$0.0.$0.$0\" data-prev-text=\"Software and Life\" data-prev-min-width=\"128\" data-prev-width=\"128\">\n<div id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_0_categorylink\" class=\"g-transparent-a s10link\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0.$0.$0.0.$0.$0.0\"><span id=\"comp-iijmjkzw_CategoriesList_MediaPost__0_0_0_0_categorylabel\" class=\"s10label\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$1.$child.$0.$0.0.$0.$0.0.$0.$0.0.0\">Software and Life<\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_def_6\" class=\" flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_def_7\" class=\"flex_display flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$0\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_title\" class=\"s8\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$0.$0\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_titlerichTextContainer\" class=\"s8_richTextContainer s8richTextContainer\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$0.$0.0\">\n<h1 class=\"font_5\"><strong><em>Similarities between English and Programming<\/em><\/strong><\/h1>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_TitleSpace_child\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$1\"><\/div>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_dateAndAuthorAligner\" class=\"flex_display flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$2\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_dateAndAuthor\" class=\"flex_display\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$2.$0\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_date\" class=\"s8\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$2.$0.$0\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_daterichTextContainer\" class=\"s8_richTextContainer s8richTextContainer\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$2.$2.$0.$0.0\">\n<p class=\"font_9\">February 20, 2016<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"SinglePostMediaInner_MediaPost__0_0\" class=\" flex_display\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$3\"><\/div>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_mediaSpace_child\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$4\"><\/div>\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0__type_MediaPost\" class=\" flex_vbox\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$5\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_mediaText\" class=\"s8\" data-proxy-name=\"MediaLabel\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$5.$0\" data-width=\"630\">\n<div id=\"comp-iijmjkzw_SinglePostMediaTop_MediaPost__0_0_mediaTextrichTextContainer\" class=\"s8_richTextContainer s8richTextContainer\" data-reactid=\".0.$SITE_ROOT.$desktop_siteRoot.$PAGES_CONTAINER.1.1.$SITE_PAGES.$mxsid.1.$comp-iijmjkzw.0.0.$child.$0.1.$1.$5.$0.0\">\n<div id=\"innerContainer_txtMedia8d8\">\n<div id=\"innercomp_txtMedia8d8\" class=\"s11\" title=\"\" data-exact-height=\"169.36076612903227\" data-content-padding-horizontal=\"0\" data-content-padding-vertical=\"0\" data-reactid=\".2\" data-react-checksum=\"-705406731\">\n<div id=\"innercomp_txtMedia8d8link\" class=\"s11link\" data-reactid=\".2.0\">\n<div id=\"innercomp_txtMedia8d8img\" class=\"s11img\" data-reactid=\".2.0.0\">\n<div id=\"innercomp_txtMedia8d8imgpreloader\" class=\"s11imgpreloader\" data-reactid=\".2.0.0.0\"><\/div>\n<p><img id=\"innercomp_txtMedia8d8imgimage\" src=\"https:\/\/static.wixstatic.com\/media\/a960ef_4f1fd20730de43b687b6c6d77eedeefa.jpg\/v1\/fill\/w_255,h_170,al_c,q_80,usm_0.66_1.00_0.01\/a960ef_4f1fd20730de43b687b6c6d77eedeefa.jpg\" alt=\"\" data-reactid=\".2.0.0.$image\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">I recently attended an English lecture about writing good English. While listening to the professor, I suddenly realized that some strategies for writing good English also applies to writing good code! I don\u2019t profess to be an excellent coder yet (feel free to critique my projects on <a href=\"https:\/\/github.com\/nanobreeze\" target=\"_blank\" data-content=\"https:\/\/github.com\/nanobreeze\" data-type=\"external\">Github<\/a>) but I think learning techniques for writing scalable code and seeing the relationships between programming and other topics will help one quicker developer one\u2019s coding skills.<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">Structure<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">Each book contains at least an index, dedication, conclusion, and main content. The content for some books are divided into sections, which may contain chapters, which may be further divided into headings and subheadings. Code also has structure. There are various files and subfiles, each with a clear focus. One files can be dedicated for updating the database; another file for keeping track of the state of the program; and another file for storing a list of every other file in the program!<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">Configuration files are the index pages; constructors are the opening paragraphs where we define our terms; destructors are the closing paragraphs where we wrap up the ideas we had communicated; comments are explanations of complicated content.<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">In essays and books, we often organize similar ideas under an overarching category instead of viewing them in solo silos. For example, \u201cReptilian digestion system\u201d, \u201cMammalian digestive system\u201d, and \u201cAmphibian digestive system\u201d can be grouped in a section called \u201cAnimal digestive systems\u201d. As a result, we help readers who read \u201cAnimal digestive systems\u201d understand the relationship between various digestive systems and how they are similar to each other instead of portraying each as an independent topic. In programming, we also group similar ideas together. We can place similar blocks of code in overloaded functions, use abstractions to represent concepts, such as creating the classes ReptilianDigestiveSystem, MammalianDigestiveSystem, and AmphibianDigestiveSystem to inherit from the class AnimalDigestiveSystem, or create projects that complete similar tasks. Grouping similar code together increases the maintainability of the program because developers can more quickly understand the purpose of and relationships between various chunks of code.<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">Implementation<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">Implementation is about how to write the contents of a task to achieve a desired effect or purpose. There are numerous ways to describe a piano\u2019s appearance. Do we begin by describing the contrasting colour of its keys or do we begin by describing its contour and shape? Do we seek to emphasize the piano\u2019s size or texture? How sophisticated is our vocabulary for describing the piano? How do we structure our paragraphs such that readers see and feel the piano as vividly as we do?<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0There are also numerous ways to sort a list of elements. Shall we apply merge sort or quick sort? Is our goal to achieve faster time or less memory usage? To use or not to use design patterns? Do we use multithreading to or does a single thread already suffice our needs?<\/span><\/p>\n<p class=\"font_8\"><span class=\"transparent\">\u00a0In both writing English and coding, we thoughtfully express our ideas and implement our designs by contemplating about the final result and then welding our mastery of syntax, semantics, and other language subtleties to achieve that result.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I recently attended an English lecture about writing good English. While listening to the professor, I suddenly realized that some strategies for writing good English also applies to writing good&#8230;<\/p>\n","protected":false},"author":1,"featured_media":40,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/posts\/39"}],"collection":[{"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":2,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/posts\/39\/revisions"}],"predecessor-version":[{"id":42,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/posts\/39\/revisions\/42"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/media\/40"}],"wp:attachment":[{"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/media?parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/categories?post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/lennycheng.com\/blog\/wp-json\/wp\/v2\/tags?post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}