Skip to content

What is Programming?

Programming is the process of creating instructions that a computer can understand and execute. These instructions, known as code, are written in programming languages such as Python, Java, or C++. Programming allows us to create software applications, websites, games, and more by providing the computer with a set of rules to follow.

Cumulatively, these instructions comprise a procedure. These instructions operate on information stored in memory and update that information step by step. This is not fundamentally different from a laboratory protocol or an analysis methods section. The difference is that a program must be complete enough that no judgment calls are left to the executor.

Traditionally, one can think of programming as consisting of two primary components:

1. Algorithms
Recipes in natural or psuedo-language for solving specific problems
2. Implementations
The translation of algorithms machine-readable instructions
Baking Cookies

Thinking of programming like making chocolate chip cookies. Our algorithm might be our common-sense recipe for making cookies: putting dough on the tray in the shape of cookies, adding chocolate chips, and baking them in the oven. Meanwhile, our implementation is the exact, specific steps we take using our own kitchen: setting the oven to 350 degrees, baking for 12 minutes, and using a specific type of chocolate chips.

In practice, programming involves three key components:

1. Variables & Data Structures
How relevant information is stored and organized.
2. Control Flow
The logic that determines the order in which specific instructions are executed.
3. Operators, Functions, & Methods
Reusable instructions that perform specific tasks.
Baking Cookies

Continuing with our cookie-making analogy, variables and data structures are like the ingredients we use (flour, sugar, chocolate chips) and how we organize them (in bowls, measuring cups). Control flow is like the sequence of steps we follow in the recipe (1. mixing ingredients, 2. shaping cookies, 3. baking). Operators, functions, and methods are like specific tools & utensils we use (our oven, cookie cutters, mixers).

Programming is best learned by doing.

The best way to learn programming is by writing code. The central intellectual challenge of programming is translating informal reasoning and problem-solving into formal logic and instructions that a computer can execute. This requires practice and experience implementing your own solutions to problems. Much like one can't become a good writer by only reading books, one can't become a good programmer by following examples and reading written code. You must write your own code, make mistakes, and learn your own individual process of problem-solving.

Programming is not about memorizing syntax or specific commands. Instead, it is about developing a mindset and approach to problem-solving that can be applied across many different programming languages and contexts. While memorizing syntax can be helpful and make you more efficient in the extreme short-term, you will be in a much better position if you focus on understanding the underlying concepts and logic of programming.

If you can understand the principles of programming...

  1. You can learn new languages in days instead of months
  2. You can design your own solutions to problems instead of relying on copy-pasting
  3. You will be able to anticipate and debug errors more effectively
  4. You won't be thrown off by the small changes languages introduce year to year
  5. And most importantly, you won't become frustrated or lost when you re-encounter your own code months or years later (especially after taking a long break from programming to write or conduct experiments).