Hi Giles,

"Copy and Paste" is not something only unexperienced
programmers do. Let us admit it, programmers do it all the time. It is a basic tool which is applied on many scales, from the highest level of the application
to the lowest level of the individual function.
Similar or duplicated code is not completely bad, it can even be faster than entirely unique
code (for instance if you code a loop directly
in Assembly language, the branching command can be eliminated). If repetitive code is good or bad depends on the judgement of the programmer - whether he wants performance or elegance.

There is a Harvard Business Review article named "When Should a Process Be Art" which says that some creative processes naturally resist definition and standardization.
Programming is such a creative process.
The programmer adjusts the raw material until it matches the desired requiremewnts. It is an artistic process where the quality can not be measured by counting the lines of code, see
http://4loc.wordpress.com/2010/11/22/progress-in-the-software-world/

I doubt that refactoring can be automated.
The book from Martin Fowler is useful:
"Refactoring: Improving the Design of Existing Code"
A list of patterns from this book can be found here
http://www.refactoring.com/catalog/

I am not sure if it makes sense to define a
fractal dimension for text or code. The box counting method is a common method to
determine the fractal dimension of images
and graphics. We divide the space up into a grid of boxes of size x, and count the number of boxes of that scale that would contain a part of the attractor.

If we divide the code into lines, and count the number of lines which repeat themselves, we would get a number between 0% and 100% (only repetition: 100%, no repetition: 0%). This is not a fractal dimension. And if we are honest, we must consider the whole stack, which begins on the deepest level of machine code. Ruby for example is written in C, and C in Assembly language. Many programs which look elegant just hide the messy part under the hood. They are based on large frameworks which contain all the messy and ugly code.

-J.


============================================================
FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
lectures, archives, unsubscribe, maps at http://www.friam.org

Reply via email to