Table of Contents » Chapter 1 : Preliminaries : Foundational Computing Concepts
Foundational Computing Concepts
Contents
Overview
Outside of Computer Science (CS), we explore language, culture, and human experience. Computer programming is often perceived as a discipline for Science, Technology, Engineering, & Math (STEM) disciplines. However, learning and using programming in disciplines outside of CS complements the creative, investigative spirit of many disciplines such as Art, Music, Communications, English, History, Linguistics, Philosophy, World Languages & Culture, Writing, Rhetoric, and many others. Programming in these disciplines unlocks new perspectives, especially in digital humanities, data analysis in linguistic research, archival information retrieval, and interactive media. Understanding the basic concepts of programming hence becomes essential. This chapter presents foundational elements of programming in general and then introduces you to the Python programming language and Google CoLaboratory tools where we will begin our hands-on exploration of programming.
It will be important for you to become familiar with and be able to identify elements of, the foundational concepts of computing: input ⇨ processing ⇨ output. You will notice that the structure of this book is based on this concept. input ⇨ processing ⇨ output is also a general concept, meaning it is not a just Python concept, or even just a programming concept, but a concept that underlies all of computing. For example, computer hardware is designed around this concept. We have keyboards specifically to input data. We have computer Central Processing Units (see CPU later on this page) to process the data we input. And we have computer monitors (screens) to see the output produced by the processing of data that we input. input ⇨ processing ⇨ output is involved in nearly everything you do with computing devices and services (desktop computers, laptops, tablets, phones, smart devices, modern vehicles, kiosks, the Internet, bank ATMs, etc.).
As programmers, we often produce diagrams to help us visualize the requirements that our programs need to fulfill. We can start with an elementary diagram of the general concept of Input ⇨ Processing ⇨ Output like this:

The symbols used in Figure 1 are examples of a type of diagram used in programming called Flowcharts. We will learn more about how to create flowcharts throughout this book. In Figure 1, each of the three shapes enclose one of the steps of Input ⇨ Processing ⇨ Output. This is a high-level generic example that could represent anything in computing. We can use this generic form to demonstrate a flowchart of a specific example like this:

Figure 2 is a high-level Input ⇨ Processing ⇨ Output flowchart of a Google search. We call this high-level because there is no real detail about any of the three parts work, but it demonstrates the concept of Input ⇨ Processing ⇨ Output with an example of an everyday activity you are likely familiar with. We could speak about the diagram in Figure 2 with a bit more description like this:
- Google Search [Input]: A person opens Google in a web browser and types words into the search text box on the website. When they press Enter, their search words are sent to Google, this is an example of input.
- Google Algorithm [Processing]: The Google system feeds the search words the user enter to their algorithm that conducts the search process, this is an example of processing.
- Google Search Results [Output]: When the process is complete, the Google system returns the search results to the user's web browser and displays the results on their screen, this is an example of output.
I could have offered countless other examples here in place of the Google search example. Remember that Input ⇨ Processing ⇨ Output is foundational to computing, so while we used an Internet example in Figure 2, this is not only related to the Internet and web pages. With that in mind, can you think of other examples? As programmers, we must have a fundamental understanding of Input ⇨ Processing ⇨ Output as we proceed. We will continuously build upon the simple examples in Figures 1 and 2 above.
What is a Programming Language?
A programming language is a formal language comprising instructions that produce various output in a computing device. Formal Languages are languages (such as logic, mathematics, computer programming, etc.) constructed by human beings as precisely defined to eliminate ambiguity and contain their syntax and semantics. Formal languages are in contrast to Natural Languages, which are languages (such as English, Spanish, French, Chinese, Russian, etc.) that evolved with humans over time to facilitate communication between them. Natural Languages contain syntax and semantics, but also include ambiguity, a key linguistic difference between Formal Languages and Natural Languages.
Think of a programming language as a set of rules and syntax that translates human ideas into commands a computer can understand and execute. These languages vary in complexity and purpose, ranging from high-level languages like Python, which closely resembles human language, to low-level languages like Assembly, which are more directly related to machine code. Programming languages are the backbone of software development, enabling the creation of everything from simple scripts that automate mundane tasks to complex systems like operating systems and intricate algorithms. They serve as an intermediary, allowing humans to communicate with machines in a structured and efficient manner, turning lines of code into functional applications and systems.
There are well over 1,000 programming languages in existence1 and are often grouped is language families, like c-based languages, much like natural languages, like romance languages. Programming languages are also grouped in other ways as well, for example, by their influence on other programming langauges, as shown by the work of researcher Ramiro Gómez on his webiste programminglanguages.info.

[© Ramiro Gómez and programminglanguages.info ]
Levels of Programming Languages
Computers operate on machine language, also called low-level, meaning in a binary form. Everything in a computer is represented by binary numbers at its low level. For example, 01001000 01100101 01101100 01101100 01101111 is how a computer sees and stores the word Hello. For humans, 01001000 01100101 01101100 01101100 01101111 is indecipherable. So, over time, computer scientists have developed ways for humans to interact with machine language through interpretation processes. For example, a human user can type Hello and save it (in a word processor or other software). In the background, their input is stored, and "Hello" is interpreted and stored as 01001000 01100101 01101100 01101100 01101111. Later, when the user reopens that data, another process interprets the 01001000 01100101 01101100 01101100 01101111 stored in the computer and the user sees the word Hello. The user need not understand how this process works or even that it is happening—
this is called abstraction:
As programmers though, while we need to develop more depth of knowledge of the technical details, programming languages are also abstracted to varying degrees. One way in which programming langauges are categorized is by the degree of separation from the low level binary machine language of the machine, which we refer to as:
- High-Level Languages: These languages are close to human languages and further from machine code. They are more abstract, easier to learn, and more user-friendly. Examples include Python, Java, and C++.
- Low-Level Languages: These include assembly language and machine code, which are closer to the hardware. They offer greater control over hardware components but are more complex and harder to learn.
Purposes (Domains) of Programming Languages
Programming languages are also categorized by their purpose: General-purpose or Domain-specific. General-purpose and domain-specific programming languages differ primarily in their scope and versatility. General-purpose languages, such as Python, Java, or C++, are designed to be flexible and broad in their application, allowing developers to write software for a wide range of tasks across various domains, from web development to scientific computing. They offer extensive libraries and tools to handle diverse programming needs, making them adaptable to many different types of problems. On the other hand, domain-specific languages, such as SQL, R, and Matlab, are tailored for specific types of tasks or industries.
Python is a general-purpose programming language and is also high-level, two characteristics that have helped make it very popular for development in many different types of applications.
Type of Interpretation of Programming Languages
As mentioned above, there is a process of interpretation between what we as humans see in computers and binary machine code. Another way programming languages are categorized is by the method of making that interpretation of the code written in those languages and machine code. We use the terms compiled and interpreted to categorize programming languages depending on the type of process used to convert code in that language to machine code. Some languages are compiled, meaning the code is translated into machine code before execution. Others are interpreted, where the code is executed line-by-line by an interpreter. Python, for instance, is an interpreted language. Compiled languages generally produce "faster" programs, that is, their run time processing tends to be faster than programs written in interpreted languages. While this may be a key factor for some types of software, other types of software may not rely on speed as much.
Keeping the foundation concept of Input ⇨ Processing ⇨ Output in mind, next we'll consider approaches to writing computer programs. We can approach writing code to fulfill a need or to complete a task in many ways. Since there are so many programming languages to choose from, and many programming tools to use with those languages, we have many options to consider. This book is based on the Python programming language. That was a choice I made based on several factors. Python is currnetly one of the most common and popular programming languages, which is a factor in that choice. Also, the academic and industry teaching that I am focused on currently is based on Python. So, it's logical that this book is based on Python to support my teaching.
Could I have written this book based on another programming language? Yes. A significant portion of this book would be nearly identical as it is right now even if I had chosen to use a different programming language. For example, this book is structured around the general concept of Input ⇨ Processing ⇨ Output. That concept transcends programming language, meaning I can use nearly any programming language to take input, process it, and produce output. So, teaching from that foundational perspective will work with any programming language.
There are many conventional methods and strategies to learn programming. Traditional programming approaches have been foundational in teaching and learning programming for decades. These methods focus on structured learning, understanding foundational concepts, and hands-on practice. While I use this book as the basis of my teaching, I recommend anyone learning programming and Python to explore as many resources as you have time for and that you have access to (there are many resources for these topics).
Programmers use software to write software, and we often refer to the software they use as tools. One of the first steps in learning programming is to familiarize yourself with the tools and software commonly used by programmers to write, test, and manage their code and subsequent applications. These tools are designed to make the coding process more efficient, organized, and error-free. There are a large number of types of tools and many vendors who make the various tools. This can be overwhelming if you try to be familiar with all of them. Here's a brief overview of the types of software you can encounter with a few of examples of each. In this book, we'll start by using a simple tool called Google CoLab, then we'll explore some of the other tools as we make our way through the book.
- Text Editors: A text editor is a program that we use to write plain text, that is, text with no formatting. In a word processor, like Microsoft Word, we can format text as bold, set colors, different fonts, font sizes, etc. To do this, the word processor embeds special codes in the saved documents it creates that define those formatting choices. When we write programming code though we can't have those extra embedded codes in our code files. So, we need a plain text editor. The simplest of these are text editors like Windows Notepad, or TextEdit on a Macintosh or Nano on Linux. All of these allow you to write simple text with no formatting and when you save what you type to a file that file only contains the plain text with no additional codes or symbols for formatting. However, those default editors are often too simple to really serve the needs of programmers. And so, there are a large number of editor programs (apps) available designed for programming, many of which are free to download and use.
- Integrated Development Environments (IDEs): IDEs are text editors with many added features for programmers that allow you to not only write your programs, but also provide debugging, testing, project management, and source code control features and allow you to run your programs directly inside of the IDE itself. Most professional software developers use IDEs. Like text editors, there are many IDEs available, most of which have free versions you can download and use. IDEs can be complex in and of themselves, so it is often an investment of time to learn how to use an IDE. The tradeoff though is usually worth it in the long run, especially when developing larger projects in professional environments, within a team of developers or when you are serious about learning programming.
- Version (Source) Control Systems: Source control tools manage changes to source code and other types of files. These tools are used heavily in the software development industry. Most software development is accomplished by teams and n a team environment sharing code is a major aspect to successful projects, and these tools make that possible. It is very important to become familiar with the use of source control when learning programming. Personally, I use Git and GitHub in my eBooks and classes, but there are many options for source control tools and it is a good idea to be at least mildly familiar with them in general. We will use Git and GitHub later in this book.
- Others: There are many other types of tools programmers use; like compilers, interpreters, debuggers, database tools, build tools, package managers, testing frameworks, deployment tools, code analysis tools, code repositories, code documentation tools, security, logging, and dependency checkers, cloud computing services, etc.
Understanding of computing hardware will help you as a Python programmer, as your code's performance will often depend on the hardware on which it is used. So, let's look at the environment Python operates in—the computer itself. Computer hardware refers to the physical components that make up a computer system. These components include the central processing unit (CPU), memory (RAM), storage (hard drives or SSDs), and input/output devices such as keyboards, mice, and monitors. Each of these hardware components plays a crucial role in the operation of a computer and, by extension, how your Python programs run.
Computing Devices
Computing devices have evolved significantly over the years, moving from large, room-sized machines to devices small enough to fit in our pockets. As a Python programmer, you should be familiar with the various types of devices that you use in your work. These include desktops, laptops, tablets, and even cloud systems.
Computing devices have evolved significantly over the years, moving from large, room-sized machines to devices small enough to fit in our pockets. As a Python programmer, you should be familiar with the various types of devices that you might use in your work. These include desktops, laptops, tablets, and even cloud systems.

Desktop computers, including personal computers (PCs) and Macs, have long been a standard platform for programmers. They offer a powerful and steady work environment, often providing superior processing power and memory compared to other device types. They offer a more comfortable coding environment for longer programming sessions with a larger screen and dedicated keyboard. Python runs smoothly on desktop computers, and a vast range of development tools and integrated development environments (IDEs) are available for these systems.

Laptop computers offer the benefits of desktop computers with added mobility. Laptops are a good choice for programmers who are on the need a portable work environment, laptops are a good choice. Modern laptops come with CPUs and RAM that can compete with desktop computers, so running Python and various development tools should not be a problem. Laptops also provide the flexibility to code in various environments.

Tablets: While not traditionally used for programming, tablets are increasingly used to write and run Python code. Apps like Pythonista for the iPad allow you to write and execute Python scripts directly on your tablet. Although they may not offer the same level of functionality or performance as a desktop or laptop, tablets can be suitable for light coding, learning, or prototyping ideas.
Cloud systems are increasingly used as software development environments. They offer powerful, scalable, and accessible platforms for running code. Python is well-supported on all major cloud providers, like Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure. Cloud-based development environments, such as Google CoLaboratory, allow you to write, run, and share Python code from a web browser. This means you can program from any device with an internet connection, and the heavy lifting is done by the cloud server, not your local device. This can be particularly helpful when dealing with resource-intensive tasks such as machine learning or big data processing. These cloud platforms offer services beyond just running code, including database systems, machine learning tools, data storage solutions, and more, all of which can interact with your Python programs.
Mobile Devices: We must also recognize the role of mobile devices in programming. Mobile phones are not just communication tools anymore; they are fully-fledged computing devices. Python programming on mobile devices is becoming more feasible as mobile hardware becomes more advanced and specialized applications become available. The biggest advantage of mobile devices is their portability, which allows developers to work on their code anytime, anywhere. Although unsuitable for large-scale development projects due to their size and limitations in processing power and memory, mobile devices can be a handy tool for prototyping, learning, and coding while away from one's full-scale computing devices. Python on Android devices is supported via apps such as Pydroid 3 and QPython. On iOS devices, Pythonista is a popular choice. These applications allow you to write and run Python scripts directly on your mobile device. They even offer some degree of integration with the device's features, such as the accelerometer or the touch screen. It's also worth mentioning that while Python itself isn't typically used for mobile app development, tools like Kivy and BeeWare allow you to write mobile apps using Python, which can then be run on mobile devices. However, it's important to remember that the smaller screens and virtual keyboards on mobile devices can make extensive coding sessions challenging compared to a desktop or laptop.
Central Processing Unit (CPU)
The CPU is the primary component of a computer that performs most of the processing inside the computer. It's often referred to as the "brains" of the computer because it carries out the instructions of a computer program by performing basic arithmetical, logical, control, and input/output (I/O) operations. Python, being an interpreted language, relies on the CPU to execute its instructions one at a time. The CPU's speed (often measured in Gigahertz, GHz) and the number of cores it has can significantly impact the speed at which your Python program runs.
Random Access Memory (RAM)
Random Access Memory (RAM) is a type of computer memory that can be read from and written to by the processor. It's used to store working data and machine code. RAM is volatile, meaning its contents are lost when the computer is powered off. When you run a Python program, it's loaded into RAM for the CPU to process. The more complex your program (i.e., the more variables it uses, the larger the data structures, etc.), the more RAM it requires.

Storage Devices
Storage refers to computer hardware that can be used to retain data, even when powered off. The two most common forms of storage are Hard Disk Drives (HDD) and Solid State Drives (SSD). When you save a Python script to a file, you're writing it to storage. When you run a Python program that reads or writes files, it's accessing the storage hardware.
Input/Output (IO) Devices
Input and output devices are how a computer receives and sends data. Examples of input devices include keyboards, mice, microphones, webcams, graphics tablets, trackballs, barcode readers, gamepads, joysticks, scanners, electronic whiteboards, optical mark readers, optical character readers, and magnetic ink character readers. Output devices include monitors, printers, projectors, and speakers. And some devices are both input and output devices, such as USB drives, modems, CD-RW drives, touch screens, and headsets. When writing a Python program that accepts user input (like input from a keyboard) or produces output (like printing text to the console), you're interacting with these I/O devices.
Hardware & Python
As a Python programmer, it is essential to understand how your program will interact with hardware. A Python program runs on the CPU, uses RAM to store temporary data, reads from and writes to storage, and interacts with I/O devices. If your program is running slowly, it might be because it is performing complex calculations that the CPU cannot handle, or it may be using more RAM than is available, causing the operating system to swap memory to and from disk, which is slow. Conversely, understanding hardware can help you improve your Python programs. For example, if you know you are working on a multi-core CPU, you can use Python's multiprocessing module to execute multiple processes in parallel, potentially making your program faster.
I call this section an (In)Conclusion because the concepts provided on this page is just the beginning. There are many other details we could explore about programming in general, the tools and environments programmers use to write and manage software, and other topics. For now, this has been a good introduction. We will learn more throughout this book. For now, let's turn our attention to Python.