Fast, Expert Software Consulting and Programming HelpTM
TinyBasic (Java, Flex, C#)
Tiny Basic is my port of Tom Pittmans's TinyBasic C rewrite to Java, C# and Flex/Actionscript. When I learn a new language/platform (in this case Adobe Flex), I always try to think of an outlandish first project to keep my interest level high and this was it. Those that know me also know that the TRS-80 was my first computer and I have a weakness for the early versions of BASIC and those books and magazines where you type in your own programs and games from the code listings.
For grins, I also decided to create Java and C# versions so I could mentally compare and contrast them.
Tom Pittman's C version is of course a console application. When porting this, I could have opted for the approach I followed in my Mips2Java port and have a "console" thread and GUI thread which piped input and output to each other bidirectionally. I thought this was overkill, though, (and it was out of the question for Flash/Flex, which is single-threaded). Instead, I opted to rework the interpreter loop, causing it to return if it either needed more input or if it had executed a predetermined number of instructions. The GUI would set a 250ms repeating timer which would re-enter the interpreter loop if it wasn't waiting on input. Finally, the text area would trap the enter key and re-enter the interpreter if it was waiting for more input and if more input was available. This would give the illusion of multithreading with only one thread.
The fact that I was able to do this in Java, Flex and C# kind of shows that in the end, things that seem different on the surface are just variations of the same theme. My understanding of how to do multithreaded GUI programming (have worker threads call the GUI thread asynchronously) has its roots in my Windows C++/MFC days and applies equally to Java (Swing and SWT) and C#. My understanding of how to use timer tasks to simulate multithreading also has its roots in my C++/MFC days. To me, coding in different languages and platforms is like traveling to different countries and speaking different foreign languages to people who in the end, are just as universally human as I am.
Java VersionClick here to see the Java applet.
Adobe Flex VersionClick here to see the Adobe Flex version.
C# VersionClick here for the C# version.
Sample BASIC ProgramsClick here for the Tiny Basic User's Guide and sample programs you can copy and paste into the interpreter window.
I'm making the Java, C# and Flex/Actionscript sources available without precondition. This is as a token of gratitude to Tom Pittman for making his TinyBasic sources available, as well as to countless people who have selflessly provided programming answers and advice on the Internet.
If you need help or have questions about any of these platforms, feel free to purchase my consulting time with my easy-to-use web interface. (Shameless marketing plug: people with both my breadth and depth of knowledge are hard to come by; my experience with a wide variety of programming languages and environments might give you the perspective you need for your project.)
If you enjoy this...
Would you consider visiting one or more of the following websites?