Similarities between English and Programming

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’t profess to be an excellent coder yet (feel free to critique my projects on Github) but I think learning techniques for writing scalable code and seeing the relationships between programming and other topics will help one quicker developer one’s coding skills.

Structure

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!

 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.

 In essays and books, we often organize similar ideas under an overarching category instead of viewing them in solo silos. For example, “Reptilian digestion system”, “Mammalian digestive system”, and “Amphibian digestive system” can be grouped in a section called “Animal digestive systems”. As a result, we help readers who read “Animal digestive systems” 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.

Implementation

Similarities between English and Programming

February 20, 2016

 

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’t profess to be an excellent coder yet (feel free to critique my projects on Github) but I think learning techniques for writing scalable code and seeing the relationships between programming and other topics will help one quicker developer one’s coding skills.

 

Structure

 

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!

 

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.

 

In essays and books, we often organize similar ideas under an overarching category instead of viewing them in solo silos. For example, “Reptilian digestion system”, “Mammalian digestive system”, and “Amphibian digestive system” can be grouped in a section called “Animal digestive systems”. As a result, we help readers who read “Animal digestive systems” 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.

 

Implementation

 

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’s 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’s 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?

 There 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?

 In 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.

Sharing is caring!

Leave a Reply

Your email address will not be published.