Do We All Have To Learn To Code?


Healthcare workers often use the word “code” as slang for a cardiopulmonary arrest happening to a patient in a hospital or clinic. Announcement of the word energizes a team of providers, sometimes called a code team, to rush to a specific location and begin immediate resuscitative efforts. Code means different things to different people. Broadly speaking, code means a systematic statement of a body of law or a system of principles or rules. Politicians and activists use jobs, healthcare, or a change in leadership. Developing a vaccine for the coronavirus revolves around genetic code. If you ask a high school student what code means, she or he will wonder why you don’t know, and then explain code is the set of instructions which tells a computer what to do.

A set of instructions which tells a computer what to do is often called a “program” or a “script”, or more likely today, an app, short for application. When you click the CNBC app on your smartphone, a set of instructions are executed to display the business news of the day or retrieve a quote for the current price of a stock, bond, option, or fund. A typical smartphone app contains thousands of lines of code.

To offer an example of what code can do, I will describe a script (program) I wrote for one of my hobbies, home automation. Code is written using a computer programming language. There are many of them, the most popular being Python. When I wake up in the morning, I push a button on my nightstand which initiates a Python script  called Good Morning. It runs on a Mac computer in my home office. In the following lines, I will describe what the script does in layperson terms. The actual script follows a very strict syntax, the arrangement of words and phrases formed in a detailed way which the computer understands.

  • Retrieve the season, date, time, and weather from the Internet.
  • Raise the motorized solar shade.
  • Wait 15 seconds and then turn on the night table lamp and ceiling fan light to  low brightness.
  • Gradually increase the brightness.
  • Set thermostats based on the current season.
  • Wait 15 minutes and then unlock all doors.
  • Prepare a good morning announcement from various data.
  • Use Amazon Web Services Polly artificial intelligence to create an announcement using Salli’s amazingly human voice, and play it on the master bedroom Sonos wireless speaker.
  • Friday’s announcement was:”Good morning. Today is Friday, June 5. The time is 7:00 AM and the current weather is overcast. The temperature outside is 67 and the humidity is 85 percent. The forecast is light rain throughout the day. The high temperature will be 77 with winds out of the South at 6 miles per hour and gusts up to 16 miles per hour. There is a 94 percent chance of precipitation. Have a nice day at the Ridge.”
  • Make a music selection at random from a list of favorite stations, playlists, and albums. If it is Sunday, select at random from a list of Baroque music sources. If it is not Sunday, select at random from a list of favorite music sources, mostly from Spotify.
  • Play the selected music on Sonos speakers throughout the house. Set volume levels based on preference for each room.

The actual Python script is 115 lines of code. It took quite a few hours to write and test the code, to get it to do exactly what I wanted it to do. One thing I learned many years ago is software does exactly what you tell it to do, not necessarily what you want it to do. The process to get it right is called “debugging”.

I first learned to code (write code) more than 50 years ago in engineering school. The computer was made by GE and the computer language was called WIZ. Later, when I joined IBM, I learned other computer programming languages including Fortran, RPG, APL, and Basic. I was never a programmer (coder), but IBM required all sales people to be conversant in software so as to give good advice to customers. If you asked a high school student about the languages I just mentioned, they would say they never heard of any of them. Todays most popular code languages are Python, Java, Javascript, C#, PHP, and Ruby on Rails. There are many more. One of my grandchildren learned the basics of an Apple coding language called Swift.

Code is everywhere. A countertop toaster oven has a computer chip in it with a set of instructions to make your toast or baked casserole come out just right. Most all “televisions” today are actually computers which run code to select and play the streaming service you like. The Apple and Google app stores have roughly five million apps.

The range of lines of code in apps and devices is extraordinary. The average iPhone app has up to 50,000 lines of code. Google’s apps in total are believed to use more than two billion lines of code. To put this in perspective, a million lines of code, if printed, would be about 18,000 pages of text, 14 times the length of War and Peace.

Code is running in millions of pacemakers, games, and just about everything electronic. A few other examples:

  • The control software to run a U.S. military drone uses 3.5 million lines of code.
  • A Boeing 787 has 6.5 million lines
  • The Google Chrome browser runs on 6.7 million lines of code.
  • A Chevy Volt uses 10 million lines.

Famed venture capitalist Marc Andreesen said, “software is eating the world”. What he means is software is replacing human labor. Everywhere. In most everything. My Good Morning script is trivial, but consider the SpaceX Crew Dragon which autonomously docked itself with the International Space Station while both were circling the Earth at 17,000 mile per hour. I don’t know how many lines of code it took to do this, but a lot. A Tesla electric car is believed to have 100 million lines of code running under the hood.

The title of this article is “Do We All Have To Learn To Code?” My answer is a qualified yes. When it comes to education, every kid needs to learn at least the basics of coding, regardless of career path they may aspire toward. For those of us who have moved beyond our first careers, an understanding of coding can feed our curiosity about how things work. It is never too early or too late to learn to code. Here is what CodeMonkey has to say,

“CodeMonkey is user-friendly and intuitive. CodeMonkey takes a straight-forward approach, teaching real text-based code in a manner that even 8-year-olds can understand.”

CodeMonkey is one of many online learning platforms. Thousands of courses on coding and other topics are available. Some are expensive, many are free or low cost. I am currently taking Python courses at Treehouse. I have also taken some courses at edX.org, which offers 2,500+ online courses from 140 institutions including Berkeley, Harvard, MIT, and the University of Texas. For those aspiring to a new career, many of the courses offer certifications. As I wrote in Net Attitude back in 2001, many employers would much rather hire people who have certifications in the various skills the employer needs than people with a college degree without any specialty.

Ok, lets get back to coding or learning to code.

Tagged with: , , , , ,