What is coding, and why should we learn to do it?
Computer programming (aka programming or coding) is the process of designing and writing a program that digital computers can follow.
Computers have no “brain” at all. They can’t, reason, figure things out – they can’t even add or subtract. Computers are an assembly of parts, like ROM and RAM chips, semiconductors, and wires. On their own they mindlessly channel electricity and magnetism. Electrons flow from one place to the next; magnetic fields alter the properties of some material. That’s it.
If we want to use all of that to do something then we first ask “What do we want to do with it?” We then take our general idea and break it down into separate parts. And each part is broken down into a very simple set of steps. A step-by-step recipe to get a mindless computer to follow a set of instructions is called an algorithm.
By breaking big ideas down into smaller ideas, and then into even simpler, smaller steps, is basically just “very clear, very explicit, logical thinking.” When we explain these simple, step-by-step instructions in a way that makes a computer do what we want, then we call it “coding.”
What’s the lowest level of what we want a computer to do? Take in some information, remember it, and do something with that information. That’s what an operating system is for.
Operating systems are written on a very low level. Most people who use a computer will never learn how they are designed and built. In fact, even most computer programmers today won’t do so. Unless you’re getting deep into this field, that’s ok. It’s what comes next that matters.
Once we have an operating system, we can create a higher level programming language on top of that. These higher level languages already have hundreds of basic step-by-step algorithms baked into it. With one, we don’t need to teach a computer how to “listen to the keyboard, figure out which key is being pressed”, it already knows how to do this. With one we don’t need to teach a computer “draw a letter, one pixel at a time, on a monitor”, it already knows how to do that.
With higher level coding languages we can easily write sophisticated programs: word processors, spreadsheets, programs that solve math problems; math programs that help us solve chemistry or physics programs. We can manipulate images and sound to create art, videogames, illustrate business data, etc.
Reasons to learn to code
Here I’m excerpting some thoughts from Al Sweigart.
Consider this anecdote:
A math teacher is giving a lesson on logarithms or the quadratic equation or whatever and is asked by a student, “When will I ever need to know this?”
“Most likely never,” replied the teacher without hesitation. “Most jobs and even a lot of professions won’t require you to know any math beyond basic arithmetic or a little algebra.”
“But,” the teacher continued, “let me ask you this. Why do people go to the gym and lift weights? Do they all plan on becoming Olympic weight lifters, or professional body builders? Do they think they’ll one day find an old lady trapped under a 200 pound bar bell and say, ‘This is what I’ve been training for.'”
“No, they lift weights because it makes them stronger. Learning math is important because because it makes you smarter. It forces your brain to think in a way that normally it wouldn’t think: a way that requires precision, discipline, and abstract thought. It’s more than rote memorization, or making beautiful things, or figuring out someone’s expectations and how to appease them.”
“Doing your math homework is practice for the kind of disciplined thinking where there are objective right and wrong answers. And math is ubiquitous: it comes up in a lot of other subjects and is universal across cultures. And all this is practice for thinking in a new way. And being able to think in new ways, more than anything, is what will prepare you for an unpredictable, even dangerous, future.”
Learning to program a computer, even if you don’t plan on becoming a software engineer, has similar reasons:
It teaches precise, disciplined, and abstract thinking.
It transforms your computer from a home appliance to a power tool.
Learning to program is great practice for learning itself.
There are plenty of skills people can learn to become well-rounded human beings: Playing an instrument, public speaking, budgeting, first aid, growing plants, persuasive writing, babysitting, identifying scams, et cetera, et cetera. But programming is unique among these skills…. Learning it can save you time on computer-based tasks while opening your eyes to accomplishments that were previously unfeasible.
from No, Seriously, Why Should I Learn to Code?, By Al Sweigart, learningtocode
Why should we learn coding (computer programming)?
10 Life-Changing Reasons You Should Learn to Code, by Laurence Bradford
No, Seriously, Why Should I Learn to Code?, by Al Sweigart
“If there’s one thing to take away from our analysis, it’s that no programming language can accomplish every task and the job market changes quickly from year to year. To be a successful developer, it’s important to master multiple languages and train yourself to pick up new languages quickly so you can adapt to changing job opportunities.” – The 9 Most In-Demand Programming Languages of 2017
What are algorithms? Algorithms
History of computers and coding
Hit the ground running with lessons from Code.Org. In this section you’ll be using the Blockly coding language.
Binary, ASCII and Hex
Once you get deeper into programming, you’ll find that our normal way of using numbers – the base 10 system – isn’t always the most natural.
Computers most naturally use a base 2 operating system, “binary.”
And on occasion it is easier to use a base 16 number system, “hexadecimal.”
The hexadecimal numeral system, hex, is a numeral system made up of 16 symbols – we’ll learn about it here: Hexadecimal number system
Applications: Cool practical uses of coding
What is coding? A bit more depth
The following is a list of Hello, world! programs. Hello, world! programs make the text “Hello, world!” appear on a computer screen. It is usually the first program encountered when learning a programming language.
Coding in Scratch
Scratch is a programming language that makes it easy to create your own interactive stories, games, and animations – and share your creations with others on the web. Scratch is used in more than 150 different countries and available in more than 40 languages.
Students are learning with Scratch at all levels (from elementary school to college) and across disciplines (such as math, computer science, language arts, social studies)
Coding in other languages
Quite BASIC is a web-based classic BASIC interpreter. It’s a learning resource but has also become a celebration of the early days of personal computing.
Coding in physics
BBC Bitesize: Functions, procedures and modules
Jim’s Computer Science Topics Area
Computer Architecture, Arrays, Assignment Statement, Branching
Colors RGB, Commenting your Code, Composition of Functions
Conditionals, How Data Flows in a Program, Data Types
Debugging Programs, Default Variable Values, Software Development Cycle
Emacs, Equality Test, Expressions, For Loops, Functions
Geometric Vectors, Html
Information Representation and Transformations
Integer vs. Floating Point Math
Interfaces, Loops, Math Operators, Matrix info
Memory Layout, Numbering Systems, Object Oriented Programming
Packages, Pair Programming, Pointers and References
Problem Solving, Program Flow, Programming Style
Random Numbers, Recursion, Semicolons, Shortcut Evaluation
Strings (Data Type), Structures (Data Type), Truth Tables and Logic
Unsigned Integers, Variables and Data, Variables, While Loops
Review for assessment
A. Be able to count binary with 0’s and 1’s :
if you see 8 bits, tell me what number it is
If you see a regular number (up to 256) be able to turn it into 0’s and 1’s
B. Translate ASCII letters, numbers and symbols from bits, or from bits to ASCII.
(You don’t have to memorize these codes) http://sticksandstones.kstrom.com/appen.html
Practice on the binary-> ASCII converter https://mothereff.in/binary-ascii
C. You’ll be given a simple bit map (picture on graph paper.) Convert it to binary data. Or you’ll be given binary data, convert it to a bit map.
Common Core Math Skills
|Standard (CCSS.Math.Practice)||Introduction to Programming the EV3|
|MP1 Make sense of problems and persevere in solving them||Chapters are all based around solving real-world robot problems; students must make sense of the problems to inform their solutions|
|MP2 Reason abstractly and quantitatively||Programming requires students to reason about physical quantities in the world to plan a solution, then calculate or estimate them for the robot|
|MP4 Model with mathematics||Many processes, including the process of programming itself, must be systematically modeled on both explicit and implicit levels|
|MP6 Attend to precision||Robots require precise (and accurate) input, or their output action will be correspondingly sloppy|
|MP7 Look for and make use of structure||Understanding the structure of the physical environment, the interrelated components of robot hardware and software, and commands within a program are vital to successful solutions|
|MP8 Look for and express regularity in repeated reasoning||Any programmed solution to a class of problems relies on the programmer recognizing and exploiting important patterns in the problem structure. There is also an emphasis throughout the module on recognizing common programmatic patterns, as well as patterns within a solution that invite the use of Loops.|
Common Core Math Content
|Standard (CCSS.Math.Practice)||Introduction to Programming the EV3|
|6.RP.A.1 Understand the concept of a ratio and use ratio language to describe a ratio relationship between two quantities||Students use ratio language to describe and make use of the relationship between quantities such as Wheel Rotations and Distance Traveled|
|6.RP.A.2 Understand the concept of a unit rate a/b associated with a ratio a:b with b!=0, and use rate language in the context of a ratio relationship||The relationship between Wheel Rotations and Distance Traveled is a rate, customarily understood through a unit rate such as “# cm per rotation”.|
|6.R.A.3 Use ratio and rate reasoning to solve real-world and mathematical problems||Students are required to apply ratios and rates when they build their prototype examples of their real world robots.|
|7.RP.A.3 Use proportional relationships to solve multistep ratio and percent problems.||Comparisons between rate-derived quantities|
Common Core English Language Arts
|Standard (CCSS.ELA-Literacy)||Introduction to Programming the EV3|
|WHST.6-8.1 Write arguments focused on discipline-specific content.
[See also: WHST.6-8.1.a to WHST.6-8.1.e]
|Reflection Questions ask students to analyze, evaluate, and synthesize arguments in response to robotics and programming problems|
|WHST.6-8.4 Produce clear and coherent writing in which the development, organization, and style are appropriate to task, purpose, and audience.||Reflection Question tasks include composing technical critiques, technical recommendations, and creative synthesis.|
Next Generation Science Standards (NGSS)
|Standard||Introduction to Programming the EV3|
|MS-ETS1-2. Evaluate competing design solutions using a systematic process to determine how well they meet the criteria and constraints of the problem.||Solving challenges requires students to create and evaluate both hardware and software designs according to scenario scoring criteria.
Some Reflection Questions require students to make recommendations between competing alternatives based on criteria that they define.
|MS-ETS1-4. Develop a model to generate data for iterative testing and modification of a proposed object, tool, or process such that an optimal design can be achieved.||When solving more difficult and complex challenges, students are guided toward iterative testing and refinement processes. Students must optimize program parameters and design.|
|HS-ETS1-2. Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering.||Problem Solving methodology for challenges directs students to break down large problems into smaller solvable ones, and build solutions up accordingly; challenges give students opportunities to practice, each of which is based on a real-world robot|
|HS-ETS1-3. Evaluate a solution to a complex real-world problem based on prioritized criteria and trade-offs that account for a range of constraints, including cost, safety, reliability, and aesthetics as well as possible social, cultural, and environmental impacts.||Some Reflection Questions require students to make recommendations about real-world policies (e.g. requiring sensors on automobiles) based on the impact of that decision|
The above tables are from Learning Standards: Carnegie Mellon Robotics Academy
6-8.CT.c.1 Demonstrate that numbers can be represented in different number systems (e.g., binary, octal, and hexadecimal) and text can be represented in different ways such as American Standard Code for Information Interchange (ASCII). 4. Computational Thinking (CT) is a problem solving process that requires people to think in new ways to enable effective use of computing to solve problems and create solutions. The capacity of computers to rapidly and precisely execute programs makes new ways of designing, creating, and problem solving possible. Characterized by: • analyzing, modeling, and abstracting ideas and problems so people and computers can work with them; • designing solutions and algorithms to manipulate these abstract representations (including data structures); and • identifying and executing solutions (e.g., via programming). a) Abstraction: Abstraction is a process of reducing complexity by focusing on the main idea. By hiding details irrelevant to the question at hand and bringing together related and useful details, abstraction reduces complexity and allows one to focus on the problem. This process creates a new representation which successfully reframes the problem. At the most basic level of abstraction, data structures are used to represent information so that algorithms can operate on the data to create a result. b) Algorithms: An algorithm is a sequence of precisely defined steps to solve a particular problem. Carefully designed algorithms are essential to solving complex problems using computers. Effective algorithms are efficient, clear, reusable, and accurate. c) Data: Collecting, managing, and interpreting a vast amount of raw data is part of the foundation of our information society and economy. The storage of data impacts how data is used and accessed. Computational tools enable insights and decisions through new techniques for data collection and analysis. d) Programming and Development: Programming articulates and communicates instructions in such a way that a computer can execute a task. Programming makes use of abstractions, algorithms, and data to implement ideas and solutions as executable code through an iterative process of design and debugging. e) Modeling and Simulation: Computational modeling and simulation help people to represent and understand complex processes and phenomena. Computational models and simulations are used, modified, and created to analyze, identify patterns, and answer questions of real phenomena and hypothetical scenarios. 6-8.CS.a.4 Identify and describe the use of sensors, actuators, and control systems in an embodied system (e.g., a robot, an e-textile, installation art, smart room). 9-12.CS.a.1 Select computing devices (e.g., probe, sensor, tablet) to accomplish a real-world task (e.g., collecting data in a field experiment) and justify the selection. 9-12.CS.a.2 Examine how the components of computing devices are controlled by and react to programmed commands. 9-12.CS.a.3 Apply strategies for identifying and solving routine hardware and software problems that occur in everyday life (e.g., update software patches, virus scan, empty trash, run utility software, close all programs, reboot, use help sources). 9-12.CS.a.4 Explain and demonstrate how specialized computing devices can be used for problem solving, decision-making and creativity in all subject areas. 9-12.CS.a.5 Describe how computing devices manage and allocate shared resources (e.g., memory, Central Processing Unit [CPU]). 9-12.CS.a.6 Examine the historical rate of change in computing devices (e.g., power/energy, computation capacity, speed, size, ease of use) and discuss the implications for the future.
CSTA K–12 Computer Science Standards
The Computer Science Teachers Association (CSTA) provides opportunities for K–12 teachers and their students to better understand computer science. Membership consists of more than 23,000 members from more than 145 countries.
CSTA K-12 Computer Science Standards
CL.L1:3-02 Work cooperatively and collaboratively with peers teachers, and others using technology
CT.L2-01 Use the basic steps in algorithmic problem solving to design solutions
CT.L2-06 Describe and analyze a sequence of instructions being followed
CT.L2-07 Represent data in a variety of ways: text, sounds, pictures, numbers
CT.L2-08 Use visual representations of problem states, structures, and data
CT.L2-12 Use abstraction to decompose a problem into sub problems
CT.L2-14 Examine connections between elements of mathematics and computer science including binary numbers, logic, sets, and functions
CT.L3A-01 Use predefined functions and parameters, classes and methods to divide a complex problem into simpler parts
CT.L3A-03 Explain how sequence, selection, iteration, and recursion are building blocks of algorithms
CPP.L1:6-05 Construct a program as a set of step-by-step instructions to be acted out
AP Computer Science Principles
Further articles to explore