- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
This looks like my old company...Big Yellow?
Admin
did you nobulate your probeility properly?
Admin
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;
Admin
Certainly their best developer must know about recursion--
or Directory.Delete().
Admin
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.
Admin
on the other hand, these developers should try "developing" for embedded systems- no filesystem, no directories, no need for deletes...
Alex
Admin
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".
Admin
Not everybody knows recursion
Admin
Admin
Admin
Admin
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.
Admin
Admin
WOW!
Thats amazing. Someone actually paid for this code?
Recursion is where this task should be.
Admin
Admin
Recursion
re.curs.ion
Definition:
See recursion
Admin
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)
Admin
I don't know if you are joking, but I was taught, and believe, that "zero, one, many" is a very good design principle.
Admin
Yes. That's because not everyone knows about recursion. (see above)
Admin
Oh bugger... make that chance, not change. More coffee!!
Admin
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.
Admin
Good for him. Recursion is for pussies.
Admin
Also, I should point out:
To properly understand recursion, one must properly understand recursion.
Admin
The real wtf is that the company apparently doesn't know the difference between outsourcing and offshore outsourcing.
Admin
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)
Admin
Recursion is using an implicit stack. You can always maintain a stack manually instead of using recursion. What's the difference?
Admin
Or in this case, recursion is for Java.
Same thing.
Admin
Admin
They do in places where your Aunt is your sister. But maybe small town hicks have trouble applying it to abstract concepts.
Admin
Not everybody knows recursion
Admin
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.
Admin
Well, on this point, anyway.
Admin
The real WTF is ditching outsourcing because it has a 'bad rep'. If it works for you, don't change it.
Admin
If that is your best programmer I can send you a Resume!!!
This hurts on a monday morning...
Admin
Every business is owned or subsidized by the company? Where does he live, Naples?
Admin
I'm my own Grandpa!
Captcha: sagaciter
Indeed.
Admin
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(); }
Admin
Indeed:
(BTW- Both of these solutions use recursion at the library level)
Admin
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.
Admin
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.
Admin
Smart early men counted "one, two, many... many-one, many-two, many-many..." etc.
Admin
The real question here is: Why did you hire him?
Admin
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.
Admin
This.
Admin
Yep, the correct number for a limit on something is almost always zero (disallow), one (singleton), or many (no limit).
Admin
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.
Admin
To iterate is human To recurse, divine.
Admin
Admin
Welcome back TopCod3r. Good luck.
Admin
I hope by strongest he meant physically...