Last year, I concluded a programming project at work that clearly demonstrated that real programming tasks tend to involve multiple languages. I once made a remark to a journalist that there is a zoo of languages inside all real products, and my little project provided a very clear example of this. The project, as discussed previously, was to build an automated integration between a simple Simics target system and the Simulink processor-in-the-loop code testing system. In the course of this project, I used six or seven languages (depending on how you count), three C compilers, and three tools. Eight different compilers were involved in total.
The code was written in Simics DML, Python, Simics CLI, C (target), C (host), Makefiles, and Matlab. I created a Simics device model that presents a programming register set towards the target software. This was written in DML. This device model in turn talks to a server thread in Simics, which is written in C using the Simics API and Windows or Linux TCP/IP sockets. To bring up the various pieces of the Simics solution to a coherent whole, I wrote a Simics component model in Python. Once the component model was done, I created a Simics start script in Simics CLI to set up the target machine and start the simulation. This Simics script was used when starting Simics from Simulink, based on a set of Matlab code that described how to build code for the target and how to start Simics with a given binary to test.
To make the target code work, I had to write some bare-metal drivers for the new device, as well as some utilities to drive target system serial ports and LEDs for diagnostic outputs. This was all done in bare-metal C which almost counts as a different language from the C used for the server thread in Simics, as the code has to work without access to the C library and common functions like stdio and sockets. It is all just poking memory directly. The Matlab scripts used for the integration were told to include this target-side code in the compilation of the generated code for the target.
Compiling all of this required the installation of three separate C compilers: one to build the Simics modules that run on the host (using minGW to get a gcc compiler for Windows), one to build the Matlab executable modules which are generated during the setup (using the Microsoft SDK for Windows free x64 Visual C++ compiler), and finally a gcc targeting the Power Architecture target. In addition, the compilation of the code various pieces involved used the Simics DML compiler, the Python compiler inside of Simics, and the Matlab compiler inside of Simulink. The target code was generated from the Simulink diagrams using the code generation functions of Simulink, which is really yet another compiler. Bringing the complete build process to some eight compilers total.
The integration involves running both Simics and Matlab (Simulink is really just a module inside of the Matlab environment), as well as the Simics environment in Eclipse. This means that three major modular and extensible tools environments are involved in the programming process.
In addition, I prototyped the target code using VxWorks running on the target system, which adds yet another tool environment (Wind River Workbench), another C compiler (VxWorks-adapted gcc), and C code for the VxWorks API as a programming language.
This project could probably have included even more compilers and languages, if I had chosen to generate some code using macro expansions or scripts. Now, that did not seem to be needed, but that would be the likely future path to generalize the solution. If I had taken the time to build an example Simulink model myself to run using the PIL system, that would have brought the number of languages in use to eight or nine (depending on how to count the various C variants used, including the first prototype).
To me, this adds additional evidence that all real programs contain multiple languages. I really do not understand how some people seem to think in terms of “the language” when talking about programming for real systems – I have never really seen a real system built using only a single language. I guess even the most ardent user of Ruby or PHP still end up coding some SQL to get at databases and most likely some lower-level stuff to get real things done on the server the web server is running on.
BTW. Programming? In Marketing?
My current position is in product management, which puts me in the broad field of “marketing”. What I love about this type of job is that it spans so much – at one end, I end up crafting text and messages for web pages, but at the other end, I write code to learn more and demonstrate what I am writing about on said web pages. Even if I spend most of the time figuring out where to take the product and driving the development of features and versions.
However, the programming that I do should not be confused with the programming that real programmers do. What I cook up are proofs of concept, demos, and similar. They are not necessarily written to be robust to all error conditions, nor are they written to engineering-level requirements on documentation, metadata, and coding guidelines. Indeed, it is more like academic coding in many ways, in that I focus on the architecture, data flow, and fundamental concepts. When something later becomes a real product feature, it requires renovation and refactoring as it goes through engineering development and becomes properly supported.
In any case, it is fun to still do a bit of programming, and very educational too.
I would just love to find some time to try some other few new programming languages.
4 thoughts on “Single Programming Language? No Way! (For Real Work)”
The main problem in using several programming languages is that you have more compilers/interpreters to worry about. Plus when you use plenty of libraries with a lot of code there are plenty of more places to pick up hidden bugs.
My advice : stick with field proven technologies and thoroughly test a new programming tool. Programming is not getting easier: quite the opposite : is getting more complex by the version.
Well, all the tools here are indeed tried, tested, and proven in extensive use. The key is that when you build a real system you always compose many pieces, and those pieces are rarely synchronized in terms of programming tools. What I did here was to compose stuff — and that ended up using close to ten programming languages/APIs/environments.
“My current position is in product management, which puts me in the broad field of “marketing””
Can you please send me a spreadsheet file with the products you sale and the prices? at email@example.com . Don’t be put off by the email name: it is fully functional.
I am interested in what you sale. I might buy something from you/your company.