Photo by Luca Martini on Unsplash

In this series of articles, Learning TypeScript, I am going to document my experience learning the TypeScript programming language. TypeScript is a superset of JavaScript that provides a stricter type system than JavaScript, providing less opportunities for data typing errors, such as when you accidentally try to multiple a number by a string or some other mismatching of data types.

In this article I am going to show you how to get TypeScript installed on your computer and how to write some simple programs using TypeScript. …

Photo by Priscilla Du Preez on Unsplash

In this article I’m going to demonstrate another way to implement the Input and Process Until Done template using the do-while statement. The major difference between the while statement and the do-while statement is that with the do-while statement the condition is tested at the bottom of the loop instead of at the top as it is with the while statement.

The Input and Process Until Done Template Review

Here is the pseudocode for this template:

Repeat the following until finished:
Read a value
Process the value

An example, which I’ll demonstrate using a do-while statement below, is to determine the average grade on a test by inputting…

Photo by Nareeta Martin on Unsplash

In this article, I discuss the next major construct in C — the loop. I’ll start by introducing a new program template related to loops, the Input and Process Until Done template, and then I’ll demonstrate how to implement this template using one C looping construct — the while statement.

The Input and Process Until Done Template

One of the most common things you do in a computer program is repeatedly as the user for data and process that data until there is no more data to input. The Input and Process Until Done template provides an outline for how to write the code for this task.

Get to know the classic programming paradigm that’s still relevant today

A photographic still life of common household items.
A photographic still life of common household items.
Photo by Joanna Kosinska on Unsplash

This is the fourth of a series of articles on programming styles in JavaScript. I’ve previously covered the monolithic, cookbook, and pipeline styles. This article introduces the most prevalent programming paradigm today — the object-oriented (OO) style. For this article, I’ll demonstrate one common substyle of OO — programming with objects.

As with my previous articles, I’ll be counting the frequency of words used in the classic essay “A Modest Proposal” by Jonathan Swift.

What Are Objects?

If you’ve taken a programming course in high school or college, or keep up with the programming literature, you’ve already been introduced to the concept of…

Photo by Clay Banks on Unsplash

This is the second part of a two-part series on implementing the Select from Alternatives template in C. In this part I’ll discuss nested if statements, the Boolean operators, and the switch statement.

Nested if Statements

Sometimes, you need to nest if statements inside other if statements to best express the logic of a program solution. This can be a tricky technique and you need to approach nested if statements carefully and debug them thoroughly.

When I talk about nested if statements I’ll refer to an outer if and inner if statements. …

Photo by Dulcey Lima on Unsplash

There is much controversy about the proper footfall when running. Some experts say it’s best to land on your forefoot. Other experts say you should land on your midfoot. And while not many experts say it’s OK to land on your heel, some experts say that heel striking really isn’t so bad.

I am currently reading a book titled, The Lost Art of Running by Shane Benzie and Tim Major. Benzie is a running coach whose expertise is running form. In his book, he writes about every aspect of running form but I am…

Write better functions by adopting this programming style

Two pipes
Two pipes
Photo by Michal Matlon on Unsplash

In my last article on programming styles in JavaScript, I discussed and demonstrated the Cookbook style. In this article, I’ll discuss the Pipeline style and demonstrate how to use it to write a program that computes the word frequency from the text A Modest Proposal by Jonathan Swift.

This article and my previous articles are all based on the book Exercises in Programming Style by Cristina Videira Lopes.

The Pipeline Style Defined

The best analogy for the Pipeline style is a factory pipeline, such as the ones used in the automobile industry. Cars are assembled piece by piece along a “conveyor belt” where there…

Make your code easy to read

Mise en place for cooking
Mise en place for cooking
Photo by Icons8 Team on Unsplash.

In a recent article, I discussed how to write a word frequency program in JavaScript using a monolithic programming style. In today’s article, I’m going to move to a completely different style — the Cookbook style — to write a word frequency program.

If you are interested in learning more about programming styles, I highly recommend the book that is the inspiration for my articles: Exercises in Programming Style by Cristina Videira Lopes.

The Cookbook Style

The monolithic style of programming involves writing a complete program using no functions, no procedures, or any other tool or technique for modularizing the program. The Cookbook…

Photo by Dollar Gill on Unsplash

One of the most important program templates you can learn is the Select from Alternatives template. This template is used when a program needs to make decisions about what code to execute by choosing among different alternatives. An example of this is a payroll program that has to decide whether to pay an employee straight time or overtime based on the number of hours the employee worked during that pay period.

The Select from Alternatives template is implemented using one of two C constructs. In this article I’ll discuss the first of these constructs — the if statement. …

Photo by Priscilla Du Preez on Unsplash

In this article I’ll introduce you to C’s arithmetic operators along with some other operators that make programming in C easier. I’ll start with arithmetic. At the end of the article, I’ll write two programs that utilize the Input, Process, Output template to demonstrate what was covered.

The Arithmetic Operators

C’s arithmetic operators are:

  • + for addition.
  • - for subtraction.
  • * for multiplication.
  • / for division.
  • % for modulus.

These operators have an order of precedence where modulus, division, and multiplication have a higher precedence than addition and subtraction. You can modify the order of precedence by using parentheses, which have the highest…

Michael McMillan

Mike McMillan writes about computer programming and running. He is setting up his new web site at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store