Tuesday, March 23, 2010

Thinking Forth

I wrote some small programs in C, and I was having a good time doing that.  However, my ambition was to write a shop floor control system and I started work on that using C.  I found that C was manageable for small programming tasks. As the project got larger dealing with all the pointer arithmetic, manual memory management and casting of numeric types was beginning to drive me nuts.  I had to conclude that C is a really good language for operating system work because it was designed for that, but that for application level work it just shouldn't be necessary to be concerned with bits, bytes, pointers, memory allocation etc.  Heck, BASIC would have been a better language than C for this.

After my disappointing experience with Wendin DOS and C I decided that I needed a more expressive programming language. I started to dabble in different languages, and I would write toy shop floor control systems to see how the code would come together. My work was exploratory in the sense that I wasn't in a big hurry to produce a result. I felt that I didn't know which course to take. In particular, I didn't know how to code a solution to overcome the hurdle of multitasking.

For example I experimented with a 4GL called Clarion. Bob was willing to spend several hundred dollars on this based on some stellar reviews that it received in magazines. Clarion really was great, but it was oriented primarily as a development tool for forms based database apps, and it had a nice reports engine. It did also include a compiler for BASIC-like language, but this was a short lived experiment. I do seem to remember creating a custom app for accounting with Clarion so we did get some value for the money.

So after this my mind turned back to the Forth programming language. I had already some experience with it, and I was excited to see if I could use it to create a multiuser shop floor system.

I found a version of Forth called Fifth, which included a simple IDE for MS-DOS. I also played with a couple of other Forth implementations.

So I went looking and bought a book titled Thinking Forth by Leo Brodie, the same author of the wonderful Starting Forth book I encountered a few years earlier. This was the most inspiring book about programming I had read yet. I enjoyed Leo's explanations about how software needs to be written abstractly, that code should be as small and simple as possible, about the importance of choosing the best words for procedures and variables, and also how to write well factored code and what that really means. The book also has great interviews with experienced Forth programmers and many funny and illustrative cartoons. Great stuff. Now, where did I put my copy?

No comments: