Workarounds, kludges, hacks - some geek definitions... (UPDATED)
Category What do you think?
Bookmark :
Update: Bob wrote up a good list of his definitions, and since it is rather lengthy I thought I'd add it to the original post for discussion. Additionally, I have changed the examples a bit based on a discussion with Bob. **Rock
I've been working on some code lately that I am quite proud of, and during this time I have been mulling over some definitions I have for - how shall I put it - the things we do to get our jobs done as developers. The common terms used for these are workarounds, kludges, hacks, etc. Well, as I pondered these termsI realized that I had unconsciously been assigning these terms different "weights" - IOW I used the different terms to indicate the intensity (severity?) of the "unusual convention". After some consideration I decided that I was ready to share my thoughts on the topic with my geek brethren (and sisteren) and see if we can refine it and come to a common agreement to these terms. Once they are agreed upon we may add them officially to the geek lexicon, whereby we can use them in the presence of normal humans - and when said humans look at us with that cute look of HUH? when faced with these terms we can shake our heads condescendingly and mutter "tsk tsk", thereby reaffirming our superiority in all matters geek.
Here are my terms, with comments, in order of complexity/intensity/severity:
workaround - this is the most basic of unconventional methods. These are the things we use every day to get our jobs done, and are common knowledge in our community
Example: This is before R6.x. You have a list of 10 items. You want the 5th item in the list. You use @Subset(@Subset(list; 5); -1) to get the 5th item
Example2 (moved from kludge, cause it is supported): Here's a simple one (trying to keep them small for space reasons) - You want to access an item whose name begins with a $, such as $UpdatedBy, and you want to use extended dot notation. You try NotesDocument.$UpdateBy, but it throws an error. The kludge is that you can use a tilde (~) before the item name in extended dot notation to access system items - NotesDocument.~$UpdatedBy
kludge - kludges are a bit more complex. Kludges are also quite common, but are typically not as readily apparent. Where a newbie Lotus Geek may figure out a workaround, kludges typically have to be told to you by a more seasoned Lotus veteran
Example: Before we had NotesUIWorkspace.OpenFileDialog you could use the Notes C API to call NEMGetFile (from Notes FAQ)to get a Windows common dialog. This was desired over using a direct Win32 API call because it was much cleaner to call than decaring all the crud needed for the Win32 version. This call was unsupported, but worked great (it is what was used internally to present the common dialog, and is what is exposed using OpenFileDialog).
hack - similar to a kludge, but more elegant or complex, and less common. Hacks are beginning to tread into brilliance - they use conventional tools unconventionally to get the job done. Most hacks are elegant, although some are brute force; both qualify as hacks. When a geek is told of a hack, she usually says "kewl!" Hacks simply get things done using unconventional means. People who create hacks usually are good at thinking outside the box.
Example: You update a rich text item in the back end, and want the updated rtitem to appear in the ui document that's currently open. You use the "bounce doc" technique found on Ken Yee's Notes FAQ
Righteous Hack® - the king of all hacks. the term "Righteous Hack®" appears to have been first coined by our own illustrious Bob Balaban. Where hacks are less common, Righteous Hacks® are rare beasts indeed. A Righteous Hack® is so amazing, so awe-inspiring, and so elegant that it typically makes other geeks go "holy shit!" when they see it (hence the term "righteous"). Geeks are lucky to create one Righteous Hack® in their entire lives - most never do. There are some amongst us that seem to live in hack/Righteous Hack® land - people like Jake Howlett (CodeStore), Mike Golding (NotesTips), Julian Robichaux (NSFTools), etc. (BTW, I know there are others - but these are the first to come to mind - no offense to the rest). These guys regularly produce stuff that makes us go "holy shit!" with regularity. Where hacks are outside the box, Righteous Hacks® have no idea where the box is. All Righteous Hacks® are elegant; most are elegantly simplistic. The one thing that is true about all Righteous Hacks®, however, is that they change the development landscape. They provide something that was previously impossible, and allow us to extend the boundaries of Notes/Domino development. Righteous Hacks® are also typically foundations for new innovations in development, as they open the geek mind to new possibilities.
Example: One of, if not the first Righteous Hack® ever, was the Wilfredo Lorenzo "@Sum" formula. Back in the R3.x days we didn't have an @Sum formula in the formula language. There simply was no clean way to add a list of values - which was very limiting. That is, until Wilfredo came along with his @Sum formula. Basically Wilfredo figured out that you can split a list (using logs) and use pair-wise addition to add the lists together. You keep doing that until you get a single value. Here is the @Sum formula, once again from Notes FAQ, in all its glory. However, one comment - the description above the formula indicates that the list had to be a power of 2; that is incorrect, the formula actually works with odd-element lists as well. Check it out, and bow your head in reverence.
Now that we've defined these various unconventional methods, I have some other ideas around this concept....
First, I would love to get input from you, the Lotus Geek community, about these definitions. Let's refine them into something we can all agree on. Second, I would love to read your examples of each - I've given you a start, but I am sure you have others that stand out in your mind.
And that leads me to my next idea. I think it is time that we create a Lotus Righteous Hack® Hall of Fame. I have spoken with Bruce over at OpenNTF, and he is enthusiastic in his support of the idea and is willing to have OpenNTF host the Hall of Fame (it just seemed to make sense to put it there). I have also come up with the name of the award that is to be given to HoF members - the Kludgie! Bob Balaban suggested we make it a rubber chicken, but I am open to ideas :)
I think we can have nominations and voting to determine what Righteous Hacks® make it into the HoF. This should be community owned and supported. We can work out the details here, but I wanted to get the idea out there to see what you thought about it, and to get your input as well. I am sure we can come up with the inaugural class rather quickly, and then decide how and where to go from there.
So, there it is. There is a bunch to talk about here, so let's get the conversation started.
Rock
**If you cannot change your mind, are you sure you have one?
Bob's Update:
_______________________________________________________________________
Some Developer Terminology
Bob Balaban
12/28/05
Overview
Developers use lots of shorthand words/terms to describe the lifeblood of software development: pieces of code. Here are my personal definitions, derived from years of commercial software product development. These are in no particular order.
Righteous Code
What we all aspire to, all the time. Righteous code is clean, elegant, easy to follow, as short as possible (but no shorter). And it works as advertised.
Hack
Hacks are what we do when we have to fix something in a hurry, and the “real” fix will take too long. If to “really” fix a given problem we would have to rewrite a big chunk of product, and if we’re only two weeks from ship, then a quick “hack” will have to do.
Hacks are generally small changes. They can be shown to work and will hold up for a while (though they will almost certainly have to be re-visited later). Hacks are typically ugly solutions. They are “quick and dirty” solutions, and as we all know, long after quick has departed, dirty remains.
Righteous Hack
Different from a “regular” hack in that a “righteous” hack is a) something you had no choice about, and b) elegant in and of itself in some way.
Whereas you could avoid a regular hack by doing the “right thing” (even if difficult), with a righteous hack you really have no choice: there often is no “correct fix”, all you can do is short-circuit some hunk of logic in a particular use case, or poke a global that shouldn’t be there in the first place. You’d rather not have to do this, but the solution is clean, and it works.
Workaround
A workaround is completely different from a hack. Workarounds are implemented in “supported” (i.e., conventional, non-hack) ways to achieve something that you would normally do another way, but which is blocked (often by a bug, or a missing product feature).
One example from the history (pre R6) of Domino Web development: when formatting a URL to a document in a Notes database, you would typically use @functions to get the server name, database name and document UNID. The database path on a Windows server would come up with back-slashes in the string, but for a URL you need forward-slashes. So you just use @Replace to convert “\”s to “/”s. This is a perfectly reasonable, legal and supported “workaround” to the fact that (in earlier versions of the product) there was no @function that gets you what you need in the proper format.
Workarounds are “supported” in that the behavior you use to get what you need is documented, or at least “legal”. Good workarounds are generally the most direct path around a boulder in the road.
Kluge
Kluges come from the Dark Side. They might work today (for some use cases, at least), but are no way guaranteed to work tomorrow. They are ugly. They may well break other things.
Kluges are characterized by reliance on undocumented, unsupported, and possibly accidental code behavior. They are worse than hacks in that they are often unnecessary, and are simply the result of laziness on the part of the implementor. Somebody heard a beer at home calling his name and instead of creating a directory group with the proper entries in it and adding that group the database ACL, he just made Designer the default access on the NSF. Evil.
Crock
A crock is basically a kluge that doesn’t even work, or doesn’t accomplish anything useful. It’s code that anyone could look at and say, “What a piece of crap!” I once saw this in real production code:
#ifdef UNIX
// some code to do some stuff…..
#else
// EXACTLY the same code….
#endif
What a crock!
WTF
A WTF is code that kinda sorta works, but which is mind-numbingly stupid in it’s algorithm or syntax. It’s code that a competent developer would look at and ask, “Why would anyone do it that way??” For example:
// add 3 to the counter
for (int i = 0; i < 3; i++) counter++;
You can’t say it won’t work, but it sure is dumb. The best source of WTF examples I have ever seen is The Daily WTF website







Blog Roll









Comments
http://www.thenorth.com/apblog4.nsf/Threaded/5826429868D4A610852570E7001273D9
Posted by Andrew Pollack At 12:02:09 AM On 12/30/2005 | - Website - |
Incidentally, Wikipedia's entry for kludge seems to support it as being looked at both ways, but overall it definitely has a negative connotation. So, maybe it is a bad thing - but do we rename the award?
Rock
Posted by Rock At 05:37:35 PM On 12/28/2005 | - Website - |
Posted by Rob McDonagh At 03:50:12 PM On 12/28/2005 | - Website - |
The most useful function of LEI is that it extends the concept of Lotus Notes replication to all kinds of database systems. Although most LEI customers are Notes shops, it is certainly possible to do things like replicate Oracle tables with DB2. LEI provides two methods of replication: efficient (using timestamps) and brute force (using keys). Unfortunately the efficient timestamp method is useless in many scenarios because it does not permit the synchronization of deletes due to the nature of timestamp replication. This means that deleted records cannot replicate and that changes to a key field will cause duplicate records. In other words, if Mary Smith changes her name to Mary Smith Barney, then the obsolete Mary Smith will remain in the target database along with the current name.
The alternative key field-based replication method requires LEI to perform a cumbersome check of the value of every field of every record involved in the transfer.
The hack solution is simple. It involves creating a second key-based replication activity (with inserts and updates disabled) and then chaining it to the timestamp activity. In the example above, the Mary Smith record will be deleted in the second pass, as well as any other records that have been removed by users from the original database. Because only deletes are being looked for, it is fast. Only the key values are checked, and not every field value. The only side effect of this solution is the small amount of time in which a duplicate record can appear in the target database between the first and second runs. Good relational design, using ID numbers rather than names, will obviate this problem.
Thanks to Joseph Denhup of the IBM LEI programming team for his indefatigable collaboration.
--Doug Moore
Principal, IT Pros
Posted by Doug Moore At 04:55:51 PM On 01/29/2007 | - Website - |
If we did not twist Notes back then, it was not any fun, right? Putting calendars and rotating text in pop-ups (WDI), mailing live code from db to db (Nathan), using the server INI as a database (Bill Rodriguez), replacing all our variable names with single ascii special characters because we maxed out the allowable 64k limit (Me), updating fields in read-mode using window title formulas.... That stuff was some of the most fun I ever had coding.
Sometimes we have more freedom to create when we have more limitations placed on our work. There are so many options and possible paths these days, sometimes it seems that the challenges are harder to find. Or is that just old age? : )
Anyone remember my @Sort from back in the day?
Posted by Richard Davis At 03:06:08 AM On 01/06/2006 | - Website - |
http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/0b8efe21b29139ea85256f850081b53b?OpenDocument
The url link was a dead end but luckily the formula was posted.
Thanks Rock and Nate!
Posted by Curt Stone At 02:09:14 PM On 12/29/2005 | - Website - |
Maybe a kludge is above a simple "right" or "wrong" definition. Maybe it just is. Unless it's ugly and unnecessary at the same time, in which case it devolves (un-evolves?) into a WTF.
Thanks for putting me on your Righteous Hack starter list, BTW! That'll give me a little more pressure to perform during the Lotusphere session...
Posted by Julian Robichaux At 12:55:12 AM On 12/29/2005 | - Website - |
It meet's Bob's definition of being evil and prone to break easily and without warning (I should post my ACID test articles from the now defunct e-Pro Magazine).
But Kluges do not always have to be negative. Sometimes they can be looked at as a "DUH!" (new category here), as in the developers of the software should have seen something as a necessary tool or need, but it got lost in the trees.
Posted by Christopher Byrne At 12:03:11 PM On 12/29/2005 | - Website - |
Posted by Nathan T. Freeman At 01:46:58 AM On 12/30/2005 | - Website - |
http://www.lotusgeek.com/SapphireOak/LotusGeekBlog.nsf/d6plinks/ROLR-68BLSH
and your comment is #76 ("Loops are for girly-men....").
Posted by Stan Rogers At 06:54:30 AM On 12/31/2005 | - Website - |
Posted by Chris Miller At 01:44:28 PM On 12/28/2005 | - Website - |
Tom
Posted by Tom Nichols At 01:00:36 PM On 01/03/2006 | - Website - |
Hmmm... back in the day at MFJ (now Relavis) we needed a background agent that would run against all the documents in the database EVERYTIME it ran. In v3, you couldn't do that, because a background agent woult only run against documents that had changed since the last time it ran. The original solution people came up with was the "flip-flop macro," where you had two agents, one that ran and did what you wanted, and the other that ran later and tagged the documents as updated so your first process would hit them again. Of course, this model wrecked the hell out of replication, so it was a massive Kludge in the most negative sense.
The Hack that Chris Feller and I came up with was to put together a tiny API that would go in and update the MACRO note. Any update to it at all caused it to consider itself never run, and therefore process all the docs again. Slap a program doc to run the API, with the filepath & macro name as parameters, and Bob's your uncle.
I'll leave it to the reader whether this qualifies as Righteous, but it certainly allowed us to rollout some of the largest systems around in Notes 3.
And not to sound immodest, but maybe we can go back to the "two all beef patties" thread here at lotusgeek for some candidates.
Posted by Nathan T. Freeman At 06:02:46 AM On 12/29/2005 | - Website - |
Posted by Stan Rogers At 06:57:27 AM On 12/31/2005 | - Website - |
Coding a web service consumer in lotusscript, (r5, r6) saving data to a notes document (but not saving it), chaining off to a agent (passing the note ID of course) containing a stub piece of Java which then does the SOAP consuming... (Ian Tree, IBM NL)
Putting a program document with "nreplica <otherserver>" with a time period of "startup" to force clustered servers to immediately "force replication" on startup, so that cluster replicator is immediately up to date. (Scoot - EY - Australia)
Using variants to bung around class objects - "loose binding" - to defeat the load-time issues around lots of class libraries.. Shucks, that was me..
---* Bill
Posted by Wild Bill At 12:17:38 PM On 12/28/2005 | - Website - |
I think it's really cool all you guys are watching Rocky's blog.
Posted by Curt Stone At 07:46:25 AM On 01/01/2006 | - Website - |