In college, one of the tenets I lived by, when I was redeveloping the electronic course management software we were using and in my classes, was that any block of code (function, procedure, etc) should fit on a cocktail napkin.
To be fair, part of this logic was that me and one of the people I hung out with, co-dev on the project, used to go to TGIF for dinner with friends a bunch, or we’d go out for lunch somewhere. And since we both drank, we tended to go to places that had cocktail napkins. It got to the point where we would sit down, order drinks, and ask for a stack of napkins. Because we would both start coding and writing notes.
Most people never much liked the theory, because “a napkin is too small to put any real code onto!” Most of those complaints were from people like those who wrote v1, with 800-line functions … yeah, that’s useless!
I bring this up because the other day when we were cleaning some, I found some of those old TGIF napkins. Psuedo-coded, not sure where the real-code is. These were from when we were still deciding between Perl and Java (in ’99)
- All the napkins in the pile
- View Log Functionality, from the User Perspective
- View Log Functionality, from the Coding Perspective
- More Functions
- Notes about Napkins
You can see in the last image that we actually had a note for typing up the napkins, and a note for explaining to “durga” ABOUT napkins. IIRC, durga was one of the ones where that went over … not at all.