The last bit of advice from Chad Fowler's
52 ways to save your job was to
be a generalist, so this week's version is the obvious opposite: to be a specialist.
The intersection point between the two seemingly disparate pieces of advice is that you shouldn't use your lack of experience in multiple technologies to call yourself a specialist in another. Just because you
develop in Java to the exclusion of .NET (or anything else) doesn't make you a Java specialist. To call yourself that,
you need to be "the authority" on all things Java.
Chad mentions a measure he used to assess a job candidate's depth of knowledge in Java: a question of how to make the
JVM crash.
I'm definitely lacking in this regard. I've got a pretty good handle on Java, Ruby, and ColdFusion. I've done a small amount of work in .NET and have been adding to that recently. I can certainly write a program that will crash - but can I write one to crash the virtual
machine (or CLR)?
I can relunctantly write small programs in C/C++, but I'm unlikely to have the patience to trace through a large program for fun. I might even still be able to figure out some assembly language if you gave me enough time. Certainly in these lower level items it's not hard to find a way to crash. It's
probably harder to
avoid it, in fact.
In ColdFusion, I've crashed the CF Server by simply writing recursive templates (those that
cfinclude
themselves). (However, I don't know if that still works.) In Java and .NET, I wouldn't know where to start. What about crashing a browser with JavaScript?
So Chad mentions that you should know the internals of JVM and CLR. I should know how JavaScript works in the browser and not just how to
getElementById()
. With that in mind, these things are going on the to-learn list - the goal being to find a way to crash each of them.
Ideas?
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Leave a comment
just crash it all
loop from one to 10 trillion
Posted by matt
on Sep 25, 2007 at 10:03 AM UTC - 6 hrs
Hi Matt- Thanks for the comments.
Would that compile (or would the compiler say that is too large of a number)? I'm confident that it would in C/C++ (or, at least it would not let me compile if I was trying to create an array that large), but I'm not sure about the others.
Running out of memory seems like a good way to crash it, but for that I'd need to create objects - not just iterate some large number of times.
I'll give it a shot some time just to try it out.
Posted by
Sam
on Sep 25, 2007 at 11:06 AM UTC - 6 hrs
Fun question!
One idea is to try and cause a stack overflow. You can do this with a recursive function that actually terminates (in theory!), but then call it with a huge value.
One thing to do is to *not* write it tail-recursively, as many compilers are smart enough to turn that into stack-friendly iterative code.
Try something like a simple non-tail-recursive factorial:
(defun fact (n)
(cond ((<= n 0) 1)
(t (* n (fact (- n 1))))))
(Note that I have the halt condition as (<= n 0), as I truly want this function to be convergent everywhere, not just for the non-negative inputs where it is classically defined.)
And call it upon something like 100000000:
(fact 100000000)
I can imagine that doing this in Java might crash the JVM with a stack-overflow. But, then again, I have no clue as to how clever these VM's are. I'm intrigued to learn!
Posted by
Grant
on Sep 25, 2007 at 06:58 PM UTC - 6 hrs
Hey, Sam,
I wonder, did you ever see if this works? Now I'm curious as to how clever the JVM is... :)
Grant
Posted by
grant
on Oct 01, 2007 at 06:51 PM UTC - 6 hrs
Hey Grant. I haven't taken the time to do it yet - I've been swamped on game programming in .NET and have yet to write a line of Java since then.
But, I do have your last message in my "action required" folder =)
I hope to have some free time by the weekend - this week I've got homeworks/presentation + work, so its been a long few days preparing for it all! =)
Posted by
Sam
on Oct 02, 2007 at 05:47 AM UTC - 6 hrs
Damn... I didn't realized it's been a week already! Guess I'm more backed up than I thought =)
Posted by
Sam
on Oct 02, 2007 at 05:50 AM UTC - 6 hrs
Sounds fun! I don't know anything about game programming. What kind of stuff are you doing?
P.S. It'd be interesting to see what happens in .NET when you try that factorial stack-breaker, too... :)
Posted by Grant
on Oct 04, 2007 at 11:35 AM UTC - 6 hrs
I'm basically making a 3D 3rd-person game in the vein of Super Mario Bros. with a twist. I'm using the XNA framework which will deploy to XBox 360, so that's kind of cool. I'm planning on writing a bit about it when I find the time.
I'll see if I can find a way to break .NET while I'm at it. =)
Posted by
Sam
on Oct 04, 2007 at 01:34 PM UTC - 6 hrs
Thanks Steev. I have yet to revisit this, so when I do, I'll give Ackermann a call.
Posted by
Sam
on Nov 02, 2007 at 05:41 AM UTC - 6 hrs
Leave a comment