CL/CLOS and C++

An Overview of C++:
The Good, the Bad and the Ugly

C++, an extension of C, is an object-oriented language that is essentially based on the premise that machine resources are limited and expensive compared to programmer time. In other words, C++ sacrifices programmer efficiency (particularly with larger projects) in the interests of producing highly efficient machine code.

Why is this the case? The language is designed to add object-orientation with no performance loss, so the compiler optimizes over the entire source code. However, C++ source compilation times get worse at least as fast as the program grows and maybe even faster. In addition, the cost of changing a C++ application is proportional to the size of the code base, rather than the size of the change.

C++ is strongly typed at compile time, meaning that the program must be semantically correct in all function calls before it can be tested. One result of this is that simple programmer errors are caught at compile time. While this is very useful in small projects, productivity can be sharply reduced when dealing with a larger application. Any design changes must be completely consistent throughout the entire application before any runtime testing can be done. The implication is that in large multi-person C++ projects, bottlenecks can develop very easily and be hard to resolve.

How Does that Compare to CL/CLOS?

Allegro CL's CL/CLOS comes from exactly the opposite view. CL/CLOS applications permit constant change, even in the deployed application. And the cost of change is proportional to the size of the change, not the size of the application. As a result, it's easy to modify and evolve even very large applications.

The CL/CLOS view is that programmer time is expensive and machine resources are cheap: to put numbers on it, while the performance overhead for medium size applications under CL/CLOS probably averages about half as much more than C++, the programmer productivity averages about a factor of five over C++.

One way to look at it is that C++ was designed and built for the world of about 10 years ago, and CL/CLOS applies to the world of today. Machines are now more powerful, and programmer productivity and efficiency is of greater importance.

Where is C++ Successful?

C++ is successful where a very large investment of time pays off in delivering a compact and efficient set of libraries. The Microsoft Foundation Classes are probably the best example. To pay off the investment needed to implement using C++, you need to have a lot of use in time-critical code or a lot of use by a large number of programmers.

C++ also succeeds in components which don't have to be changed after implementation. To date, the best example of this is C++ libraries.

Where is C++ Not Successful?

C++ fails where performance is less critical a factor than rapid time-to-market, or where market forces are constantly changing the requirements for functionality.

Nevertheless, it is often appropriate to use C++. Large existing libraries are written in C++, and more are constantly being written because of the economics described above: libraries seem to be one place where C++ is successful.

Best of Both Worlds

One would ideally like to have the best of both worlds: the ability to exploit the libraries produced by the armies of C++ programmers, and the ability to rapidly build and deploy highly flexible, evolvable systems.

Fortunately this is indeed a possibility: CL/CLOS works with C++. Where rapid development or evolvable systems are required, existing C++ libraries can be wrapped in CL/CLOS to exploit existing, already understood functionality without sacrificing the application requirement for dynamic, evolvable behavior.

In fact, many of the CL/CLOS applications on the market do exactly this. ViewStar Corporation has used Allegro CL to develop workflow automation software for large corporate customers, in one case leveraging the deployment time flexibility of CL/CLOS to put company procedures online while using C++ to handle the device drivers for the various types of hardware configurations used. Boeing uses the ICAD SystemTM, developed by Concentra Corp, now part of Knowledge Technologies International, to design the 777 aircraft in software by simulating the entire airplane design with the rules and objects in CL/CLOS, but the GUI in C++.

Combining multiple development tools in a single project makes sense when the innate capabilities of the various tools can be leveraged. In the case of CL/CLOS and C++, using existing C++ libraries gives you obvious benefits. Where rapid time-to-market or dynamic modifications are required, meanwhile, CL/CLOS is simply the best tool for job.

Copyright © 2014 Franz Inc., All Rights Reserved | Privacy Statement
Delicious Google Buzz Twitter Google+