Inventio Software

Specialist Instrumentation Design and Programming

Inventio Software Ltd

Howerd Oakford writes : "Software engineering is in its infancy. Forth is one programming language among many, and is not even remotely like C. I use Forth because it doesn't get in the way, so that I can find solutions quickly. I use C because it is the current standard."

This article is translated into the Serbo-Croatian language by Jovana Milutinovich from Webhostinggeeks.com 2012 Dec 21

 

Forth and Not C - a personal view

30 Jul 2001

 

Forth has been described as a polarising language - you either love it or hate it. Talking about Forth is much more complicated than the language itself, because it involves every aspect of computing, social and political interaction, and personal taste.

At the time of writing ( May 2001 ) C is the most commonly used programming language, with C++, Java, perl, and VB catching up fast. Forth is rarely mentioned, and if I were in the business of managing software projects I would ignore it too.

Unfortunately I do not manage software projects, I just design and write software, and the reality for me is that Forth is more fun than C. Yes, I actually play with Forth for fun. To earn a living I program in C ( or whatever other language is in vogue at the time ), which is mostly interesting and challenging but only occasionally fun. Sometimes I even get paid to write in Forth - a treat which has got rarer since Forth's heyday in the early eighties.

Of course, whether or not programmers enjoy their work comes several places down on the priority list - well below lines per day, bugs fixed and deadlines met. So its not a strong argument for a radical paradigm shift...

As a contractor, specialising in Forth is commercial suicide. There are several reasons for this. Firstly, Forth is perceived as a dead language - like COBOL, ADA etc ( apologies to anyone who feels strongly about COBOL or ADA - I know how you feel ! ). Presenting yourself as a Forth programmer has "dinosaur" written all over it. Secondly, the number of Forth vacancies is minimal, so work is hard to find. Thirdly, since Forth is rare, Forth programmers are also rare, and anyone considering Forth for a major project runs the risk of being held to ransom by the few Forth programmers to be found. This shifts the balance of power between contractor and employer in a subtle way that helps nobody.

As a manager, using Forth is career suicide. If the project fails it is incontrovertibly your fault for choosing Forth - no one else does, and you just can't replace the programmers like you can with C or any other mainstream language. If it succeeds no one will be able to maintain it. Your boss will not know Forth, so you will have encrypted your work so that he or she cannot know what you are doing, or coerced him or her into learning a new language which no one else is using and is therefore a waste of time... Don't do it!

So, as you can see, Forth is in no-one's interest, so it is best left to fossilise in peace.

But this is not the whole picture. Human beings are infinitely more complicated than computers, and we all have to balance different pressures, and we can all come to different conclusions. At risk of straying into politics, C is perfectly adapted to the mainstream computing environment, and this environment is shaped by the pressures of the society we live in. Forth is very different. It is about the interaction of human understanding with a computer program. If this sounds a bit woolly - let me try to explain :

Programming in C follows a write- compile/link- test cycle, usually taking in the order of minutes. The program is written as a text file, and can be appreciated as easily if printed on paper as on the computer screen ( there are code browsers which help you in searching, but these could be replaced by an index. ). Test and debugging consists of reading the code and trying to interpret what the program is doing wrong.

Programming in Forth follows a similar write - compile - test cycle, but the unit of currency is the Forth word ( similar to a function in C ). The time for a complete cycle is in the order of seconds - dependent mostly on the speed at which you can type in your ideas. Forth can be printed on paper, but this is generally only used as an archive. Forth on paper loses almost all of its purpose. Forth as an interactive environment is a tool which works together with human understanding to allow creative thought and experimentation.

It is difficult to compare the productivity of Forth and C. A rough estimate is that Forth will allow you to complete a project between two and four times faster than using C. There is of course no proof of this, and the ratio depends on the type of project and the starting point. Based on code size alone Forth would be roughly twice as productive as C, since the source code tends to be roughly half the size of the C equivalent. For more complex applications such as WWW protocols, PPP or WAP, the ratio could be much higher, but this is due to the "operating system" programming style usually applied in a C environment, rather than the "direct programming" style made possible by Forth.

How close is modern computer science to its final destination? And what is that destination? Super-intelligent, self procreating robots? 10GHz Pentia that boot in less time than it takes to make a cup of tea? Here are some of the ideas that are talked about in the Forth community :

These are all real, they work, and they can be understood by anyone with the patience to learn Forth.

So if you don't mind going against the herd, take a look at Forth, but don't blame me if you like it!

bye

Howerd 8^)

 

This site designed with
a little help from:
Professional Web Design
L authoring tutorials