PRACNIQUES (programming case studies)

A pracnique is similar to a case study, derived from “practical techniques”, and homage to the early Communications of the ACM column. In the first issue of CACM, it was described as “techniques contributed be factual and in successful usage, rather than speculative or theoretical” [CACM 1(1) (1958)]. One of the criteria for acceptance of pracniques was “can the reader use this tomorrow?”.


  • Making Espresso–This pracnique explores how to design a simple algorithm to make espresso.
  • Making Tea –This pracnique explores how to design a simple algorithm to make tea, and how the algorithm can be refined. The algorithm is expressed using a flow diagram.


  • Calculating Pi – Re-engineering a vintage Fortran program (1966) to calculate the value of π. (code)
  • Day of Year – Re-engineering a F77 program that calculates the Day of Year (DOY). (code)
  • Prime Numbers– Re-engineering a legacy Fortran program to calculate prime numbers.  (code)
  • Roman Numerals – Re-engineering a legacy Fortran program to calculate Roman numerals. (code)
  • Towers of Hanoi – Re-engineering a program to derive a non-recursive solution to the Towers of Hanoi puzzle. The program was originally written in Fortran77 in 1984. (code)
  • Exact Rates of Return – Re-engineering of a program to calculate exact rates of return in Fortran. The program was written in Fortran II in 1966, and contains numerous legacy artifacts. (code)
  • Rock, Paper, Scissors – Re-engineering of a Fortran program to play rock-paper-scissors.


  • Easter Sundays – Re-engineering a Cobol program from 1962 which calculates the date of Easter Sunday


These pracniques go through various techniques involved with programming in C. That are at a variety of levels, from novice, to advanced.

  • Airflow in buildings – A program to calculate the rate of airflow in buildings given the area of inlets, wind velocity and ratio of outlets to inlets. (novice)
  • Anagrams – A program to create string permutations without the use of recursion (generate all permutations from a series of four letters). (intermediate)
  • As the crow flies – A C program to derive the distance  between two points (novice)
  • Dew-point – A program to calculate dew-points with appropriate defensive programming mechanisms. (novice-intermediate)
  • Dinosaur Eggs – Designing and implementing a program to count the number of dinosaur eggs in a cache of egg fragments. It involves designing a sub-algorithm for the part of the program which calculates the surface area of an egg. (novice)
  • Einstein’s Number Trick – Testing a program designed to perform Einstein’s Number Trick. The testing involves designing defensive programming strategies. (novice-intermediate)
  • Folding Paper – Designing a simple program to implement an equation which calculates how long a piece of paper needs to be to makes n folds.(novice)
  • Footprint of a newspaper – A program to calculate the ecological footprint of a newspaper. (novice).
  • Footprint of a Wind Farm – This program  estimates land-area requirements for wind power systems. (novice)
  • Game of 15 – Storing and manipulating a series of numbers using simple variables, arrays and strings. (intermediate)
  • Height of the Eiffel Tower – A C program to calculate the difference in height of the Eiffel Tower due to thermal expansion (novice)
  • Ice Skating Scores – A program to calculate interquartile means. It uses a series of functions including a simple Bubblesort to sort the numbers.(arrays, loops, functions) (intermediate)
  • Jumbled Words – Program to solve a word jumble using word permutations and a dictionary file. Using the letters in the jumble, they are unscrambled by deriving all the word permutations and then searching for valid words in a dictionary. (advanced)
  • Retrofit Furnace Sizing – A program to calculate optimal size for a retrofit furnace in a house using climatic data for a particular region and gas consumption. (intermediate)
  • Skeleton of a Mastodon –  A pracnique to determine whether a  program is running properly by means of testing it, and determining where the logic errors are. (novice)
  • Snow Density – A program to calculate the snow density given water equivalent and snow depth. (novice)
  • Snow Water Equivalent – A program to calculate the snow density given water equivalent and snow depth. (novice)
  • Spoilage Probability – This pracnique explores style, usability and correctness of a program, by reviewing a program that lacks all these features and re-building it. (novice)
  • Newton’s Square Root – A program to calculate a square root using Newton’s formula. A program with no functions is transformed into one with a function called SQRT. (novice-intermediate)
  • Two Means – This pracnique looks at how easy it is to miss logic errors – here the difference between arithmetic and geometric means. (novice)
  • Wind chill – A C program to calculate the wind chill factor. The program is then refined by adding defensive programming, and modularized to use functions. (novice)
  • Yorkshire Estates – This pracnique describes the process of deriving a program to solve “The Yorkshire Estates” problem, described in “The Canterbury Puzzles”. (novice)
  • Programming style  – This pracnique looks at how the aspects of style can affect a program (novice)


  • Escape Velocity – An Ada program to calculate the escape velocity from the surface of a moon or planet.
  • Ice Thickness – An Ada program to calculate ice thickness.
  • Luhn’s Algorithm – An Ada program to perform Luhn’s Algorithm to validate a number.
  • Typing Monkey – An Ada program to simulate the Typing Monkey problem.
  • Soundex – An Ada program to calculate the Soundex code of a word.


  • Deck Flex – A Fortran program to calculate the flexural deflection in a deck, given a particular material.
  • Railway Gradients – This pracnique explores how to design a simple program to calculate the force required to move a train up a particular grade.
  • Integer Multiplication – This pracnique explores how to design a simple program to perform multiplication using only addition, doubling and halving.
  • Calculating Shelf Deflection – This pracnique involves creating a program to calculate approximate shelf loads – visualized through the amount of deflection or sag in the shelf.


  • Rule of 72 – This pracnique looks at writing a Cobol program to calculate the Rule of 72, which is a method for estimating an investment’s doubling time.


  • Pascal’s Triangle – This pracnique involves viewing various algorithms to derive Pascal’s Triangle in Fortran, C and Python.
  • Newton’s Square Root – This pracnique derives a square-root of a number using Newton’s algorithm, and compares its implementation in six programming languages: C, Fortran, Ada, Julia, Python, Pascal.
  • The Evolution of Fortran – This pracnique explores the quadratic equation in Fortran I, a Fortran 77, and a Fortran 90/95)
  • Julian Dates – This pracnique is a Gregorian to Julian conversion implemented in Fortran, Ada, Cobol, C and Python.
  • Wind Chill Factor – This pracnique calculates the wind chill factor in Fortran, Ada, Cobol, and C.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.