5 ms·
A great reminder that code is data, and data code. Now I want to see how all my programs look as bitmapped images... brb.
by edlinfan 14y ago
A great reminder that code is data, and data code.
Now I want to see how all my programs look as bitmapped images... brb.
- shurcooL 14y agoHopefully it will look mostly like random noise, without many patterns. That would indicate compressed information without much repetition. If you see lots of regular patterns, perhaps that means refactoring is in order to maintain DRYness. Hmm, curious if this visualization would actually work to spot duplicated code.
- jes5199 14y agoYeah, you're describing Shannon entropy: http://en.wikipedia.org/wiki/Entropy_(information_theory) http://en.wikipedia.org/wiki/Entropy_(information_theory) so that means DRY is "try to maximise entropy" gzipped files should also look like random noise, for the same reasons.
- algorias 14y agoHopefully it won't actually. Most languages are not designed for compactness of source code, and most forms of factoring will produce fairly noticeable patterns; e.g. lots of funcion declarations.
- shurcooL 14y agoTrue. One would have to first reduce the natural duplication/patterns that come with the language (i.e. function declarations, etc.) so that only the meaningful user code is left, before such analysis would be useful.
- btbuildem 14y agoBack in the days of A500, you could point the video viewport at any part of the memory -- including currently executing code. Watching lz decompress files was mesmerizing.