Geoff Thompson found a rather obnoxious pattern in his former co-worker's code; all of the "important" methods had a "confirmation" argument that you had to set to true. You know, just in case you accidentally called the method ...
Public Sub ResetCase(Optional ByVal bRestart As Boolean = False) If bRestart Then objUtils.ResetCase(bRestart) End If End Sub
Next up we have a bit of code that Mike Lee came across in some code that he his evil twin had written. I dunno, maybe this isn't so bad. I can see it useful if they ever decide to change the symmetric property of equality ...
if((0 == DblSpread) || (0 == DblSpread)) SwapGrid.GetCellRange(RowNumber, SwapGrid.Cols[ColDblSpread].Index).Clear(C1.Win.C1FlexGrid.ClearFlags.All); else { SwapGrid[RowNumber, ColDblSpread] = DblSpread; cr = SwapGrid.GetCellRange(RowNumber, SwapGrid.Cols[ColDblSpread].Index); cr.Style = StyleBidDblBoldSpread; }
Here's a platform we don't see to often: XSL. Actually, that's a good thing. Nothing worse than putting all of your business logic in XML style sheets. Especially when it's written like this snippet from Shane Blake
<xsl:choose> <xsl:when test="$isValid!='true'"> <xsl:attribute name="class">enabledDiv</xsl:attribute> </xsl:when> <xsl:when test="$isValid!='true'"> <xsl:attribute name="class">disabledDiv</xsl:attribute> </xsl:when> <xsl:otherwise/> </xsl:choose>
Speaking of platforms we don't see too often, here's some Perl that Augie Schwer came across ...
sendmail(%email) || &fail; if($failed == 1) { push @ret, "Couldn't send Request: $Mail::Sendmail::error\n"; push @ret, &pReturn; } else { push @ret, "Request Successfully sent\n"; push @ret, &pReturn; } sub fail { $failed = 1; }
Eric Casto came across some code written by a co-worker who really wanted to make sure his bases were covered ...
if (connected || !connected) { //ED: Snip }
And finally here's the barebones of a 400+ line function that saiti came across called SearchForString. The function is responsible for searching for a string in another string ...
if(searchingAll) { //ED: Snip if(!AllSearching) { //ED: Snip if(!searchAll) { //ED: Snip } } }