• Brian (unregistered)

    This looks like my old company...Big Yellow?

  • a programmer (unregistered)

    did you nobulate your probeility properly?

  • Keloran (unregistered)

    for (comments as comment): for (comment as commen): for (commen as comme): for (comme as comm): for (comm as com): for (com as co): for (co as c): if (c == 1): return frist; else: return not enough obviouslly; endif; endfor; endfor; endfor; endfor; endfor; endfor;

  • (cs)

    Certainly their best developer must know about recursion--

    or Directory.Delete().

  • (cs)

    Everyone knows recursion is dangerous. Ask a FORTRAN programmer, they have to attach "warning, contains recursion!" signs to every function that directly or indirectly calls itself.

  • Alex (unregistered)

    on the other hand, these developers should try "developing" for embedded systems- no filesystem, no directories, no need for deletes...

    Alex

  • So Easy A Caveman Could Do It (unregistered)

    The usual joke is that early man counted "one, two, many". After much education, many of us could count indefinitely and not tire. It's interesting to imagine whether that actually works against us: there's something for developers who know that, after two or more levels, you may as well generalize to "many".

  • ClaudeSuck.de (unregistered)

    Not everybody knows recursion

  • Steve the Cynic (unregistered) in reply to So Easy A Caveman Could Do It
    So Easy A Caveman Could Do It:
    The usual joke is that early man counted "one, two, many". After much education, many of us could count indefinitely and not tire. It's interesting to imagine whether that actually works against us: there's something for developers who know that, after two or more levels, you may as well generalize to "many".
    I guess that makes our interesting number sequence: zero, one, many.
  • Resuna (unregistered) in reply to ClaudeSuck.de
    ClaudeSuck.de:
    Not everybody knows recursion
    1. If you don't know recursion you shouldn't be working as a software developer.
    1. This doesn't actually need recursion, you can maintain a directory stack manually.
  • Bosshog (unregistered) in reply to Steve the Cynic
    Steve the Cynic:
    So Easy A Caveman Could Do It:
    The usual joke is that early man counted "one, two, many". After much education, many of us could count indefinitely and not tire. It's interesting to imagine whether that actually works against us: there's something for developers who know that, after two or more levels, you may as well generalize to "many".
    I guess that makes our interesting number sequence: zero, one, many.
    FILE_NOT_FOUND
  • kjordan (unregistered)

    Interesting in the "// should be enough; if not, I can add more here" that if there are directories there he didn't even do anything with those.

  • mike5 (unregistered) in reply to Steve the Cynic
    Steve the Cynic:
    So Easy A Caveman Could Do It:
    The usual joke is that early man counted "one, two, many". After much education, many of us could count indefinitely and not tire. It's interesting to imagine whether that actually works against us: there's something for developers who know that, after two or more levels, you may as well generalize to "many".
    I guess that makes our interesting number sequence: zero, one, many.
    No, no, no! Zero came much, much later...
  • Peanut (unregistered)

    WOW!

    Thats amazing. Someone actually paid for this code?

    Recursion is where this task should be.

  • (cs) in reply to So Easy A Caveman Could Do It
    So Easy A Caveman Could Do It:
    The usual joke is that early man counted "one, two, many".
    Actually, there is still a VERY remote tribe somewhere in the world (I forget exactly where, without looking it up) who still do count in that way.
  • Anon (unregistered)

    Recursion

    re.curs.ion

    Definition:

    See recursion

  • True that (unregistered)

    Two words...

    Code reviews.

    Trot that pony out in front of the whole development team (in fact, the whole team should be trotting their ponies out at a regularly scheduled meeting) as a change to redirect, refactor and (sadly enough) educate even your best developer.

    Captcha: delenit (timely that)

  • mk (unregistered) in reply to Steve the Cynic
    Steve the Cynic :
    I guess that makes our interesting number sequence: zero, one, many.

    I don't know if you are joking, but I was taught, and believe, that "zero, one, many" is a very good design principle.

  • Spudley (unregistered) in reply to ClaudeSuck.de
    ClaudeSuck.de:
    Not everybody knows recursion

    Yes. That's because not everyone knows about recursion. (see above)

  • True that (unregistered) in reply to True that
    True that:
    Two words...

    Code reviews.

    Trot that pony out in front of the whole development team (in fact, the whole team should be trotting their ponies out at a regularly scheduled meeting) as a change to redirect, refactor and (sadly enough) educate even your best developer.

    Captcha: delenit (timely that)

    Oh bugger... make that chance, not change. More coffee!!

  • t3knomanser (unregistered) in reply to Cad Delworth

    Not technically true. That's how they talk in regular conversation, but they actually do have a real counting system. It's just the anthropologists trying to learn their language didn't ask the right questions.

  • (cs)

    Good for him. Recursion is for pussies.

  • t3knomanser (unregistered)

    Also, I should point out:

    To properly understand recursion, one must properly understand recursion.

  • TheRealWTF (unregistered) in reply to t3knomanser

    The real wtf is that the company apparently doesn't know the difference between outsourcing and offshore outsourcing.

  • arnemart (unregistered) in reply to Cad Delworth

    Actually, there are several tribes that still count like this, and one, the Pirahã, don't even have words for "one" and "two" (just for "small amount", "slightly larger amount" and "large amount"). (Source)

  • Pot-ah-to Pot-ay-to (unregistered) in reply to Resuna

    Recursion is using an implicit stack. You can always maintain a stack manually instead of using recursion. What's the difference?

  • (cs) in reply to toth
    toth:
    Good for him. Recursion is for pussies.

    Or in this case, recursion is for Java.

    Same thing.

  • arnemart (unregistered) in reply to arnemart
    arnemart:
    Actually, there are several tribes that still count like this, and one, the Pirahã, don't even have words for "one" and "two" (just for "small amount", "slightly larger amount" and "large amount"). (Source)
    Talking about "one, two, many" -- I hit "reply" instead of "quote".
  • (cs) in reply to ClaudeSuck.de
    ClaudeSuck.de:
    Not everybody knows recursion

    They do in places where your Aunt is your sister. But maybe small town hicks have trouble applying it to abstract concepts.

  • recursive ClaudeSuck (unregistered) in reply to ClaudeSuck.de
    ClaudeSuck.de:
    Not everybody knows recursion

    Not everybody knows recursion

  • t3knomanser (unregistered) in reply to Pot-ah-to Pot-ay-to

    Well, he was maintaining his stack in static code instead of a data structure. That's a problem if the depth of the environment ever changes.

  • Steve the Cynic (unregistered) in reply to mk
    mk:
    Steve the Cynic :
    I guess that makes our interesting number sequence: zero, one, many.

    I don't know if you are joking, but I was taught, and believe, that "zero, one, many" is a very good design principle.

    I was joking, but I agree completely with you.

    Well, on this point, anyway.

  • David (unregistered)

    The real WTF is ditching outsourcing because it has a 'bad rep'. If it works for you, don't change it.

  • (cs)

    If that is your best programmer I can send you a Resume!!!

    This hurts on a monday morning...

  • anon (unregistered)

    Every business is owned or subsidized by the company? Where does he live, Naples?

  • Ray Stevens (unregistered) in reply to zedhex
    zedhex:
    ClaudeSuck.de:
    Not everybody knows recursion

    They do in places where your Aunt is your sister. But maybe small town hicks have trouble applying it to abstract concepts.

    I'm my own Grandpa!

    Captcha: sagaciter

    Indeed.

  • Ikkonoishi (unregistered)

    Recursion isn't even needed here.

    FileInfo[] files = dir.GetFiles("", SearchOption.AllDirectories); foreach(FileInfo file in files) { file.Delete(); } DirectoryInfo[] subDirs = dir.GetDirectories("", SearchOption.AllDirectories); foreach(DirectoryInfo subDir in subDirs) { subDir.Delete(); }

  • (cs) in reply to Ikkonoishi
    Ikkonoishi:
    Recursion isn't even needed here.

    FileInfo[] files = dir.GetFiles("", SearchOption.AllDirectories); foreach(FileInfo file in files) { file.Delete(); } DirectoryInfo[] subDirs = dir.GetDirectories("", SearchOption.AllDirectories); foreach(DirectoryInfo subDir in subDirs) { subDir.Delete(); }

    Indeed:

    Directory.Delete(Path, true);
    
    

    (BTW- Both of these solutions use recursion at the library level)

  • HurrDurr (unregistered)

    Holy crap. All the people who say "recursion" in this thread need to get fiiiiiired. Or their own WTF entry.

    FRAMEWORK.

    Directory.Delete (like the few have mentioned) or more properly create a random directory in the system provided TEMP directory and let the system delete it.

  • Consultuning (unregistered)

    Actually, this is the kind of situation that worries me when the latest generation of programmers get to work under the new "agile" methodologies. YAGNI (you're not going to need it) advocates them just to solve the problem at hand and don't bother with abstractions or generalizations.

    In this case, the programmer could have been working with a specification that called for no more than, say, three nested folders. Who can blame him/her for not implementing a more general solution? He runs into the risk of someone pointing at the beatiful, generic solution and yell "YAGNI"

    On the other hand, a solution that specifices that this has to work for an undefined number of nested folders is not going to be understood by business folks anyway. Recursion is hard enough to understand for the average programmer, let's not even talk about explaining it outside the programming world.

    I'm not saying that "agile" is bad whatsoever, just that it does have its own drawbacks, and this is one of them. Too much focus on pragmatism can potentially lead to these kind of ridiculous situations.

    Oh, and by the way, any type of recursion can be implemented iteratively by crafting a stack data structure. It is just much more messy and un-functional programming to do so. Sometimes is more efficient, and sometimes there is no performance gain to justify the loss of readability. See, this is what worries me about the newer generations, they don't have good enough grasp of the fundamentals.

  • tovarich (unregistered) in reply to So Easy A Caveman Could Do It

    Smart early men counted "one, two, many... many-one, many-two, many-many..." etc.

  • Luca (unregistered)

    The real question here is: Why did you hire him?

  • (cs)

    So it is a tail recursive routine and has been unrolled.

    But I'm not a big fan of tail recursion because it has some serious performance problems in C#. I once ran a benchmark of using tail recursion versus inline and inline kicked a$$ versus recursion. I haven't run the same test in VB.NET, but I plan to do that and write a white paper with the results (probably to be published internally within my company at least initially).

    I have always thought of recursion as being one of those "ivory tower" things that live in the realms of theory and academia and was never meant to be used in a production system like this.

  • Tag (unregistered) in reply to topcat_arg

    This.

  • Brent (unregistered) in reply to mk
    mk:
    I don't know if you are joking, but I was taught, and believe, that "zero, one, many" is a very good design principle.

    Yep, the correct number for a limit on something is almost always zero (disallow), one (singleton), or many (no limit).

  • FIA (unregistered) in reply to Keloran
    Keloran:
    for (comments as comment): for (comment as commen): for (commen as comme): for (comme as comm): for (comm as com): for (com as co): for (co as c): if (c == 1): return frist; else: return not enough obviouslly; <snip>

    The first thing I though when seeing this was 'Oh shit, PXELinux can't find it's config file again.'

    I need to get out more.

  • John (unregistered)

    To iterate is human To recurse, divine.

  • nB (unregistered) in reply to Cad Delworth
    Cad Delworth:
    So Easy A Caveman Could Do It:
    The usual joke is that early man counted "one, two, many".
    Actually, there is still a VERY remote tribe somewhere in the world (I forget exactly where, without looking it up) who still do count in that way.
    1, 2, 3, many. It is the Hotentot tribe sub Sahara Africa. (book is: one two three infinity).
  • Jan (unregistered) in reply to TopCod3r

    Welcome back TopCod3r. Good luck.

  • Roy T. (unregistered)

    I hope by strongest he meant physically...

Leave a comment on “Should Be Enough”

Log In or post as a guest

Replying to comment #:

« Return to Article