Alex Rivera | Logout

What programming language best bridges the gap between pseudocode and code?

Asked 2009-06-05T00:04:52.830
11

As I write code from now on, I plan to first lay out everything in beautiful, readable pseudocode and then implement the program around that structure.

If I rank the languages that I currently know from easiest to most difficult to translate, I'd say:

Lisp, Python, Lua, C++, Java, C

I know that each language has its strength and weaknesses but I'm focusing specifically on pseudocode. What language do you use that is best suited for pseudocode-to-code? I always enjoy picking up new languages. Also, if you currently use this technique, I'd love to hear any tips you have about structuring practical pseudocode.

Note: I feel this is subjective but has a clear answer per individual preference. I'm asking this here because the SO community has a very wide audience and is likely to suggest languages and techniques that I would otherwise not encounter.

Edit
Report

4 Answers

7

You may be interested in Literate Programming, where the "source code" you write is more like writing a book, but its a book that can be "tangled" into real code or "woven" into formatted documentation.

See the examples provided at http://www.literateprogramming.com/cweb_download.html.

You may also find Eiffel interesting:

"... Eiffel shuns coding tricks or coding techniques intended as optimization hints to the compiler. The aim is not only to make the code more readable, but also to allow programmers to concentrate on the important aspects of a program without getting bogged down in implementation details. ..."

answered 2009-06-05T00:24:47.300
1

TCL syntax is easily the most like pseudo-code. Commands trump functions for readability and for expressing lower-level operations more typical of assembly code. At the same time, high-level algorithms are also very easy to read. The uniformity of the syntax allows the user to focus on the steps rather than on language artifacts. I would even say that the "expr" keyword for mathematical operations is an advantage, because it clearly delineates the math parts of the program from the algorithmic parts. Fewer symbols are overloaded, and words like "set" are used in their place. This is another win for pseudo-code. More than any other syntax, TCL spans the divide between functional and imperative styles.

answered 2011-07-06T15:48:22.110
0

I'd say that lua is the best for translation from pseudocode (in most cases). As long as the variables are well named, lua can be easily read by most programmers and its pretty fast as well!

answered 2009-06-05T00:32:56.673
0

I Agree with Nosredna's comment that Ada looks very much like pseudocode.

If you don't mind all the extra typing that Ada requires, I think it's a great language, as the code really does mean what it says.

answered 2009-06-05T01:38:19.430

Your Answer