Thoughts about computer programming from a Python beginner

This week’s reading and assignment could be a great leap for my knowledge about computer science. As a new learner of coding, I really enjoyed the tutorial lessons of Python on Codecademy, from which I realized the distinctions between natural languages and programming languages. Furthermore, it also reminds me that computational thinking is happening in my daily learning process.

Natural language vs. Programming language

We’ve spent a long time since our birth to learn millions of words that natural languages provide us for communication and transmission of meanings. According to Evan’s critique of natural languages as uneconomic, we have to express meanings of an idea with sufficient words and space. Written in English, describing the calculation of total expense requires lines of sentences. Unlike the tedious expression by natural language, the same scenario is described concisely through programming language on Python.

The words “meal, tip, tax and total” are variables we create for computer to recognize and execute. The computer does not care about what these words mean in the real world for transactions. Particularly, not all the words “meal” here have the same meaning. In the 7th line, the “meal” on the left side of the equation is a new variable we reassign while the “meal” on the right side of the equation is the same as the one in the 3rd line. Similarly, the “meal” in the 8th line shares the same meaning of the “meal” on the left side of the equation in 7th line, which helps create a new variable named “total”. However, some words either in full spelling or abbreviation as symbols have similar meanings as in the natural language environment. For instance, string methods such as “len()” represents the calculation of number of characters in the variable. “Print” represents display of the result.

Different natural languages are ambiguous to a certain extent. Similar to English, Chinese have three main pronouns to abstract people, which are “他”, “她” and “它”, meaning “he”, “she” and “it” respectively. However, all these three letters have the same pronunciation as “ta”. People feel confused if they are not familiar with the context of the conversation. As Evans described, computer scientists dedicate to create simple, structured programming languages with less ambiguity. With Python’s own syntax, the layout of the language is simple. Different data types are distinguished from various colors, like variables in orange and strings in yellow. From a beginner’s point of view, it is easy for coders to detect errors by distinguishing colors of the codes. From my training experience on Codecademy, I totally agree with Denning and Martell’s words that “the virtual worlds created by software tend to be highly sensitive to errors.” (2015) I was stuck when trying to format the date and time in the order like mm/dd/yyyy hh:mm:ss.

I was hesitating on how to show a space between date and time. So I coded date and time separately as showed on the right of the image. After running the code, the error occurred although all the information were correct, displaying the actual date and time. I had no idea about the error until I requested for the correct answer, which was simpler than I expected (as showed on the left of the image).

Using experience of Wikipedia

I find an example of computational thinking in my ongoing Wikipedia project for another class. Contributors could edit Wiki pages via visual editing and source editing. Source editing, particularly, allows people to edit and format the page with codes specifically designed for Wikipedia, called Wikitext. For example, the equal marks are symbols to format the size of headings. The “~~~~” is a symbol for your name if you would like to interact with other contributors for the Wikipage.

A screenshot of Wikitext Cheatsheet

It is also error sensitive. Unlike Python, the codes could not be distinguished by colors. I seldom use source editing because the syntax is really difficult to memorize and it is hard for me to locate the error once occurs. Since the layout of visual editing is more user-friendly (“What You See Is What You Get”), it is hard for Wikitext to be adaptive to ordinary contributors. However, after this week’s reading about Wing’s idea of computational thinking, I’m trying to shift my thinking from a mere editing of a Wiki article to a systematic process of page formatting in a mathematical and engineering perspective. The involving computation thinking not only helps us solve problems on Wiki editing, but also permeates through our online conversation and interaction.

References:

Jeannette Wing, “Computational Thinking.” Communications of the ACM 49, no. 3 (March 2006): 33–35.

David Evans, Introduction to Computing: Explorations in Language, Logic, and Machines. Oct. 2011 edition. CreateSpace Independent Publishing Platform; Creative Commons Open Access: http://computingbook.org/.

Peter J. Denning and Craig H. Martell. Great Principles of Computing. Cambridge, MA: The MIT Press, 2015, chapters 4, 5, 6.

Help:Cheatsheet. (2017, October 15). In Wikipedia. Retrieved from https://en.wikipedia.org/w/index.php?title=Help:Cheatsheet&oldid=805470734

WYSIWYG. (2017, October 19). In Wikipedia. Retrieved from https://en.wikipedia.org/w/index.php?title=WYSIWYG&oldid=806034486