Version 4 of How much of Tcl is Fluff?

Updated 2015-02-12 09:24:09 by plwork

Interesting read up at http://developers.slashdot.org/story/15/02/11/1744246/your-java-code-is-mostly-fluff-new-research-finds - this study comes to the interesting conclusion that the average Java program (and, by implication, the average C++, C, or whatever variant you might think of) less than 5% of the code actually implements the job the program is meant to do. The rest, say they, is "fluff" - boilerplate - set up, strip down, marshaling, demarshaling, and so on. This strikes me as way lopsided, but in looking back at my C++ code I think I see why they come to this conclusion - a lot of code is spent getting ready to do things, or cleaning up after doing things, but not very much is actually doing the real task. A lot of this is GUI code to get information in and out of a program, and the toolkits in such languages are very verbose, usually requiring as much as one whole line of code for every parameter. Tcl is far more concise and to-the-point, the UI in particular usually takes far less code and work. Does anyone have a handle on this evaluation might come up on Tcl? My initial reaction is 50% or more to do the work, but there is a fair amount of overhead in the form of [expr {...}] and the like that put gingerbread around code that isn't needed in Java or other languages - but then, expr's aren't a heavy part of Tcl code jobs, either. Comments?

PL 2012-02-12: one of the goals of Tcl was to hide fluff inside the C implementation level. Programs written in lower-level languages will necessarily contain a lot of fluff; higher-level / scripting languages allow the programs written in them to seem more fluff-free since the fluff is within module code or inside the language runtime.


arjen - 2015-02-12 08:14:41

I do a fair amount of calculations in Tcl (data manipulation, not-too-voluminous numerical simulations) and I would say that the fraction of fluff is rather limited - depending of course on what exactly you consider to be fluff. Boilerplate-ish stuff includes: getting arguments from the command-line, setting up a window, importing packages, initialising variables. One could argue that [expr] is fluff as is [set] - x = y is of course more concise than set x $y, but think of all the semicolons that are required in C-like languages!

(PL): AFAICT, fluff is code that doesn't directly contribute to the core "action" inside a Java metod, but still can't be edited out without breaking the method. It's not about excessive syntax as such: variable assignment is variable assignment regardless of whether your language makes you type x = y or set x $y (but if you have to declare the variable first, that's fluff). The article mentions that the researchers ponder applications for this research including "keyword-based programming", which is basically to say that they are re-inventing languages like Tcl some thirty years later...