Smalltalk as Design/Prototype Language
[moved from BigDesignUpFront
I found myself wondering, on this topic, on behalf of a C++ project, about 'designing' in Smalltalk, and generating C++ for implementation. Not that I can imagine any self-respecting C or C++ shop letting me try that on them. In my thought experiment, I found C++ a more tractable target than Java. Has someone else considered or tried this (or am I just going loony?) --AlistairCockburn
My husband used to design in C and hand compile the C to assembly language for firmware.
That's funny, I tend to think about types a lot and I was thinking just yesterday about GeneratingCppFromSmalltalk
. -- MichaelFeathers
IMO, code generation never works well enough. You always need to tweak the code, and the code is always unmaintainable. There are no counterexamples.
Were I to do this, I'd implement in Smalltalk to find out what the objects are, then when the objects stabilized just recode it in C++. Or not. --RonJeffries
(Conventional) Smalltalk doesn't have the type information needed to generate "good" C++. And it doesn't have the "object lifetime control" discipline needed for it either.
If you generate C++ from Smalltalk, I'm sure you'll get unmaintainable C++. That is, you'll have Smalltalk, compiled in a really funny way -- not C++.
(Not that Smalltalk to C++, for compilation, is an inherently bad idea: At EDS, they have an OO language called OWL, which can be interpreted, or translated to C, for compilation. This gives them better portability and performance. No sane person tries to maintain the translated C code.) -- JeffGrigg
OK Ron, have a counterexample: SqueakSmalltalk
(Well, it does translate a subset
of the SmalltalkLanguage
into C, to run the interpreter; everything else stays Smalltalk.)
I spent much of 1986-1991 "prototyping" in Smalltalk, with the idea of doing the "real thing" in C++. My experience was that my "prototypes" did things I simply couldn't do in C++, and I couldn't demonstrate any convincing reason to believe that the C++ version, even if written, would have any particular advantage over the "prototype".
I remember a particularly exciting conversation with a person in SunLabs?
(who shall remain nameless) who agreed that it was impossible, using C++, to create applications by assembling components from independent vendors without source code. And then added "But why on EARTH would anyone ever want to DO that?".