Monkey Knife Fight: Minimalist vs Humane Programming Approaches
 
 

Though I filed this under, "web programming", it is a commentary based on this article ("Monkey Knife Fight"), which debates between two programming library approaches.  I'll keep my comments from being too technical, as most of my friends are not programmers (so everyone can read an understand).


First, a summary of the article for the non-programming crowd:  When creating applications, programmers use libraries of code.  The greatest reason is so they don't have to reinvent the wheel (if we did, I'd go into photography full-time).  Most libraries are extensive and can be bent to do almost any task.  Each programming language has its own library, with many extensions available for specific, complicated tasks.  Got that?  Good.  Now, comes the article’s gist.  There is no one way to develop these libraries--keep that in mind.  The minimalist approach believes "less is more", meaning if what you want to do suffers just a few additional keystrokes and results in a bit less readable code, that's fine.  The "humane" approach believes that frequently-used concepts should be included in these libraries and not have to be done by the programmers.


Now, the example, which should conclude my summary:  Say you have a list of items, like a grocery list.  Your list could include "eggs, bread, and milk" and take up one line per item.  In programming terms, that's a list or array, and each line is numbered (sometimes beginning at "1", but most often at "0").  Now, say you wanted the last item on your list.  If you were using Java or C#, you would say, "Let's take number of items on my list and subtract one (3 items--eggs, bread, and milk).  That leaves me with the number "2".  Now, find number 2 on my list (my list begins numbering at zero), so the last one is milk."  For those who know a bit of code, that's "shoppingList[shoppingList.Length - 1]".  Now, in another programming language, we could then say, "What's the last item on my list?  Oh, milk."  (Which would be "shoppingList.Last".)  That's what the argument is mostly about in the article.  While the first way of doing things is roundabout, it uses a smaller number of names in the library.  The second set, embodying humane programming, includes convenient actions, such as getting the last item on the list without having to go through much fuss.  As I said, some people in the programming community believe less is more (because getting the last item can still be done).  Just remember that the argument is not over just this example--it's over whether or not, or how much, convenience should be a part of library design.


 
 

Here's my opinion:  A smaller number of names in a library (i.e. methods in a class or object) is a virtue because that's less one must remember.  However, one must then remember how to perform standard actions to get back things one does frequently.  In exchange for the minimalist approach, one must know remember "shoppingList[shoppingList.Length - 1]" instead of remembering "shoppingList.Last".  Computers have extensive memory and can process faster and faster.  We, humans, do not have an extensive memory (and in some areas, like names and faces, my memory is extremely limited).  I prefer the approach that allows me to do frequent things easier AND results in more readable code.


I'm still trying to approach a more humane model.  When I write code, I keep in mind things that will be done frequently and build them as deep as I can into the "library" I create (remember, I'm trying not to use too many technical terms in this post).  Thus, while the resulting things I create can handle many commands and have many things one can do to it, my creations are satisfyingly powerful.


I'll give everyone as an example, as I am under no such vow of secrecy about work.  First, the background:  The advanced reporting application I am developing allows users to select restaurants (displayed under company names and regions) from a pop-up "picker" for a report.  There are many types of reports, and reports require different types of selections from the picker.  For instance, one report could allow anything, while another only restaurants (no whole companies or regions), while another could only be run under one restaurant, or, finally, one could run only with one "entity"--a restaurant, region, or company.  Finally, the greatest challenge that came my way was that the picker, later, had to work as both a pop-up window and in-line on the page (yes, that was quite interesting to do, yet satisfying once the picker was modified)!  As you can see, there are vast definitions of what is acceptable for a report. 


Continuing with the example, now what I have done:  I created one picker for everything.  You tell the picker what is acceptable.  The picker itself is made up of other components, which are in turn made up of a few others.  The result is that I can use one picker and tell it a few common commands and it will modify its components so I don't have to do it.  The minimalist approach would have had me take a step forward and not use that final picker, as the final picker is just something I created as a convenient way to configure the picker components.  (Granted, this is not a prize-winning example, but that's fine.)


Anyway, I believe that if the addition of a few more names to a "library" (class) results less syntax one has to remember and, because of it, is more readable, that's fine.  Just one rule: don't go overboard and have what you create be a featured post on The Daily WTF (a site I highly recommend).


Perhaps I can say the difference between the Minimalist and Humane programming approaches is the difference between "Internet" and "Internetwork", or "NSA" and "National Security Agency".  It's more convenient, right?



Dev Log Entries

Air Hockey (4)

Commentary (3)

ConTrak (16)

CSC Picture Project (3)

Dev Log (12)

DevFolio (5)

FinGame (1)

Geocaching (1)

Haunted Pictures (7)

Misc (1)

Personal Life (13)

PhoenixPo.com (4)

Photography (5)

Web Programming (3)

WOES (1)

 

Total Entries: 79

 

Haunted Attraction Pictures     Statbar Modifier     CSC Picture Project     DevFolio.com