XGB: Computer Programming and Software Development
This page is designed to be a portal to another website that will eventually contain many tutorials and "white papers" describing in detail some computer programming projects taken on by XGB Design, along with source code listings for each project. For the time being there is one project on tap, and it's a big one: an extensive seven-part tutorial demonstrating creation of a C++ program that implements a simple but powerful command-line calculator called The Tiny RPN Calculator. (You can also access this project by clicking on the image at left.) Seven drafts of the program are presented here, each draft showing how the calculator can be extended using object-oriented techniques in C++. It's hoped that both student and professional programmers will enjoy surveying this project.
Recent Excursions in Haskell Programming: I make no secret of the fact that Haskell is rapidly becoming my favorite programming language. It's elegant, it's concise, it's tidy (no curly braces, no semicolons, no parentheses around function para- meters, etc.), and it's deep, and profound. It can be used to explore theoretical concepts, and also as a "real-world" lan- guage. It has numerous constructs that make it extraordinarily friendly to logicians and mathematicians. You can run Haskell in an interpreter, and compile into executable code. You can port your executables to Mac OS, Linux, Unix, and Windows without modifying your code, just by getting the edition of the Glasgow Haskell Compiler that works with your OS. (GHC can also generate C code as an intermediate target for porting to yet other platforms.) For most applications, Haskell programs run extremely fast, both in the interpreter and in compiled executables, and appear to suffer little or no performance penalty compared to C++. Though more than twenty years old now, Haskell seems light-years ahead of its time, and light-years ahead of other languages used more widely in industry, such as Java and C++.
I still have much to learn where Haskell programming is concerned, yet I've begun posting some code snippets to illustrate some of the basics of Haskell's feature set. The programs you see here exploit a variety of Haskell's properties while using mostly straighforward, out-of-the-box notions presented in the Standard Prelude (i.e., there are very few imports). You'll see anonymous functions and lambda notation; putting functions in a list, and invoking them by number rather than by name; plus function composition, sections and partial function application, some folds, some point-free style, and "nice IO." In time I will publish "white papers" for each of these programs. If you are not a Haskell programmer (yet), and are accustomed to programming in an imperative language such as Java or C++, beware: for as you examine these programs, you may become amazed, or appalled—or even apoplectic—when you discover what a ridiculously small amount of code is required for each of these applications!
A Simple Yet Flexible Password Generator in Haskell: This program implements a powerful password generator using very little code. The user can specify any of 15 different character configurations, including upper-case and/or lower-case letters, and/or numerals, and/or symbols from the keyboard. The user also specifies the number of passwords to generate, and the password length. The program outputs a two-dimensional array of passwords, arranged in rows of five across.
Creating Solution Sets of Functions in Haskell: This program chiefly exercises higher-order functions, and extensive list-processing, in Haskell. The objective is to select from a number of mathematical functions on the Cartesian coordinate plane; specify a domain for the function chosen; and output a neatly formatted solution set for the given function and domain.
A Simple Engine Specification Program in Haskell: This is another "real-world" application that calculates the displacement of a reciprocating-piston engine, given the number of cylinders, bore, and stroke. It also allows users to "design" an engine by specifying the number of cylinders, the desired displacement, and desired bore/stroke ratio. The program then returns close approximations of these data plus the bore and stroke that fit these specifications. The program works with both metric and English units of measurement.