MESSAGE
DATE | 2017-05-03 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Hangout of NYLXS] programming-as-a-way-of-thinking/
|
From hangout-bounces-at-nylxs.com Wed May 3 01:18:39 2017 Return-Path: X-Original-To: archive-at-nylxs.com Delivered-To: archive-at-nylxs.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 6039D160E77; Wed, 3 May 2017 01:18:38 -0400 (EDT) X-Original-To: hangout-at-nylxs.com Delivered-To: hangout-at-nylxs.com Received: from [10.0.0.62] (flatbush.mrbrklyn.com [10.0.0.62]) by mrbrklyn.com (Postfix) with ESMTP id 1ABC1160E77 for ; Wed, 3 May 2017 01:18:23 -0400 (EDT) To: Hangout From: Ruben Safir Message-ID: <82714227-fd7e-d638-743b-9b9465991257-at-mrbrklyn.com> Date: Wed, 3 May 2017 01:18:23 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 Content-Language: en-US Subject: [Hangout of NYLXS] programming-as-a-way-of-thinking/ X-BeenThere: hangout-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: NYLXS Tech Talk and Politics List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: hangout-bounces-at-nylxs.com Sender: "Hangout"
https://blogs.scientificamerican.com/guest-blog/programming-as-a-way-of-thi= nking/
what we have been say all along
Programming as a Way of Thinking The power of modern programming languages is that they are expressive, readable, concise, precise, and executable By Allen Downey on April 26, 2017 Share on Facebook Share on Twitter Share on Reddit Email Print Share via Google+ Stumble Upon =EF=BF=BC Credit: K.lee Wikimedia Programming has changed. In first generation languages like FORTRAN and C, the burden was on programmers to translate high-level concepts into code. With modern programming languages=E2=80=94I=E2=80=99ll use Python as = an example=E2=80=94we use functions, objects, modules, and libraries to extend the language, and that doesn=E2=80=99t just make programs better, it changes what program= ming is. Programming used to be about translation: expressing ideas in natural language, working with them in math notation, then writing flowcharts and pseudocode, and finally writing a program. Translation was necessary because each language offers different capabilities. Natural language is expressive and readable, pseudocode is more precise, math notation is concise, and code is executable. But the price of translation is that we are limited to the subset of ideas we can express effectively in each language. Some ideas that are easy to express computationally are awkward to write in math notation, and the symbolic manipulations we do in math are impossible in most programming languages. The power of modern programming languages is that they are expressive, readable, concise, precise, and executable. That means we can eliminate middleman languages and use one language to explore, learn, teach, and think. =EF=BF=BC Figure 1 As an example, Figure 1 shows the breadth first search (BFS) algorithm expressed in the pseudocode used in a popular textbook. The authors designed this language to be more concise and readable than most programming languages at the time, which was 1989. Figure 2 shows the same algorithm in Python. It is a few lines shorter than the pseudocode, and because it uses more words than symbols, I think it=E2=80=99s more readable. Also, unlike pseudocode, we can run it, display the results, and debug it. =EF=BF=BC Figure 2 Running programs is the whole point of programming, of course, but there is more to it. The ability to execute code makes programming a tool for thinking and exploring. When we express ideas as programs, we make them testable; when we debug programs, we are also debugging our brains. Languages like Python are also ideal for learning and teaching. For example, I wrote a book recently about digital signal processing (DSP). I used Python to write a simple library and Jupyter (which is a software development environment) to compose online notebooks that combine text, code, and results, including images and sound clips. As I developed the book, I wrote code to test my understanding and explain it to students at the same time. Students can run the code to develop a mental model, make changes to test their predictions, and extend my code for their projects. Most textbooks and classes use math to teach signal processing, with students working primarily with paper and pencil. With this approach, the only option is to go =E2=80=9Cbottom up=E2=80=9D, starting with the ari= thmetic of complex numbers, which is not the most exciting topic, and taking weeks and many pages to get to relevant applications. With a computational approach, we can go =E2=80=9Ctop down=E2=80=9D, starti= ng with libraries that implement the most important algorithms, like Fast Fourier Transform. Students can use the algorithms first and learn how they work later. They can see the most important ideas, like spectral decomposition, without being blinded by details. They can work on real applications, on the first day, that provide the motivation to go deeper. And they can have a lot more fun.To demonstrate, I wrote a Jupyter notebook called =E2=80=9CCacophony for the whole family.=E2=80=9D I= f you click that link, you can see the code and listen to the examples. It uses the library I wrote to simulate the sound of a grade school band, with instruments out of tune and some children randomly playing the wrong note. It=E2=80=99s meant to be silly (and a little bit mean), but it also demonstrates aspects of how we perceive sound and interpret the pitch of a complex signal. The languages I am calling modern are not particularly new; in fact, Python is more than 25 years old. But they are not yet widely taught in high schools and colleges. And even where they are adopted, they are often used in a style that does not take advantage of their power. Modern programming languages are qualitatively different from their predecessors, but we are only beginning to realize the implications of that difference. In a companion article, I present more ways to use Python to think, explore, learn, and teach.
-- =
So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 _______________________________________________ Hangout mailing list Hangout-at-nylxs.com http://www.nylxs.com/mailman/listinfo/hangout
|
|