☰
Python Across Disciplines
with Python + AI Tool   
×
Table of Contents

1.1.   Introduction 1.2.   About the Author & Contact Info 1.3.   Book Conventions 1.4.   What (Who) is a Programmer? 1.5.   Programming Across Disciplines 1.6.   Foundational Computing Concepts 1.7.   About Python 1.8.   First Steps 1.8.1 Computer Setup 1.8.2 Python print() Function 1.8.3 Comments
2.1. About Data 2.2. Data Types 2.3. Variables 2.4. User Input 2.5. Data Structures (DS)         2.5.1. DS Concepts         2.5.2. Lists         2.5.3. Dictionaries         2.5.4. Others 2.6. Files         2.6.1. Files & File Systems         2.6.2. Python File Object         2.6.3. Data Files 2.7. Databases
3.1. About Processing 3.2. Decisions         3.2.1 Decision Concepts         3.2.2 Conditions & Booleans         3.2.3 if Statements         3.2.4 if-else Statements         3.2.5 if-elif-else Statements         3.2.6 In-Line if Statements 3.3. Repetition (a.k.a. Loops)         3.3.1  Repetition Concepts         3.3.2  while Loops         3.3.3  for Loops         3.3.4  Nested Loops         3.3.5  Validating User Input 3.4. Functions         3.4.1  Function Concepts         3.4.2  Built-In Functions         3.4.3  Programmer Defined Functions 3.5. Libraries         3.5.1  Library Concepts         3.5.2  Standard Library         3.5.3  External Libraries 3.6. Processing Case Studies         3.6.1  Case Studies         3.6.2  Parsing Data
4.1. About Output 4.2. Advanced Printing 4.3. Data Visualization   4.4  Sound
  4.5  Graphics
  4.6  Video
  4.7  Web Output
  4.8  PDFs & Documents
  4.9  Dashboards
  4.10  Animation & Games
  4.11  Text to Speech

5.1 About Disciplines 5.2 Accounting 5.3 Architecture 5.4 Art 5.5 Artificial Intelligence (AI) 5.6 Autonomous Vehicles 5.7 Bioinformatics 5.8 Biology 5.9 Bitcoin 5.10 Blockchain 5.11 Business 5.12 Business Analytics 5.13 Chemistry 5.14 Communication 5.15 Computational Photography 5.16 Computer Science 5.17 Creative Writing 5.18 Cryptocurrency 5.19 Cultural Studies 5.20 Data Analytics 5.21 Data Engineering 5.22 Data Science 5.23 Data Visualization 5.24 Drone Piloting 5.25 Economics 5.26 Education 5.27 Engineering 5.28 English 5.29 Entrepreneurship 5.30 Environmental Studies 5.31 Exercise Science 5.32 Film 5.33 Finance 5.34 Gaming 5.35 Gender Studies 5.36 Genetics 5.37 Geography 5.38 Geology 5.39 Geospatial Analysis ☯ 5.40 History 5.41 Humanities 5.42 Information Systems 5.43 Languages 5.44 Law 5.45 Linguistics 5.46 Literature 5.47 Machine Learning 5.48 Management 5.49 Marketing 5.50 Mathematics 5.51 Medicine 5.52 Military 5.53 Model Railroading 5.54 Music 5.55 Natural Language Processing (NLP) 5.56 Network Analysis 5.57 Neural Networks 5.58 Neurology 5.59 Nursing 5.60 Pharmacology 5.61 Philosophy 5.62 Physiology 5.63 Politics 5.64 Psychiatry 5.65 Psychology 5.66 Real Estate 5.67 Recreation 5.68 Remote Control (RC) Vehicles 5.69 Rhetoric 5.70 Science 5.71 Sociology 5.72 Sports 5.73 Stock Trading 5.74 Text Mining 5.75 Weather 5.76 Writing
6.1. Databases         6.1.1 Overview of Databases         6.1.2 SQLite Databases         6.1.3 Querying a SQLite Database         6.1.4 CRUD Operations with SQLite         6.1.5 Connecting to Other Databases
Built-In Functions Conceptss Data Types Date & Time Format Codes Dictionary Methods Escape Sequences File Access Modes File Object Methods Python Keywords List Methods Operators Set Methods String Methods Tuple Methods Glossary Index Appendices   Software Install & Setup
  Coding Tools:
  A.  Python    B.  Google CoLaboratory    C.  Visual Studio Code    D.  PyCharm IDE    E.  Git    F.  GitHub 
  Database Tools:
  G.  SQLite Database    H.  MySQL Database 


Python Across Disciplines
by John Gordon © 2023

Table of Contents

Table of Contents  »  Chapter 1 : Preliminaries : What (Who) is a Programmer?

What (Who) is a Programmer?

Subscribe Contact


Contents

Overview

Computer programming is a process used to write instructions (commonly called code) for a computer to follow to complete tasks or solve problems. These instructions are written in diverse programming languages, each with its unique syntax and applications, solve a set of steps. The set of steps created to get the solution is called an algorithm. Algorithms serve as blueprints that guide the computer through the necessary steps to achieve a desired outcome (task completion, problem solved, etc.). Given all of this, what does it mean to be a "programmer?" And, who is, or who can be, a programmer? Can you be a programmer?

On the surface, the answer to the questions above may seem obvious; it depends on how strict of a definition we choose. A commonly held definition of a programmer is someone who writes code for a living and has a job title like Computer Programmer, Software Developer, or Software Engineer. What about others? Can a person be a programmer without earning money from it? And if not for income, why would someone invest the time and energy to learn to write code without the end goal of making money from it? It is important to consider these questions because they may help inform your own questions: Why are you studying programming? What is your end goal? Can you be successful in learning and using programming for your purposes? Let's consider some things that might help answer these questions and also try to dispel some myths about programming, especially for those who are not studying Computer Science or STEM or who might be doubting the usefulness of studying programming for themselves.

What (Who) is a Programmer?

I have an acquaintance, T, who has a degree in Computer Science. Her job title is Software Engineer (which is an advanced level of the computer programming profession), it is what she does for her employer each day, and the way she earns her living. I think T is a programmer because she fits the commonly held definition suggested above. I have another acquaintance, S, who works at Walmart. Her job there is as an Optical Technician in the Optical Center, and that is how she earns her living. However, to me, S is also a programmer. Why? Because she knows how to write code in a programming language to solve problems. S attended a coding boot camp some years ago independent of her Walmart job. A third acquaintance, D, has a Ph.D. in English and teaches literature at a university. I consider him a programmer as well. He has no formal training in Computer Science or programming, but he learned coding independently because he needed the skills to reach some of his research goals. Lastly, A is another acquaintance who is retired. He also has no formal computer programming education or work background but he took up programming to support his hobby of Model Railroading. I consider all four of these people programmers even though only one has formal programming training and earns a living in that field.

Would you agree that all of these people are "programmers"?

Author, speaker, and programmer Linda Liukas  suggests that "everyone is a programmer." She argues that programming is about solving problems by creating or using algorithms. She reminds us that algorithms are not just used in computing; we use algorithms in everyday life. For example, the steps to tie your shoes are an algorithm (a set of steps). Others include recipes to cook or bake food, the steps you follow to start your car, to order products online, and many other everyday daily tasks. Liukas suggests that because we all encounter tasks and problems that we must complete and solve, we are all programmers.

Would you agree with Linda?

Myths

So, can anyone (you) become a programmer? To answer this, I contend that we must first shed the notion that a "programmer" is someone who writes code professionally for their income. Becoming a professional programmer may or may not be your goal, either way, my answer to that question is, yes, anyone (you) can become a programmer. This is analogous to saying anyone can be a musician. That does not necessarily mean everyone who learns to play a musical instrument or sing wants to, or even could, earn their living through music. With the willingness and investment of time practicing, anyone (including you) can be a programmer (or a musician, or anything you choose to pursue).

There are stereotypes surrounding programmers based on myths and misconceptions about the field and those who pursue programming as a profession. Here are a few of them:

These myths often come from stereotypes and a lack of understanding of the diverse and ever-evolving field of programming.

Characteristics that Benefit Programming

I have seen many lists published and posted that suggest specific characteristics a person should (some say "must") have to be a "good" programmer. I hesitate to say or suggest the same. There are characteristics that help succeed in learning programming, which are also attributes that help with day to day life as well. The good news is that any of these can be improved upon as needed.

Crossing Lines

Learning and becoming proficient with any subject is a matter of step-by-step progression. Whether you have some background in the topic, you start with that background (including "none"), and you learn pieces of the subject a bit at a time. As you progress, you approach your proficiency goal one step at a time. As you go, your knowledge of the subject expands. I visualize this progression as a set of lines (you could formalize this and call them intermediate goals). This visualization might look something like this:


Figure 1: Student progression while learning a subject.


Figure 1: Students progression while learning a subject.


Figure 1. indicates that students begin learning a subject at some point, depicted as the first (bold) vertical line. That point is likely different from person to person; one person may have some background or familiarity with the subject, while another may have absolutely none. In either case, each person begins at their starting point, and then, as they study and practice, they move their skill and knowledge forward, crossing lines as they reach milestones in their learning process.

Learning programming fits this model very well. As mentioned previously, programming is about solving problems using a computer, hardware, software, and a programming language to create solutions. This means that the knowledge needed to be a programmer relies on far more than just the syntax of a programming language (another misconception). By the time you have reached this book, you have already acquired some knowledge of computers, hardware and software, the Internet, and possibily some knowledge of programming as well. You have some degree of proficiency with each of those topics ("none" is perfectly acceptable in this case). From that point, as you proceed through this book (combined with the exploration of other materials and practice), you cross lines as you progress.

The rate at which you progress in crossing those lines is personal and individual; it is based on your background knowledge, aptitude, perception of the learning materials, the amount of time you dedicate to studying and practicing, etc. Given this, it is essential to recognize that your progression will differ. The rate you progress and the challenges you face will not be the same as anyone else. For example, a group of students starting a programming course may appear to start at the same point, as depicted in Figure 2.:


Figure 3: Programming Concepts Progress


However, it is more realistic to depict students as seen in Figure 2. Some students may have significant background knowledge in computers, software, programming, etc. (Student 4), while others may have very little background knowledge (Student 2). It is important to realize that both of these students will make progress as they continue to study and practice; they are just starting at a different point. The important factor is that each student makes progress and crosses lines at their own pace.) It's also essential for students not to compare their progress to others.



Figure 2: Students of programming progress at different rates.



Concepts First, Syntax Second

I have taught programming to hundreds of people in workshops, corporate training sessions in industry, and college classrooms. I'll let you in on a little secret the biggest mistake I see students (and employed programmers) make is that they go straight to writing code and focus all their attention on getting the syntax of their code "right" instead of understanding the problem and the concepts to solve the problem first. Unfortunately, a lot of programming instruction supports this mistake by placing the majority of the pedagogical focus on syntax in their assignments. This approach is a mistake because anyone can get perfectly functional code these days simply by searching Google, Stack Overflow, or using AI tools like ChatGPT or CoPilot. But, if you don't understand the problem, you will likely produce code that functions fine but doesn't solve the problem. You can find the code examples (the syntax), copy them, and run them to find something functional. However, if it doesn't solve the problem, then, not only have you not really learned much about solving that particular problem, you're not fulfilling the requirements. This is where Concepts First, Syntax Second comes in.

Let's consider a scenario...

A student, Bob, is in his Python for Beginners class, and the next assignment says the following:

Write a program that performs a binary search on the following list:
["Joe", "Bob", "Sid", "Liz", "Rob", "Eli", "Ben", "Rex", "Jay", "Cal"]
Bob does not really understand what a binary search is, how it works or how to write one in Python. He feels compelled to have "perfect" code, or the course he's taking demands it, so he opens ChatGPT and copies and pastes the assignment prompt into the Chatbot, and it gives him the the code for a solution. Then Bob copies the code from ChatGPT into his code editor and runs it. It works. He reads the copied code and thinks, "Oh, yeah, I get it," and turns in this code for the assignment.

This example may seem contrived and unlikely, but it happens frequently in programming classes. The pressure for good grades, limited time, and a dose of procrastination leads to this scenario quite often. Yes, grades are important, but the downside is that Bob really has no actual understanding or concept of how to solve this programming task, how to translate the problem into code, how to produce the code he copied code, how it actually works, how it relates to the real-world, and most importantly, cannot reproduce this solution on an exam or in a job interview without the crutch of a tool like ChatGPT. What is another way of approaching this scenario?

Concepts First

The first piece of advice I would give Bob is to slow down. That may sound counter-intuitive because time is always at a premium, but putting concepts first requires time investment up front, before any code is written (or searched for). How might Bob approach this problem without using an online search or asking a chatbot first? He should relate the problem to something tangible to associate the assignment prompt with something real. The assignment provides a list of names to search. What is this analogous to in the real world? A real-world conceptual example would be looking for a word in a dictionary. Dictionaries are in alphabetical order and when you need to find a word how do we usually find the word we're looking for? The common approach would be to open the dictionary to some arbitrary page approximately in the middle and look at the words on that page. Because we know the alphabet we can determine if the word we are looking for is earlier in the dictionary or later in the dictionary. Then we decide if we need to continue searching in the firat part of the dictionary or the second part. We then repeat these splitting and checking steps until we find the word.

Bob may not have thought of all of these things himself, that's where research (reading, books, blogs, videos, class, etc.) comes in to help him learn and understand the concepts before using a tool to generate code for him. This is not to say that a person learning programming should not use the tools available to help them learn. I am all for using any tool that will help in that endeavor. It is when tools are used in place of actually learning the concepts that will allow a person to find a solution and fully understand it simultaneously.

Conclusion: You have already crossed a line

If you knew nothing about programming before you started this book and read these first few pages, then you have already crossed a line. If you already have some programming background, and have read these first few pages, you have crossed a line too. In both cases, you either know more about programming, or have begun adding to your knowledge, than you did before you started this book. In either case, you decided to venture into this book (class), and there is likely already something you did not know before or had not heard the same way before. This is why I openly deny that this book is the best, the only, or most comprehensive about programming or Python. It's not and I argue that no book can truly claim any of those monikers. Programming itself is too vast a topic for any book to cover everything so I recommend exploring as many books, blogs, videos, etc. about programming and Python you have time for as you learn. All of them will help you cross lines in your progression.



 






© 2023 John Gordon
Cascade Street Publishing, LLC