I’ve been dabbling with Ada off and on for the past three years now. It has been very interesting and it has changed the way I think about software. That said, I think I am letting it go now. Let me explain.
I have been working on a model and software tool for a ASIC design course I’m taking this semester. Essentially I need to do some preprocessing of data that is to be stored in a ROM in the hardware. We are free to use any technology to implement the software part, and I was torn between C++ and Ada initially. I’m most proficient and productive in C++, but I thought it would be a good opportunity to really learn how to use Ada in a non-trivial way.
I ended up picking Ada, and at first all was well. The compiler caught a lot of silly errors and the algorithms just seemed to flow. Despite my unfamiliarity with Ada, the syntax felt intuitive and I did not run into too many issues implementing my algorithms. I particulary apprecaited the assignment operator (:=) and wished for it in C++ at a later point. Exceptions when dereferencing my pointers was also much more pleasant than core dumps and gdb sessions.
Ada let me down in three areas however: strings, text I/O, and generic containers. Working with strings and text in Ada is just down-right painful, and I think Ada really shows its age here. The I/O subsystem is also as primitive as its gets, and something as simple as printing an integer as a hexadecimal number without the 16#…# was not easy and I ended up having to writing somewhat of a hack. I am sure there is a better way, but there just isn’t a large enough community and Internet pressence around Ada to quickly figure out the better way to do things.
Generics in Ada were also quite awkward to work with. The most annoying aspect about generics is the having to use package methods to operate on the generic objects. The containers package also lacks some very fundamental data structures such as simple queues. In general I don’t like generics in Ada, they feel like an afterthought and a poor immitation of the Standard Template Library of C++. I realize there are third party libraries like the Booch Components or Charles Library, but to a novice Ada developer I found it difficult to build and install things with GPR files rather than Makefiles.
In the end, I reverted back to C++. Despite the cryptic nature of C++ and a frustrating debugging session where the cause was “if( a = b)”–which Ada would have caught–I was able quickly reimplement the code in C++ and move onto the hardware design…the reason for enrolling in a hardware design course. Where C++ really shined was with the STL and Boost library. STL containers and algorithms are simple to use, and Boost shared_ptr saves one from having to worry about memory management and allows one to focus on algorithms and the problem at hand. And program_options makes creating a command line program a breeze.
I am sure that Ada really shines in embedded systems where string processing is much less common, and the features of Ada are in high demand. To master Ada, I also think one would need access to a strong mentor as the books and available resources for Ada are lacking in this day and age.
I came to appreciate many featuers in Ada, but in the end I just do not think it is the right tool for the type of things I do at work, school, and home. C++ does everything I need at the momement, and I should probably focus my attention and software energies on learning new C++0x features or even exploring Erlang, my favorite programming technology at the moment.