Skip to content

The Weird and The Wonderful

It was the best of code, it was the worst of code. Coding Horrors, Worst Practices, and flashes of brilliance

This category can be followed from the open social web via the handle the-weird-and-the-wonderful@forum.codeproject.com

1.8k Topics 20.7k Posts
  • The mystery function

    game-dev question
    5
    0 Votes
    5 Posts
    6 Views
    P
    I can't really believe it. I found this code in a string library I had downloaded from code project a few days before. I had not read the previous post. What are the odds? This is spooky.
  • Stupid code

    php com testing beta-testing help
    10
    0 Votes
    10 Posts
    0 Views
    J
    Even Resharper advises you to use _value.
  • The developer's golden rule, 100% true

    com collaboration career learning
    10
    0 Votes
    10 Posts
    0 Views
    F
    Almost all generalizations are stupid. "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
  • How to Train Your Programmer

    tutorial
    17
    0 Votes
    17 Posts
    2 Views
    J
    I have done things like this in the past, when I wanted to give me or other developers a hint for a possible later change. E.g. The "Name" to "2nd Parameter" correspondence could be just by chance or a quick first implementation. What I mean is: maybe "2nd Parameter" has to be localized or mapped later. If you would shorten the code with a direct assignment, I'd assume as a maintenance developer that "Name" always holds a valid "2nd Parameter to IngGenInvPs constructor. And this is maybe not true. This code is not good for other reasons (use switch, use enum, others mentioned it), but not necessarily for the obvious redundance.
  • Do you not understand booleans?

    data-structures question announcement
    65
    0 Votes
    65 Posts
    10 Views
    Y
    Sorry, no exception even for convenience. An integer is an integer, a pointer is a pointer and a boolean is a boolean.
  • Cool bitwise trick page

    html graphics tutorial
    3
    0 Votes
    3 Posts
    0 Views
    R
    +5,, Thanks for the link My Tip/Trick[^]
  • Java JDK Bug

    java php com help question
    2
    0 Votes
    2 Posts
    0 Views
    L
    Another reason for NOT using "meaningful nulls". What I actually do for the sake of effortless, by the way. [a meaningful wink to the Nullable "?" class]. Greetings - Jacek
  • Documentation failure

    database xml json
    9
    0 Votes
    9 Posts
    1 Views
    B
    Over the years I have seen lots of bad documentation; from missing specs to APIs that are just plain wrong. I am no longer surprised when the docs do not match what the app actually does. Apparently documentation is an afterthought at many companies. :sigh: Just because the code works, it doesn't mean that it is good code.
  • Illogical Logic

    announcement
    9
    0 Votes
    9 Posts
    0 Views
    D
    and that essential scope modifier, "Unused"... as in public unused Boolean FlagSomething = false;
  • Simply not Normalisation Cricket.

    design csharp database com
    13
    0 Votes
    13 Posts
    2 Views
    I
    Yeah, but remember, before xhtml came around, it was used like: <input disabled> which makes a lot of sense.
  • Converting a string to an int

    ruby performance question
    14
    0 Votes
    14 Posts
    2 Views
    R
    Sounds like you didn't RTFA: "Only primitive string processing was affected by raised exceptions" I'd describe a conversion from an string to an int as fitting that description. Generally, however, I agree - people are too fixated with the costs of exceptions. If there's any I/O going on at all, its negligible.
  • zero int?

    question
    41
    0 Votes
    41 Posts
    0 Views
    S
    Maybe he didn't mean slightly odd, but evenly odd?
  • I just found...

    php question
    5
    0 Votes
    5 Posts
    0 Views
    Sander RosselS
    Over 9GB of log fileS? Seems like you did a pretty good job. We got a xml log file that's 9GB. Opening it instantly crashes the server :) And seeing what my company logs in other applications I suspect it's 9GB full of crap that wouldn't help any programmer to fix any bug :sigh: It's an OO world. public class Naerling : Lazy<Person>{ public void DoWork(){ throw new NotImplementedException(); } }
  • Philosophy Major bad Programmer

    help
    47
    0 Votes
    47 Posts
    58 Views
    P
    For sure who doesn't want Steve to sell their stuff. Someone who can convince a planet full of people that they need some crap that they had never even seen before has to be the g8est Salesman.
  • The worst error message ever, ever

    delphi visual-studio help
    52
    0 Votes
    52 Posts
    7 Views
    P
    Spelling mistake should be "DUH" not "The" ;)
  • What could they have been thinking?

    hardware help question
    9
    0 Votes
    9 Posts
    1 Views
    P
    The way I see the engineer who wrote it was a genius and all other engineers in the company are morons who can't find such an obvious fault. The engineer might have gone on to bigger better things for sure. Damn with the company that hired the other engineers, fire them and re-hire this guy.
  • We need more keys!

    database sales announcement
    13
    0 Votes
    13 Posts
    0 Views
    P
    I have once worked with a customer database that had tables with 40 columns, no FK and PK of type varchar(50). Heck the Names column was primary key, when I asked the client what'll happen if another guy joins the Org with same name as his, he was shell shocked. :laugh:
  • How to waste time calling the database multiple times

    database tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    P
    Did you got the guy fired, cause of such guys the software can't cope up even with hardware advancements. Even with a quad core machines and GBs of RAM we still have the same performance issues we used to have in the days of Pentium I and a few MB of RAM.
  • A happy programmer

    question
    39
    0 Votes
    39 Posts
    8 Views
    A
    I bet a happy programmer isn't one who gets their post "Message Automatically Removed"
  • 0 Votes
    17 Posts
    0 Views
    V
    CDP1802 wrote: if (this == null) { throw new NullReferenceException(); } You don't know how hard we laughed when we found such one in code library. Regards Vallarasu S | BreakingDotNet.blogspot.com