Article 6SAYQ CodeSOD: Recursive Search

CodeSOD: Recursive Search

by
Remy Porter
from The Daily WTF on (#6SAYQ)
Story Image

Sometimes, there's code so bad you simply know it's unused and never called. Bernard sends us one such method, in Java:

 /** * Finds a <code>GroupEntity</code> by group number. * * @param group the group number. * @return the <code>GroupEntity</code> object. */ public static GroupEntity find(String group) { return GroupEntity.find(group); }

This is a static method on the GroupEntity class called find, which calls a static method on the GroupEntity class called find, which calls a static method on the GroupEntity class called find and it goes on and on my friend.

Clearly, this is a mistake. Bernard didn't supply much more context, so perhaps the String was supposed to be turned into some other type, and there's an overload which would break the recursion. Regardless, there was an antediluvian ticket on the backlog requesting that the feature to allow finding groups via a search input that no one had yet worked on.

I'm sure they'll get around to it, once the first call finishes.

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments