Favorite Anti-Pattern



  • Let's hear it.

     http://en.wikipedia.org/wiki/Anti-pattern

    I think my favorite is:

    • Busy spin: Consuming CPU while waiting for something to happen, usually by repeated checking instead of proper messaging

     

     

     



  • I can't decide - I love them all!



  • Mine is http://en.wikipedia.org/wiki/Object_orgy

    Because everytime I write a method, I have to type this damn public/private thing!
    Like I care if something is public or private!!

    I make them all public to that I can access all the routines I need.



  • @Ice^^Heat said:

    Mine is http://en.wikipedia.org/wiki/Object_orgy

    Because everytime I write a method, I have to type this damn public/private thing!
    Like I care if something is public or private!!

    I make them all public to that I can access all the routines I need.

     

    I'd guess there are two main reasons for Object Orgy:

    a) lazyness or ignorance, as you suggest

    b) some kind of missleaded caution - in the way of "but what if I ever have access xyz..." - by people who always want to keep options open.



  • Small but subtle: Explicit comparisin to a boolean literal, then returning a boolean.

     

    if (something == true) return true;

     

    or: offloading where-clauses to script.

    select * from items;

    items.each {
       if item.id == '5'
           do things;
    }



  • Mine would have to be the "GoF love affair". It occurs when someone has just discovered design patterns, read the book, and thinks they're the greatest thing since sliced bread.

    For a while (often a long, long while) someone affliced by this will never write a dozen lines of code without thinking "where can I use a pattern here?". The probably worst cases are those in love with a specific pattern that gets used everywhere. Often Singleton.



  • @brazzy said:

    Mine would have to be the "GoF love affair". It occurs when someone has just discovered design patterns, read the book, and thinks they're the greatest thing since sliced bread.

    For a while (often a long, long while) someone affliced by this will never write a dozen lines of code without thinking "where can I use a pattern here?". The probably worst cases are those in love with a specific pattern that gets used everywhere. Often Singleton.

    See also: Java



  • @bstorer said:

    @brazzy said:

    Mine would have to be the "GoF love affair". It occurs when someone has just discovered design patterns, read the book, and thinks they're the greatest thing since sliced bread.

    For a while (often a long, long while) someone affliced by this will never write a dozen lines of code without thinking "where can I use a pattern here?". The probably worst cases are those in love with a specific pattern that gets used everywhere. Often Singleton.

    See also: Java

     

    See also: kneejerk potshots. 



  • @brazzy said:

    @bstorer said:

    @brazzy said:

    Mine would have to be the "GoF love affair". It occurs when someone has just discovered design patterns, read the book, and thinks they're the greatest thing since sliced bread.

    For a while (often a long, long while) someone affliced by this will never write a dozen lines of code without thinking "where can I use a pattern here?". The probably worst cases are those in love with a specific pattern that gets used everywhere. Often Singleton.

    See also: Java

     

    See also: kneejerk potshots. 

    See also: No sense of humor



  • @brazzy said:

    See also: kneejerk potshots. 
     

    No way, he said 'Java', not Coldfusion.



  • @dhromed said:

    Small but subtle: Explicit comparisin to a boolean literal, then returning a boolean.

     

    if (something == true) return true;


    Common in bool to BOOL conversion:

    return GetBool() == true ? YES: NO;



  • @lrucker said:

    Common in bool to BOOL conversion

    Someone fails at BOOLs. False is always 0, and true should always be (but often is not) !0. Making explicit conversion pointless, as implicit conversion will always be correct.



  • @Lingerance said:

    Someone fails at BOOLs. False is always 0, and true should always be (but often is not) !0. Making explicit conversion pointless, as implicit conversion will always be correct.

    You can't use implicit conversion in some cases. For example, if you called a C++ dll from a vb6 app (which I done back in the late 90's) , sometimes you do need to provide some explicit conversion. VB6's Boolean type does not match the bool of most other lanugages. This is just one example, I'm sure others can give some more.



  • Mine is, 'SOA is the only way' 

    I have nothing against SOA, when used correctly... but sometimes this is taken to extremes...

     Recent systems i worked on, the thinking was

     'Every service must have it's own entity model'

    'Every layer within the Service, is a 'Service' in it's own right, as 'higher layers can call multiple lower layers', therefore every layer needs it's own entity model... Every Top level service must have the same number of layers, no matter if it is necessary (we had well over a dozen layers)

     Also, as we were following SOA, the architects pontificated 'no 'entity', may have any behaviour'...This was somewhat ok when writing services to add items to a basket and go through checkout, but was more complex when writing the logistics services that worked out the optimal loading of each delivery van, in conjunction with the optimal route each van can take, and the actual route finding algorithims without being able to take any advantages of good ol' OO,

     

     



  • My favorite has to be "Everything is varchar".

    In particular when said varchar is universally chosen to be of a maximum length too small to fully store the application's actual data fed to the database. Bonus points if the application is then set up to silently fail and not inform you of truncated strings, or tosses out some nonsensical error sending you off on a wild goose chase in a completely unrelated direction.



  • I still stand by Busy Spin. If someone is using busy spin they obviously have no idea what event handling is all about. 



  • @JimBastard said:

    I still stand by Busy Spin. If someone is using busy spin they obviously have no idea what event handling is all about. 

     

    Except that not every platform has 'events'. 'Busy Spin' or polling is completely viable in many situations.



  • @MasterPlanSoftware said:

    @JimBastard said:

    I still stand by Busy Spin. If someone is using busy spin they obviously have no idea what event handling is all about. 

     

    Except that not every platform has 'events'. 'Busy Spin' or polling is completely viable in many situations.

     

     

    Maybe in the crap languages you work with. 



  • @JimBastard said:

    Maybe in the crap languages you work with. 
     

    Well considering you only know ColdFusion, I can understand your ignorance. But not every platform has high level OSes. 

     



  • @MasterFailSoftware said:

    Well considering you only know ColdFusion, I can understand your ignorance. But not every platform has high level OSes. . 

     

    I see you have been reading my resume...oh wait no you haven't.

    You are assuming that I only know one language based on........nothing. You have a complete lack of knowledge, education, or awareness............ALSO KNOWN AS ignorance. 

    To add insult to injury Coldfusion runs synchronously NOT asynchronously, so you don't have to deal with event handling on a programmical level. A line won't execute unless the previous line has completed. And yes....there are timeouts and specific functions dedicated to error handling.

    If I were you I'd probaly stop trying to diss JimBastard on this forum as it's only revealing your own level of stupidity.

    Also, don't call me ignorant you stupid fucking faggot.

     



  • After careful consideration, I name "Inner Platform Effect" as my favourite anti-pattern. Especially since it was first defined within TDWTF.

    About busy spin (aka polling): I side with MPS. In some situations, there's no way to avoid it or it just doesn't matter.



  • @JimBastard said:

    I still stand by Busy Spin. If someone is using busy spin they obviously have no idea what event handling is all about. 
    I hate to tell you this, but you can avoid busy waiting without using explicit "event handling".  All you have to do use functions which sleep, or wait for a file/network event while blocking the process.  

    On POSIX systems (there are Win32 equivalents to these functions, too, but I don't feel like looking them up right now):

    e.g.

    while ( TEST_SOME_CONDITION )

    {

        // DO SOME STUFF (OR NOT)

        sleep(1); // Wait 1 second without using 100% CPU (i.e. "blocking" wait)

    e.g.

    while (1)

    {

        poll( ... ); //  Wait for an event on a file descriptor; block process while nothing is happening

        // FD available for reading/writing.  DO SOME STUFF 


    Notice how these methods can be used in a single-threaded application with no explicit event handling.  (Sure, the system call in question may use signals to implement the process blocking and event notification, but it is all hidden from the programmer.)

    Of course, when you are writing low-level code, sometimes you may actually want to busy wait:

    http://en.wikipedia.org/wiki/Busy_spin#When_busy_waits_are_appropriate 

    @Egregious Wikipedia Quote said:

    When busy waits are appropriate

    In low-level hardware driver programming, sometimes busy waits are actually desirable. It is not practical to implement hardware interrupt-based signalling for every hardware device, particularly for devices that are seldom accessed. Sometimes it is necessary to write some sort of control data to a hardware device and then read back some sort of status data, which is not valid until several, perhaps even tens of clock cycles later. The programmer could call an operating system delay function, but more time would be spent simply performing the function call (let alone switching to an interim thread) than is required by the hardware. In such cases, it is common to implement a busy wait that keeps reading the status data until it is valid. Calling a delay function in this case would actually waste CPU time due to the comparatively large overhead involved in the function call and thread switching.

     

     



  • @JimBastard said:

    I see you have been reading my resume...oh wait no you haven't.
     

    We all know all about you, dont worry.


    @JimBastard said:

    A line won't execute unless the previous line has completed.

    As opposed to what? 

     @JimBastard said:

    diss JimBastard

    But I am not. I am insulting Russ. Making a new username for yourself and continuing your trolling doesn't change a thing.

    @JimBastard said:

    Also, don't call me ignorant you stupid fucking faggot.

    I call them like I see them. And you are truly a fucking idiot.



  • Yes, I'm the idiot.....and you're the one who thinks Russ and I are the same person.

      



  • @MasterPlanSoftware said:

    @JimBastard said:
    A line won't execute unless the previous line has completed.

    As opposed to what? 

     

     

    As oppososed to asynchronous methods.

     

     



  • You know this is really dumb. I wanted to have a quality post which would be a good read and now it's turned into complete crap because of ill informed noobs who have nothing of quality to say.

    Can we get some sort of thread moderation going on here? Something where the author can remove posts not deemed relevant?  



  • Everytime there is thread moderation, someone will start a whole dirate up about 'freedom of speech' and how Alex is curbing it and breaking a fundamental right of living... they will then, after several hundred posts storm of and then start positing about how we are all communists in some other forum.

     There are of course many variations, but nearly every forum I've seen that has been moderated heavily follows that same pattern.

     

     



  • @JimBastard said:

    Something where the author can remove posts not deemed relevant?  
     

    Right. You post that anyone who uses polling is an idiot. Myself (and several other posters)  reply that you are patently wrong and provide examples and scenarios.

     

    Doesn't seem relevant to me!



  • @Ragnax said:

    My favorite has to be "Everything is varchar".

    In particular when said varchar is universally chosen to be of a maximum length too small to fully store the application's actual data fed to the database. Bonus points if the application is then set up to silently fail and not inform you of truncated strings, or tosses out some nonsensical error sending you off on a wild goose chase in a completely unrelated direction.

     

    My favorite is its even more retarded inbreed cousin "Everything is a char".  Need a date field - char(10), Need a comments field - char(1000), need a currency field - char(20) .  Especially great for those running the application over a WAN or VPN so that you're pushing 100 times the data most of it a spaces.

     



  • I'm going with Singletonitis:


    I used to hate Singletons with the fury of a thousand burning suns but I've since relented a just a bit.  It still drives me nuts when people use them everywhere (I've seen one for a Help->About dialog launched ONLY from the menu bar).



  • @JimBastard said:

    As oppososed to asynchronous methods.

    Sometimes we forget that we are awarded some benefits when we use higher level tools. .Net for example, provides us with easy mechanism for using asynchronous methods and whatnot, but sometimes you are still limited. Having a polling loop isn't a big a WTF as you may think, especially in two major areas : embedded systems, or mission critical software. The event driven world is very nice, but sometimes its not the best idea to stake your life on it. And polling gives you a mechanism to watch for error situations more straightforward, wheras in some cases if an error occurs, you might be sitting there waiting for an event that will never happen. I'm not against event driven programming, but I'm just saying there is a time and a place for polling.  Besides, how do you think events are generated in the first place ? There is some code at the lowest level that monitors for conditions. 



  • Am I wrong in thinking that busy spin and polling are 2 separate things?  The wikipedia article seems to suggest that a "busy spin" is when you tie up 100% of the CPU while waiting for some condition.  It doesn't look like it says anything negative about sleeping a bit then polling.  In fact, it looks like it actually suggests this as an alternative:

    @Wikipedia said:

    Busy waiting itself can be made much less wasteful by using a "delay" function found on most operating systems.

    There are a few Daily WTF articles about the "true" busy spin, such as this one: Getting Better Sleep.  

    I think the OP has simply confused the "Busy Spin" antipattern with the "I don't understand how to use threads so let's just put in a lot of polling loops and hope for the best" antipattern which I'm sure we've all seen.



  • I'm saying we use moderation as a means of keeping specific threads locked into a certain format.  This would create threads that would be viable content for the front page.

    I have no interest in not allowing free speach. Everyone should have the oppurunity to express themself freely. I would just like to see a few threads that I know will be a good read, rather then the usually retard slap fight (aka flamewar). 

    Is this making sense to anyone?

    Are there any board moderators reading this thread? 



  • @JimBastard said:

    keeping specific threads locked into a certain format.
     

    This thread has stayed on course just fine. Your lame insults and your crying and whining are the only things that have approached off-topic.

    @JimBastard said:

    Are there any board moderators reading this thread? 

    No.



  • @MasterPlanSoftware said:

    @JimBastard said:

    Are there any board moderators reading this thread? 

    No.

    I like that he managed to derail his own thread with trolling.  That's almost as pathetic as only knowing ColdFusion.  He's three nines, though! 



  • @JimBastard said:

    I'm saying we use moderation as a means of keeping specific threads locked into a certain format.
    Sounds like censorship to me.  One of the things I like about these forums is the ability of us geeks to stray.  Don't fight it.

    Just because you started this thread, doesn't mean you have the right to control it.

    @JimBastard said:

    I wanted to have a quality post which would be a good read and now it's turned into complete crap because of ill informed noobs who have nothing of quality to say.
    Ignoring the fact that your English sucks, your post sucks, but flaming you has turned into a good thread.  If you want to create a good thread, start with a good OP.

    I fucking hate you.



  • @MasterPlanSoftware said:

    No.

     

    Wrong guess. Try again. 



  • @ammoQ said:

    Wrong guess. Try again. 
     

    No way man. You are just a 'regular user' remember?



  • @MasterPlanSoftware said:

    @ammoQ said:

    Wrong guess. Try again. 
     

    No way man. You are just a 'regular user' remember?

     

    I am until the situation requires me to activate my secret super power. 



  • @ammoQ said:

    I am until the situation requires me to activate my secret super power.

    Is this going to end with me locked in Room 101 being forced to drink keg after keg of vile, German beer?

     

    *sobs* 



  •  I didn't derail the thread. If you read the thread you'll see people who responded with only stupid jokes. Ohh Java hurr hurr, ohh coldfusion ahaha lolcopter, ohhh potshoottt ohh.

    U GUYZ IZ SOO FUNNY CEREALLY



  • @morbiuswilters said:

    Is this going to end with me locked in Room 101 being forced to drink keg after keg of vile, German beer?

     

    er.. actually, no. I refered to that other secret super power. The one that deletes posts and locks threads. The "locked room" power has become a bit unpopular in this country, lately.



  • @ammoQ said:

    I am until the situation requires me to activate my secret super power. 
     

    Do you wear the cape too???



  •  Alright everyone... Raise your hand if you want AmmoQ to use his superpower...

    /me raises hand!



  • @MasterPlanSoftware said:

    Do you wear the cape too??? 

    Yes, but it's invisible and so thin that you wouldn't notice it if even if you touched it. You just have to believe it's there.

    @MasterPlanSoftware said:

     Alright everyone... Raise your hand if you want AmmoQ to use his superpower...

     * MasterPlanSoftware raises hand!

     

    IMO it would be sad if this thread needs that kind of moderation, since antipatterns are per definition the main topic of TDWTF.



  • @ammoQ said:

    You just have to believe it's there.
     

    I believe! I believe!

    @ammoQ said:

    IMO it would be sad if this thread needs that kind of moderation, since antipatterns are per definition the main topic of TDWTF.

    I would agree. Can we keep the thread and lose JimBastard?

    He is currently busy trolling the IRC as well.

    Ban him across the board! All the cool forums are doing it!



  • Lol he wants me banned.



  • Only Alex can ban users. Though that probably would not prevent him from registering by another name.

    Anyway, banning users is IMO only a last resort in very extreme cases (WoW gold spammers etc.), and I don't see any reason at all in this particular case. By my experience, trolls who do not really mean to contribute to the forum. Does anybody remember TubeRodent?



  • @ammoQ said:

    Does anybody remember TubeRodent?
     

    Shhhhhhhh! We don't need him back here.



  • @ammoQ said:

    Does anybody remember TubeRodent?

    I heard that if you stand in front of a monitor with Visual Studio running late at night and say his name three times, he'll appear and start bashing CEWPs and all the idiots he's worked for.

    On topic, I'd have to say Big Ball of Mud.  Mainly because the worthless system I have to maintain, at least until next week, is a classic example of such a beast - everything just hacked together without rhyme, reason or even basic architectural skills. 


Log in to reply