Pseudocode Language

From OpenDSA Active-eBook Project
Jump to: navigation, search

What programming language are coding examples written in?

Possibilities include Java, C++ (personally, my least favorite choice), pseudocode (Tom and I like that idea but are not adamant about it), Python, JavaScript. One technical advantage of Pseudocode might be that it makes it easier to create hierarchical marked-up algorithm descriptions like in Algorithms in Action.

There are huge management advantages to using a language that has a compiler behind it so that you can test your code. A major problem with pseudocode is that there is no way to test if you got it right, either syntactically or semantically.

Another technical issue is that some languages have interpreters that allow code to be edited and executed right in the browser. We have seen examples of this for Processing, Python, and (obviously) JavaScript. This leads to many possibilities for interactivity within an eTextbook. See for example this interactive Python textbook.

Nick Parlante's CodingBat (http://codingbat.com) allows students to do editing in the web browser, and then execute and test their answer, for many coding exercises in Java and Python.

The ideal language would have the following features:

Even better than a coding language is support within the system for a variety of coding languages. Currently, the OpenDSA infrastructure is attempting to be language neutral. We do this by creating a separate directory for code snippets to be embedded into a module. It is easy to set up separate sub-directories to contain the snippets for each desired language. Our configuration scripts explicitly support changing the embedded code source directories. In this way, if the text of the modules is written in a language-neutral way, changing the language of the examples is as simple as changing a line in the configuration script (assuming that you have the code snippets you need in the new language).

Of course, modules are unlikely to be language neutral. For example, that would mean not being able to refer directly to any code syntax. So we are likely to need to have some mechanism to support such alternate versions of the prose. Something like LaTeX conditionals is possible (that is how I maintain C++ and Java versions of my textbook now).

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox