Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Community Voices

Dr. Dobb's Bloggers

Thinking Forth

November 05, 2009

Back in 1998, DDJ Contributing Editor Tim Kientzle was thinking back to 1984 and Thinking Forth, Leo Brodie's classic text specifically concerning Forth and more generally concerning programming best practices. As you'll see if you read on, some things never change...

Extreme Forth

by Tim Kientzle

Tim revisits Leo Brodie's classic Thinking Forth and realizes it foreshadowed modern day topics such as Extreme Programming and Best Practices.

I've had a number of conversations recently about Extreme Programming (XP). Although many people seem to share my distaste for the name, I've encountered remarkably little controversy about the ideas themselves.

Ultimately, XP is just a collection of best practices, many of which have been around for decades. I recently reread Leo Brodie's 1984 Thinking Forth: A Language and Philosophy for Solving Problems, which covers many of the same ideas, but in a different fashion. Still, Thinking Forth provides a thought-provoking counterpoint to newer writings.

First, Make It Work

Thinking Forth is very much a book of best practices. Brodie started by interviewing the best software developers he could find. He then mixed extracts from these interviews with his own commentary and short, to-the-point tips, such as this gem:

Tip: Today, make it work. Tomorrow, optimize it.

This statement has been my software-development mantra for nearly two decades now, and it echoes clearly through much of the XP literature. Software development is, after all, about solving problems. Working code must always be the first priority.

A more subtle issue is also involved here. Working code provides you with positive feedback and encouragement, which makes it less intimidating to take the next step and thus leads to improved productivity. This is a key idea both in XP and in Brodie. One of Brodie's interviews even refers to the "fun-down approach" of software development-start where you will get the most immediate gratification.

Second, Make It Work Well

But working code is merely the first step. XP's "refactoring" is more than simply a cookbook list of code transformations. It is a fundamental dictum that improving code is not just a matter of adding features.

Brodie explores this idea in detail: An entire chapter is devoted to "Factoring," and another discusses the merits of prototyping and iterative design. Few XP treatises could hope to do better:

Tip: Look for repetition of patterns.

Tip: Don't change too much at once.

Tip: Be sure you can name what you factor.

The interviews are especially helpful here. Chuck Moore, for example, urges you to challenge your solutions: "You need a feeling for the size of the problem...When you're done, look back and say 'Did I come up with a solution that is reasonable?'" If your result seems out of touch with your intuition, maybe you haven't yet found a good solution:

Tip: You don't understand a problem until you can simplify it.

Brodie uses a variety of somewhat contrived textbook examples to illustrate his ideas, but these are the book's weak point. They also require you know Forth.

Forth Matters?

Knowing Forth is not a remarkably marketable skill these days. Forth's compact size and portability are less important now than they once were. Forth's very weak type- and syntax-checking are also drawbacks, as are its somewhat unusual syntax. Forth is still in use, but it is becoming much more of a niche language.

Even if you never use Forth, however, you might benefit from studying some of its features. For example, all of the internal code used by the Forth interpreter and compiler is available to application developers. This simple idea has many benefits-it exposes a complete standard set of tools, it lets you extend the environment and language in deep ways, and it enables some very advanced development paradigms.

Forth's interactive development model is also very appealing: A Forth system encourages you to type in and test a line of code, then add it to the application once you are certain it is right. This kind of short-cycle development, strongly advocated by XP, may be better supported in Forth than in any other language environment.

Thinking Matters

Of course, any programming language is just a tool, and no tool or methodology will make up for carelessness. Brodie's insights, like those of XP, can only provide raw materials for building excellent software development teams. But it is far better to start with ideas that have worked for generations of developers before you.

Thinking Forth: A Language and Philosophy for Solving Problems, Second Edition
Leo Brodie
Fig Leaf Press, 1998
272 pp., $37.50
ISBN 0-13-917576-8

(Reissued in 2004 in Paperback by Punchy Publishing)

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.