Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive



This was in some very old VB6 COM+ production code, that I yanked when I found it. The dev was in a bad mood at having to learn xml:

Do Until InStr(1, sXML_Input, " <question", vbTextCompare) = 0

i = i + 1

sXML_Input = Replace(sXML_Input, "

<question", "Bah!", 1, 1, vbTextCompare)


Do Until InStr(1, sXML_Input, "Bah!", vbTextCompare) = 0

sXML_Input = Replace(sXML_Input, "Bah!", "

<question", 1, 1, vbTextCompare)


This was the best his code was riddled with string manipulation on an XML string (splitting into an array on >< and then loading each element into a dom), that is just to pathetic and sad to post. But any time I need a morale boost I just go reread his old crud;-)

Ken Sykora

You should check out the daily wtf (thedailywtf.com). All kinds of gold in that mine.

Francois Germain

We used to joke a lot around the office when I found out that one of my peer was actually trimming the length of the recordcount property of ADO recordsets all over our import and export back end.

dim rstTest as adodb.recordset

set rstTest = library.sqlserver.getrecordset(strsql)

if len(trim(rstTest.recordcount)) = 0 then

'Do some work

End if

I was so happy when this guy left... :)


Once upon a time, I saw this in some production C code:




/* obviously, this is always true */



Benny Thomas

@Francois Germain

Code like that was in 2 big productionsystems written by a coworker of mine.

One other big issue I had with his codingstyle was his argument for writing long transactional scripts because he liked to see everthing the code did.

He invented his own law to. There should never be more then 3 method steps in code before you find the code that writes the data to the database. His coding was not PI can you say.

Needless to say, I left that company.


Taken from thedailywtf.com/.../...erFridaySmorgasbord_.aspx

Scott Stanchfield was tasked with optimizing memory usage in a Java application and found a way to shave a few bytes left in by an intern with a sense of humor ...

public class ValidationMessage


//internal members

string messageId;

string messageText;

string helpLink;

/* ... */

double cheeseburger;

char broiled;

long time;

//helper functions

/* ... */



It's been a while and since I don't work there anymore I won't be entirely accurate on the method name. But...

At a former company we were doing a code review. I came across a method that looked a little fishy:

private bool ThisIsNotTheContactWeAreLookingFor(...){ ... }

Of course, I raised question of if we should be injecting Jedi mind tricks into our code.


I have been reviewing an application written by some folks off-site. They took a convention of prefixing classes, methods, members, etc with a common two or three letter prefix related to the business function that the class/method/member supported.

One of the main components of the application deals with 'Assessments', and for some reason they chose to use 'ass' as the prefix. This obviously made for some pretty funny method names, but my favorite so far is a method that loads assessments on the screen, aptly called:

'Private Sub AssLoad()'

Frank Quednau

In VB Code I always wrote "On Error Goto Hell". We quite liked the idea in java of writing "throws Shit".

Back in the days when I was in full Procedural steam and wrote a massive servlet handling all sorts of web forms, I used an ASCII-art of the Simpsons Family to separate two sections of the file. Suffice to say, the customer at some point got their hands on the code (also finding the comment "this *** is a dealer" and the int "my***index").

Back then I had to apologize to the customer. What a bunch of humourless saps. I think that's when I got traumatized. Now I only write the bare minimum of code that will do the trick. Oh, and the files are smaller. Reduces the pain.

Yoni Shalom

An autocomplete function :

public List <isearchresult ISpyWithMyLittleEyeSomethingThatStartsWith(string prefix) {...}.


Yoni Shalom

Racist code is sometimes nice too, if taken in right proportions :

function :

public void StartTransfer(IList <object objects);

test code :

IList <object palestinians = /* initialization... */;


Mike Minutillo

The other day for a demonstration of extension methods I got to write:

public static bool IsIn <t(this T wally, IEnumerable <t crowd )


return crowd.Contains( wally );


I'm also a big fan of naming things correctly but not getting hung up on it if you can't think of a good name (after all we have refactoring tools) so for a while I had a system with repositories that implemented ICanGetYouA


string body = message.Body.ToString();

string [] bodyparts = body.Split(',');

string head = bodyparts[0]

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats