Hello, World!

This document describes a number of programming problems one might attempt while learning a new programming language. Some of the programs are short and simple, whereas others would be major projects for even highly experienced programmers.

Each program is qualified with an estimated "difficulty" rating consisting of one star (for easier programs) to three stars (for very complex programs). The difficulty is based on estimated time required to develop the software as well as the background and experienced required by the programmer.

Be aware that even "easy" programs can be made difficult by setting higher standards for yourself. If a program seems too easy try adding some, most, or even all of the following:

Similarly "difficult" programs can be made easier by cutting corners in the above areas. Also the difficulty of a programming problem can be strongly affected by your choice of programming language and supporting tools. Every language tends to be good at certain kinds of programs; if you attempt a program well suited to your tools it will be correspondingly easier (and conversely if you attempt a program that is unnatural for your tools it will be correspondingly harder). Take the ratings below with a large grain of salt!

Keep in mind also that there is more to learning a programming language than just learning the syntax and semantics of the language itself. There are also libraries and tools to learn. This includes documentation generators, test generators, debuggers, profilers, RAD tools, and various static analyzers. When experimenting with the programs below, don't forget to experiment with the available libraries and tools as well.

Simple Exericses

This section contains programming problems that tend to very short. They are intended to be the sort of exercises you can do when first starting to learn a new language. If you want to make them harder/longer consider the list given in the previous section.

Abstract Data Types

Implementing the classic algorithms and data structures, such as those appearing in any text on the subject, is often a good way to gain experience with a programming language. Use whatever facilities your language has to support data hiding and encapsulation or generic programming to build components following good software engineering principles. Consider for example lists, trees, hash tables, and graphs as fodder for interesting programming exercises. **

Date/Time

Build a library component that provides a date and/or time abstract type. To avoid conflict with any similar library components provided by the language, be sure to put your component in a separate module (if possible). Provide support for the "usual" operations on dates and times. **

Additional features:

Integers

Integers are basic computational units and many programming languages provide special support for them. These problems help you to explore the features your language has for integer operations, including low level operations such as bit manipulation.

Extended Precision Integers

Build a library component that provides extended precision integers. Provide support for the "usual" operations. Use overloaded operators if supported by the language. **, but if you also provide extended precision division the difficulty might increase to ***

Additional features:

Primes

Write a library, a program, or a set of programs to compute "interesting" results pertaining to prime numbers.

Additional features:

Numerical Problems

These problems would be appropriate for languages that feature good support for numerical computations. Note that numerical languages may already have built in support for these problems. If so, you might write an solution that uses such support as well as a solution that does not and then compare the two solutions, for example in terms of runtime efficiency.

Some general issues to consider include:

Taylor Series

Write a library that computes various transcendental functions using their Taylor Series expansions. Also, provide a function for efficiently evaluating polynomials. As an extension consider computing error estimates. **

Numerical Integration

Write a useful numeric integrator library component. Your component should take a function as an argument using whatever mechanism the language provides. As an extenstion consider providing support for integrating functions with more than one argument (multi-dimensional integration). ** or *** depending on the methods used.

Linear Algebra Library

Write a library component to support a collection of matrix operations. Consult a text on linear algebra for some ideas of what operations should be supported. Optimize your library for speed. ***

This problem gives you an opportunity to experiment with your language's facilities (if any) for operator overloading and specialized array manipulations.

Full Applications

These problems ask you to write full applications. They can be simple or expanded into major works. This gives you an opportunity to explore your languages facilities for programming in the large. It also gives you practice using the features of your language in an integrated manner.

Filter Programs

Write a skeleton filter program (that processes stdin to stdout) and then use that skeleton to build various filters.

Binary File Viewer

Write a program that allows the user to view the contents of a file as a sequence of hex values. If your programming environment provides support for a graphical interface, consider building a GUI tool. Your program should accept the name of a file as input in some suitable way and display the file's contents appropriately. * to *** depending on features implemented.

Additional features to consider:

Multimedia File Information Utility

Write a program that accepts an image or video file and outputs information about that file. This problem requires your program to read and interpret the raw binary data in the file's headers. **

Datebook Manager

Write a program that manages a personal datebook. If your programming environment provides support for graphical programming, consider building a GUI. In any case your program should support command line operation so that it can be easily integrated into shell scripts or batch files. ** to *** depending on features implemented.

Computational Models

Programming languages provide support for the abstract models of computation described by the theory. Implementing simulators for these models of computation prove, by demonstration, the expressiveness of the programming language.

Automaton Simulator

Write a program that simulates the operation of a deterministic finite automaton. The program should accept a machine definition and the input data in some suitable way (try to make it as generic as possible, but you might start by writing a program that simulates a particular machine first). Modify your program so that it simulates a non-deterministic machine. This might be a good way to demonstrate concurrency features. Extended the program so that it can simulate a push-down automaton (PDA). ** to *** depending on features implemented.

Turing Machine Simulator

Write a program that simulates a Turing machine. Doing this proves by demonstration that your programing language is Turing complete. Extend your program so that it simulates a non-deterministic machine, a machine with multiple tapes, or any of several other Turing Machine variations that have been described. ** to *** depending on features implemented.

Lambda Calculus Calculator

Write a program that reduces lambda terms. Doing this also proves by demonstration that your programming language is computationally complete. This program also gives you an opportunity to explore building parsers in your programming language. ***


Last Revised: 2014-09-29
© Copyright 2014 by Peter C. Chapin <pchapin@vtc.edu>