Nassi-Shneiderman Diagram
I came across a highly influential graphical representation method of stating algorithm while I was reading books of system analysis and design. This method is called Nassi-Shneiderman Diagram or NSD. It was developed by Isaac “Ike” Nassi and Ben Shneiderman in 1972. Isaac also helped design the Ada programming language.
Many people claimed NSD to be very easy to read and understand, especially for beginners. This is probably quite true but maintaining NSD can be a problem for system designers. Unlike flowchart, NSD lumps all the symbols into one large block and does not use connectors between the symbols.
Contrary to flowchart which uses connectors, NSD provides a better structural approach of design where Goto should be avoided in structured programming. NSD provides simplicity and a compact overview of a program that can show some relationship nicely. NSD, in particular, provides visual aid and guides thinking about nested conditional structures.
Personally, I find that NSD is useful for rapid prototyping. It is quite simple and easy to draw a conceptual design before expanding into a flowchart. Modifying a stage or symbol in NSD is rather tedious compared to flowchart. On the other hand, after a careful and thorough investigation, I find NSD most suitable for structured system analysis, design and programming. NSD was designed with structured system analysis and design in mind as mentioned in the above paragraph, it has many advantages over flowchart despite of problem maintaining it. I think it is worth to study and to use it.
Here is an example of NSD and flowchart stating an algorithm to find a summation given by the equation:
If S > 100, then display k and tell the user that k is in range.
Hello? What is Ada?
I was giving an Ada talk this afternoon. The room was quite packed with students although not full. They were mainly 3rd year sem 1. Most of them were looking at technologies that they could work with their FYP (Final Year Project).
While I regaled them with fascinating true facts of Ada, I could see various reactions on their innocent and ignorant faces. Almost half of them gave an expression of “What is Ada going to do with my project?”, “What is Ada? Never heard of it.” or “Ada is old technology and is unpopular.” It was years of experience telling me not to waste too much time with such audiences. I quickly skimmed through some technical facts which they wouldn’t understand and continue regaling them with some interesting facts.
Finally, I had come to the end of the talk. It was the questions and answers session. No one had asked any questions except a girl who asked me about C# after the talk session was over. I explained to her the benefits of Ada over C# but she said she would have to start all over again. Again, my instinct told me not to waste time with such attitude and I turned my focus onto the two students whom I am supervising now. I continued with them a discussion of their project.
Unlike a couple of years back, I was too over-enthusiastic about Ada. I would talk regardless of audience reactions. After a few talks and a seminar this year, I find that I have changed. My enthusiasm is parallel to audience reaction.
Mathematics - The Systematic Reasoning
I remembered the way my mathematic teachers taught maths in class. Although none of them explained why we must learn maths, as it was the way supposed to be, they taught me systematic problem solving. I began to appreciate the beauty of mathematics when I started immersing myself in programming. The algorithm development and language constructs which are based on mathematics fascinate me with its beauty.
A good programming language teaches us systematic discipline and systematic reasoning. The first programming language which I learned was Commodore BASIC. I hated that. I learned half way (as the matter of fact, 2 days) and I switched to Apple Basic. In the mid 1980s, Apple II was the most popular home computer after Commodore VIC 20. Apple II that ran Apple DOS caught on the wagon very fast. The most common programming tool on Apple II was of course Apple BASIC. That was my first programming language and I had written many programs with it.
Then I was exposed to FORTRAN 77. The language construct was pretty much like Apple BASIC. I caught on with FORTRAN pretty fast. Then under some influences from friends whom I met at the computer center, I learned Apple Pascal. We challenged one another to increase the boot speed of Apple DOS. We rewrote Apple DOS with Apple Pascal and evidently increased the booting speed of Apple DOS.
Pascal is a very structured language (compared to Apple BASIC and FORTRAN 77) invented by Professor Niklaus Wirth to teach students programming and systematic reasoning. The structural construct of the language enable the programmer to think of the problem in a structural approach. Pascal cultivates structural discipline in solving programming problems. Pascal has provided me most of the necessary training in systematic discipline and systematic reasoning in solving problems.
When CP/M was introduced on Apple II, I was able to use UCSD Pascal on CP/M enabled Apple II machines. It won’t be long before IBM and IBM compatibles (8086) stirred up a turmoil with MS-DOS. Then, Turbo Pascal (by Borland) emerged. Turbo Pascal was the lightest and fastest compiler at that time. I became addicted in writing computer programs with Turbo Pascal.
Then I caught on with C and C++ and began to develop software with Borland’s Turbo C/C++ compiler. When MS Windows became a de-facto standard on every desktop computers, I dwelled into Borland’s Delphi (based on Object Pascal) to develop GUI applications.
During Apple CP/M era, I was exposed to Ada. I discovered Ada compiler by accident in another computer shop. I bought the program without thinking twice. Of course, it was a pirated copy. There was no copyright law then. But thanks to the pirated Ada compiler, otherwise I would not know such beautiful programming language has ever existed!
In 1995, I started to learn Ada when books were available. In no time, I fell in love with Ada until today. Whenever I was told or perhaps requested to look at computer programs written in any other languages, e.g. PHP, Visual Basic, C/C++ and etc., I feel that represent an insult to mind trained in systematic reasoning as in Pascal papers which Professor Wirth wrote.
Ada and Pascal are very alike because Ada developers had adopted Pascal’s structural language construct. Both Ada and Pascal clearly represent logical expression without any difficulties. Both languages are constructed heavily based on mathematic concepts and thus enforce systematic discipline and systematic reasoning.
China’s proven world class competency
During the snow hazard in China this February, the Chinese government had successfully managed the natural disaster and crisis with much professionalism in such a short period of time. According to an unconfirmed source, the Chinese government managed to develop a Disaster Management System in just 5 days. 75 software engineers from the Chinese military worked around the clock for 5 days to bring up a web based Disaster Management System to collect, manage, disseminate, coordinate, and to provide command and control to the military disaster relieve team during the recent snow hazard.
The system was developed using Ada, AWS (Ada Web Server) with a little of PHP and Perl. The system deploys a MySQL database running on Linux. The system is hooked up to air-borne SAR (Synthetic Aperture Radar) for real-time acquisition of landscaping information in snow hazard affected area to help assessing the damage of rail ways, roads, housing and forest. The Chinese army engineering company was dispatched by the system to areas in need of assistance.
I have yet to receive further details of how the system works and probably will not. Anyway, that shows the Chinese ability and responsiveness in dealing with natural disaster. Hail China!
Coding War or Extinction of Human Race?
When I stumbled on this story about a software engineer and his encounter of a bug in a missile launch command and control system, I read with delight because it has been a while since I read an exciting piece of story about Ada. On the other hand, I was so nervous because our extinction might just be a string away.
The story is about a software engineer trying to maintain a 400KSLOC legacy system when the OS and compiler version were upgraded. You can read the full story here.
It is pretty exciting to read about the job of working on the legacy Ada code of such mission critical system. Why was the error occurring? What would be the consequence if the missile launch test failed? What if the missile were launched “accidentally”?
I believe, one day, the human race will extinct as was portrait in the movie Terminator. The extinction will be due to an error in a software, or rather the negligence or ignorant of a software engineer.
What the story tells us is that it appeared to be some 20 lines of code which caused the upheaval this Thanksgiving. May be it is really Thanksgiving for giving the human race another chance to survive. So, do what you want to do most, enjoy life while you can.
Leopard unleashed!
Apple has unleashed Leopard (Mac OS 10.5) last week. It’s an awesome operating system beating all other OS flat out! New features such as time machine, desktop space, interoperability with Apple Mail and many more.
Time Machine is a repository with version control system to keep track all the changes to your files and directories. When you plug in a FireWire hard disk, Leopard will automatically version all your files and directories onto the external hard disk. You are able to go back in time to look for a file (or directory), which you have deleted or modified, and to restore them.
Desktop Space gives you more desktop spaces to organize your works on the screen. It makes switching from task to task simple and easy with a click of the mouse.
It will be a nice upgrade but if you are developing software with Ada, unfortunately, you have to wait for a while. Ada does not come with xcode yet. The folks at MacAda is still working on a stable and working version of Ada compiler.
HOWTO - Building GtkAda project with xcode
My current project (here) requires to develop a GUI application for displaying some JPEG images. I intended to develop a native Mac OS X GUI application using Carbon or Cocoa. Since there is no Cocoa binding in Ada, I narrowed down my option to Carbon. I hit on the wall of frustration where Carbon binding on MacAda.org is very old and supports only gnat-3.3 and PPC (I hope I am not wrong on this).
I have to turn to Gtk+ which will require GtkAda and X11 on Mac OS X. I compiled my test code written for GtkAda very well on console. But when I imported the codes into xcode project, it did not compile. I got the following errors:
error: "gtk.ads" must be recompiled ("a-except.ads" has been modified)
error: "gdk.ads" must be recompiled ("a-except.ads" has been modified)
error: "glib.adb" must be recompiled ("a-except.ads" has been modified)
error: "glib-object.adb" must be recompiled ("a-except.ads" has been modified)
error: "glib-type_conversion_hooks.adb" must be recompiled ("a-except.ads" has been modified)
error: "gtkada.ads" must be recompiled ("system.ads" has been modified)
error: "gtkada-bindings.adb" must be recompiled ("a-except.ads" has been modified)
error: "gtkada-c.adb" must be recompiled ("system.ads" has been modified)
...
I sought help from GNAT-OSX mailing list (September 2007 archive), but there was no avail. I spent many days investigating the cause of the errors. I found out that gtkada source codes would be compiled and produced .ali and .o files in the build directory when I used gnatmake to build my GtkAda application.
$ gnatmake testproject.adb `gtkada-config`
To build a GtkAda project in xcode, follow the instructions below:
- In the project browser, under the Group & Files column, locate Targets and the your project name. Right click your project name and select Add Link Binary With Libraries. Select GtkAda libraries from /opt/local/lib/gtkada and necessary libraries from /opt/local/lib.
- Select your project name and click on the Info button. In Build tab, select Search Paths under Collection. Include /opt/local/include/gtkada in Header Search Paths. Also include /opt/local/lib and /opt/local/lib/gtkada in Library Search Paths.
- Select Source in your project. Select Add to Project … in Project menu. Include all the GtkAda source files in /opt/local/include/gtkada.
Xcode 2.3 and gcc-4.2 (Ada)
I have finally decided to update to Xcode 2.3 and gcc-4.2. There is not much information about how to install except from the MacAda mailing list. So, I decided to post the How-To here.
Here are the procedures:
- Uninstall previous Xcode installation by
$ sudo perl /Developer/Tools/uninstall-devtools.pl - Restart the computer
- Download and install Xcode 2.3
- Download and install gcc-3.3 Ada compiler from MacAda
- Download and install gcc-4.2 Ada compiler
- Unzip and untar the gcc-4.2 package with
$ tar -zxvf fsf-ppc-gcc-4.2.0-20060429.tgzor
$ tar -zxvf fsf-i686-ada-4.2-20060409.tgzdepending if you are using PowerPC or Intel Mac.
- Move the directory ada-4.2 to /usr/local
- Download and install Ada Plugin for Xcode and follow the instructions.
I tested Xcode by compiling some projects and it is great. But I still cannot manage to build Ada dynamic library with it. It looks like some problems with the flags. Here’s the error and warning messages I got:
warning -L: directory name (/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/darwin/default) does not exist
unknown flag: -Wl, -single_module
Solution for building dynamic shared Ada library with Xcode
Finally, I got some answer from the mailing list. It is a problem with Xcode 2.2 and gcc 3.3 and it seems like an update to Xcode 2.3 and gcc/gnat 4.2 is inevitable.
The reason I am skeptical about software update is that I have a number of on going development. A simple tiny glitch in the new update will cause big havoc especially after all the recompilation of source codes.
Anyhow, I am glad to hear the solution and I will update my development tools soon after I have made a few confirmation.


Listen to my podcast