Aug
23

Thinking Forth

I’m reading the downloaded Thinking Forth PDF by Leo Brodie.

The preface to the 2004 edition starts off a bit strange:

  • in the 1984 preface he disses object oriented programming
  • in the 1994 preface he apologizes for that, after having worked a bit with an OO Forth
  • in the 2004 preface he partially retracts his apology and notes that he by no means has sold out in favor of full-blown OO languages, because “there was no need for garbage collection etc” in the OO forth
  • and then he disses Extreme Programming. Some people have noted parallels between Thinking Forth and XP: iterative development, incrementally enhancing code that works, not over-solving the problem. But XP does no conceptual design, from what he’s read about it. He concludes the preface with: “But the irony in comparing Thinking Forth with Extreme Programming is that some developers of the XP stripe (and who of course have never heard about this book) don’t even see the value of a spec! Ah well.“.

Ah well.

But there’s a lot of stuff that resonates (again) with thoughts about DSLs:

An important result of this approach is that the entire application employs a single syntax, which makes it easy to learn and maintain.

In fact, you shouldn’t write any serious application in Forth; as a language it’s simply not powerful enough. What you should do is write your own language in Forth (lexicons) to model your understanding of the problem, in which you can elegantly describe its solution.

And on design:

Forth is a design language… In Forth you can write abstract, design-level code and still be able to test it at any time by taking advantage of decomposition into lexicons… Using this philosophy you can write a simple but testable version of your application, then successively change and refine it until you reach your goal.

How very much unlike design in XP!

And on planning:

Forth programmers spend less time planning than their classical counterparts, who feel righteous about planning. To them, not planning seems reckless and irresponsible. Traditional environments force programmers to plan because traditional programming languages do not readily accommodate change.

The book mixes Brodie’s views with interviews of people using Forth and of Forth’s creator Chuck Moore. The advice they give is often contradictory (plan more, plan less), as each gives the advice that is applicable in their situation. I remember that at the time I first read this book, one of my colleagues (who liked Forth) said he hated the book: “Can’t they make their minds up? They constantly contradict what they said a few pages before!” 🙂

I especially like Moore’s bits. One of the tips is: Don’t write your own interpreter/compiler when you can use Forth’s

Moore explains it thus:

If you write your own interpreter, the interpreter is almost certainly the most complex, elaborate part of your entire application. You have switched from solving a problem to writing an interpreter.

I think that programmers like to write interpreters. They like to do these elaborate diffcult things. But there comes a time when the world is going to have to quit programming keypads and converting numbers to binary, and start solving problems.

Take that you evil purveyors of badly designed programming languages disguised as configuration files or (the horror!) XML files!

Aug
22

Today was a book day

Today was a book day

What did I find on my doorstep today? A big box full of books from Dorset House Publishing.

weinbergQSM1 Inexplicably, most of Gerald Weinberg‘s books are very hard to come by. He has written excellent books about Systems Thinking, the psychology of programming, congruent action, requirements, consulting… His books are required reading. So, I sent off an order directly to the publisher for myself, Laurent, Marko, Vera and Nico.The stack of books sitting now on my desk covers a lot of subjects: productivity, walkthroughs, requirements, systems thinking, measurement, psychology and organisational maturity. The two most ordered books are “The Secrets of Consulting” and “More Secrets of Consulting”.More on a few of those books later.
ruby_on_rails And on top of that box was another book: the paper copy of the Ruby on Rails book I’ve been reading in PDF pre-release form over the past month.We’ve started up development of an application to manage the registrations, payments and communications around the XP Day Benelux 2005 conference. This application uses Rails. We hope to see through the hype and learn if RoR is really so “Agile” as it claims.
Thinking_Forth And then a question about Domain Specific languages made me look up some more information about the Forth language. Forth was (a long long time ago) the first language I used that encouraged the programmer to build domain specific languages. Forth itself is a very primitive and simple language. But it allows you to create slightly higher level language elements or “words”. There is no (visible) distinction between those new words and the built-in words. And then you use those words to build slighly higher level words… Until you end up with a language that makes it easy to develop your application.So I went to look for Leo Brodie, whose books “Starting Forth” and “Thinking Forth” really made me understand this weird language and its even weirder way of programming. I wanted to buy these books for a long time, but they were out of print. And now I discover that “Thinking Forth” can be downloaded from Leo Brodie‘s site and has been re-published. I sent my order off to Amazon. Can’t wait ’till it gets here. Until then I’ve got some other books to keep me busy.
Jul
05

Documenting Wiki2Go

No time to write in the blog or continue on the Theory of Constraints series today.

I’ve been updating the documentation for the Wiki2Go wiki that is used to host, amongst others, this site. It’s quite easy and fast to set up if you know what you’re doing. And I do. But others are now setting up Wiki2Go sites and are asking how to do it.

As Fred Brooks says “A programming product costs roughly 3x as much as a program.” As others start using and developing Wiki2Go I have to invest in (user and developer) documentation, installation tools, administration user interfaces, deployment…

Brooks describes another type of product, a “Programming System Product” like the operating system he worked on before writing the book. This one costs 9x as much as the program itself.

This should serve as a warning to framework writers: how much more costly is your framework than writing the code? 3x? 9x? Are you sure you will recuperate that investment? Will programmers write their applications 3x faster? 9x?


If you’re interested in developing Wiki2Go, the project is now hosted on Rubyforge


TheMythicalManMonth And read this book!