Click here to Skip to main content

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Happy debugging! PinmemberAndrei Straut25-Sep-12 6:50 
GeneralRe: Happy debugging! Pinmemberjschell25-Sep-12 7:51 
Generalwell... Pinmembershiprat25-Sep-12 9:15 
GeneralRe: well... PinprotectorPete O'Hanlon25-Sep-12 9:53 
GeneralRe: well... Pinmembershiprat29-Oct-12 12:56 
GeneralRe: Happy debugging! PinmemberMember 822285825-Sep-12 10:03 
GeneralRe: Happy debugging! PinmemberRichard Deeming26-Sep-12 3:56 
GeneralRe: Happy debugging! Pinmemberamity200126-Sep-12 4:28 
GeneralRe: Happy debugging! PinmemberLe Gauchiste26-Sep-12 6:43 
GeneralRe: Happy debugging! Pinmembergreldak27-Sep-12 21:51 
GeneralRe: Happy debugging! Pinmemberdojohansen28-Sep-12 3:58 
GeneralRe: Happy debugging! Pinmemberzenwalker19859-Oct-12 18:04 
GeneralRe: Happy debugging! PinmemberNitin Sawant4-Dec-12 1:31 
GeneralCut out for Greenpeace... PinmemberNaerling21-Sep-12 22:27 
So my boss is like a rabbit. He just loves his greens.
 
Unclear naming should stay unclear by commenting it (helper was never used, but that's beside the point).
' A helper variable.
Dim helper As Boolean
Of course we could make clear comments in favor of properly naming our variables.
' s is a SalesOrder
s.DoSomething()
 
p.DoSomethingElse ' PurchaseOrder
The obvious also needs extra explanation.
i = nX + nY ' Add nX and nY
In case we ever want to compile our code into a beginners how-to-program book.
' Assign the value to the variable
i = 10
We just can't have enough comments!
' Refresh the screen
RefreshScreen
Keep an active log inside your code, you never know when you need it (SVN alone isn't good enough)... (date, initials, ticket number).
The fun thing about this is that when a fix is larger than a few code files it does not have to be commented.
If it is only a few code files chances are this piece of commentary is copied to each of them, sometimes in multiple places in the same file.
' 2012-09-22 N Ticket # 666.
' The client wants this fix because... Bla, bla, bla...
CallSomeMethod
Some of this guys methods are commented line by line with these kinds of comments... WTF | :WTF:
I tried to talk to him about it, but he's convinced code is unreadable and can never be understood easily by just reading it. Comments are absolutely necessary if you, or another programmer, ever want to quickly make changes to the code. This is the same guy who thinks making a seperate class for almost every method (and randomly make it non-shared/non-static or shared/static) makes code more clear and readable (and single responsibility principle is a bonus!) and who just doesn't use access modifiers out of laziness or indifference...
Of course he is my boss and has eight years of experience where I have only two (how often I had to hear that) so when I disagree with him I'm rude and inexperienced.
I guess someday I'll laugh about it Unsure | :~
It's an OO world.
public class Naerling : Lazy<Person>{
    public void DoWork(){ throw new NotImplementedException(); }
}

GeneralRe: Cut out for Greenpeace... PinprotectorAspDotNetDev24-Sep-12 6:09 
GeneralRe: Cut out for Greenpeace... PinmemberNaerling24-Sep-12 8:06 
GeneralRe: Cut out for Greenpeace... PinmemberCIDev18-Oct-12 8:19 
GeneralRefactor PinmemberClifford Nelson26-Sep-12 5:49 
GeneralRe: Cut out for Greenpeace... PinmemberCIDev18-Oct-12 8:23 
GeneralRe: Cut out for Greenpeace... PinmemberNaerling18-Oct-12 8:38 
GeneralRe: Cut out for Greenpeace... PinmemberCIDev22-Oct-12 3:11 
GeneralThey grow up so fast.. Pinmemberjim lahey19-Sep-12 23:03 
GeneralRe: They grow up so fast.. PinmemberMarcus Kramer20-Sep-12 4:55 
GeneralRe: They grow up so fast.. PinmemberBobJanova20-Sep-12 5:24 
GeneralRe: They grow up so fast.. PinprotectorAspDotNetDev21-Sep-12 6:37 
GeneralRe: They grow up so fast.. Pinmemberjim lahey21-Sep-12 7:10 
GeneralRe: They grow up so fast.. PinmemberNaerling21-Sep-12 22:04 
GeneralRe: They grow up so fast.. Pinmemberzenwalker19859-Oct-12 18:07 
GeneralRe: They grow up so fast.. Pinmemberjim lahey9-Oct-12 21:49 
GeneralC# properties and type safety PinmemberJulien Villers19-Sep-12 22:31 
GeneralRe: C# properties and type safety PinmemberAndrei Straut19-Sep-12 22:44 
GeneralRe: C# properties and type safety PinmemberJulien Villers20-Sep-12 3:29 
GeneralRe: C# properties and type safety PinmemberEddy Vluggen20-Sep-12 5:45 
GeneralRe: C# properties and type safety PinmemberJulien Villers20-Sep-12 8:30 
GeneralRe: C# properties and type safety PinmemberBobJanova20-Sep-12 6:29 
GeneralRe: C# properties and type safety [modified] PinmemberCIDev20-Sep-12 3:57 
GeneralRe: C# properties and type safety PinmemberZac Greve20-Sep-12 5:35 
GeneralRe: C# properties and type safety PinmemberSimulationofSai29-Sep-12 13:42 
GeneralC# Exception handling 101 PinmemberJulien Villers19-Sep-12 22:26 
GeneralRe: C# Exception handling 101 PinmemberAndrei Straut19-Sep-12 22:48 
GeneralRe: C# Exception handling 101 PinmemberCIDev20-Sep-12 3:10 
GeneralRe: C# Exception handling 101 PinmemberNaerling21-Sep-12 22:01 
GeneralRe: C# Exception handling 101 PinmemberJulien Villers23-Sep-12 22:55 
GeneralRe: C# Exception handling 101 PinmemberNaerling24-Sep-12 8:09 
GeneralRe: C# Exception handling 101 PinmemberJonathan C Dickinson30-Sep-12 21:51 
GeneralRe: C# Exception handling 101 PinmemberJulien Villers30-Sep-12 22:23 
QuestionWhy? PinprotectorAspDotNetDev18-Sep-12 15:27 
AnswerRe: Why? PinmemberPIEBALDconsult18-Sep-12 18:29 
GeneralRe: Why? PinprotectorAspDotNetDev18-Sep-12 18:37 
AnswerRe: Why? PinmemberAndrei Straut19-Sep-12 1:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 21 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid