| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |
|
This looks like my old company...Big Yellow?
|
|
did you nobulate your probeility properly?
|
|
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; |
|
Certainly their best developer must know about recursion--
or Directory.Delete(). |
|
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.
|
|
on the other hand, these developers should try "developing" for embedded systems- no filesystem, no directories, no need for deletes...
Alex |
Re: Should Be Enough
2010-03-15 09:13
•
by
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".
|
|
Not everybody knows recursion
|
Re: Should Be Enough
2010-03-15 09:18
•
by
Steve the Cynic
(unregistered)
|
I guess that makes our interesting number sequence: zero, one, many. |
Re: Should Be Enough
2010-03-15 09:25
•
by
Resuna
(unregistered)
|
1. If you don't know recursion you shouldn't be working as a software developer. 2. This doesn't actually need recursion, you can maintain a directory stack manually. |
Re: Should Be Enough
2010-03-15 09:26
•
by
Bosshog
(unregistered)
|
FILE_NOT_FOUND |
|
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.
|
Re: Should Be Enough
2010-03-15 09:27
•
by
mike5
(unregistered)
|
No, no, no! Zero came much, much later... |
|
WOW!
Thats amazing. Someone actually paid for this code? Recursion is where this task should be. |
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. |
|
Recursion
re.curs.ion Definition: See recursion |
|
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) |
I don't know if you are joking, but I was taught, and believe, that "zero, one, many" is a very good design principle. |
Re: Should Be Enough
2010-03-15 09:33
•
by
Spudley
(unregistered)
|
Yes. That's because not everyone knows about recursion. (see above) |
Re: Should Be Enough
2010-03-15 09:33
•
by
True that
(unregistered)
|
Oh bugger... make that chance, not change. More coffee!! |
Re: Should Be Enough
2010-03-15 09:33
•
by
t3knomanser
(unregistered)
|
|
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.
|
|
Good for him. Recursion is for pussies.
|
|
Also, I should point out:
To properly understand recursion, one must properly understand recursion. |
Re: Should Be Enough
2010-03-15 09:34
•
by
TheRealWTF
(unregistered)
|
|
The real wtf is that the company apparently doesn't know the difference between outsourcing and offshore outsourcing.
|
Re: Should Be Enough
2010-03-15 09:35
•
by
arnemart
(unregistered)
|
|
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)
|
Re: Should Be Enough
2010-03-15 09:36
•
by
Pot-ah-to Pot-ay-to
(unregistered)
|
|
Recursion is using an implicit stack. You can always maintain a stack manually instead of using recursion. What's the difference?
|
Or in this case, recursion is for Java. Same thing. |
Re: Should Be Enough
2010-03-15 09:37
•
by
arnemart
(unregistered)
|
Talking about "one, two, many" -- I hit "reply" instead of "quote". |
They do in places where your Aunt is your sister. But maybe small town hicks have trouble applying it to abstract concepts. |
Re: Should Be Enough
2010-03-15 09:38
•
by
recursive ClaudeSuck
(unregistered)
|
Not everybody knows recursion |
Re: Should Be Enough
2010-03-15 09:38
•
by
t3knomanser
(unregistered)
|
|
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.
|
Re: Should Be Enough
2010-03-15 09:38
•
by
Steve the Cynic
(unregistered)
|
I *was* joking, but I agree completely with you. Well, on this point, anyway. |
|
The real WTF is ditching outsourcing because it has a 'bad rep'. If it works for you, don't change it.
|
|
If that is your best programmer I can send you a Resume!!!
This hurts on a monday morning... |
|
Every business is owned or subsidized by the company? Where does he live, Naples?
|
Re: Should Be Enough
2010-03-15 09:46
•
by
Ray Stevens
(unregistered)
|
I'm my own Grandpa! Captcha: sagaciter Indeed. |
|
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) |
|
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. |
|
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. |
Re: Should Be Enough
2010-03-15 10:14
•
by
tovarich
(unregistered)
|
|
Smart early men counted "one, two, many... many-one, many-two, many-many..." etc.
|
|
The real question here is: Why did you hire him?
|
|
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. |
|
This.
|
Re: Should Be Enough
2010-03-15 10:20
•
by
Brent
(unregistered)
|
Yep, the correct number for a limit on something is almost always zero (disallow), one (singleton), or many (no limit). |
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. |
|
To iterate is human
To recurse, divine. |
1, 2, 3, many. It is the Hotentot tribe sub Sahara Africa. (book is: one two three infinity). |
|
Welcome back TopCod3r. Good luck.
|
|
I hope by strongest he meant physically...
|
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |