News for hackers. Stuff that matters.
Re:Error Handling Without Throwing Your Hands Up by justinsb on Friday February 13, 2015 @11:09AM (#9045015)
I disagree pretty strongly with the idea that: "there is no way of telling that [a method] may throw an exception". If you want reliable code, you have assume that _every_ method can throw an exception. (Or, assume that methods that don't throw are the exception, like C++ 'noexcept')

This also ignores the fact that Java considers exceptions part of the method signature. Without opening the whole can of worms as to whether that was a good or a bad design decision, it seems a little perverse to talk about Java, but then choose a language (Scala) that deliberately hides the exceptions, and then complain they are hidden.

Re:Error Handling Without Throwing Your Hands Up by noelwelsh on Friday February 13, 2015 @11:17AM (#9045061)
The implicit context here is that Underscore is a Scala consultancy, and thus the language under discussion is Scala. Many Scala developers come from a Java background (or indeed, most other languages that are not statically typed functional languages) and thus use Java idioms in Scala. "Java without the semi-colons" is the phrase used for this kind of code in the Scala community.

As for assuming that every method can throw an exception, yes in Scala and Java and most other languages you do have to have some top level exception handler. However the goal of modern type systems is to have the types an accurate reflection of effects of the method, so that the type system can catch errors for you. This post is about how you can do that.

Re:Error Handling Without Throwing Your Hands Up by legulere on Friday February 13, 2015 @07:33AM (#9043988)
Only talking about java when the code seems to be Scala is kind of confusing
Re:Error Handling Without Throwing Your Hands Up by noelwelsh on Friday February 13, 2015 @09:31AM (#9044469)
Many Scala developers come from a Java background where using exceptions is the norm, and apply Java idioms to Scala. That's why Java is mentioned. To quote: "using an idiomatic Java way of handling invalid input".
Re:Error Handling Without Throwing Your Hands Up by afandian on Friday February 13, 2015 @07:06AM (#9043915)
Not sure if American English has the phrase 'to throw up'* but to my English brain this title conjures up a very amusing but strange image.

* vomit

Re:Error Handling Without Throwing Your Hands Up by pluma on Friday February 13, 2015 @07:58AM (#9044058)
"throwing X up" is different from "throwing up X", I think[0].

Compare "I was throwing my lunch up" vs "I was throwing up my lunch". A bit like "black" + "bird" (i.e. a bird with black feathers) vs "blackbird" (i.e. any subspecies of the genus Turdus or some icterid birds) -- "throwing" + "up" (i.e. throwing something in an upwards direction) vs "throwing up" (i.e. expunging the contents of your stomach).

[0]: see http://idioms.thefreedictionary.com/throw+hands+up

Re:Error Handling Without Throwing Your Hands Up by afandian on Friday February 13, 2015 @09:24AM (#9044427)
I would understand "I was throwing my lunch up" vs "I was throwing up my lunch" to be completely equivalent.

I've never heard the form of words "to throw one's hands up", but it's obvious what it means. Therefore "throwing my hands up" and "throwing up my hands" make equal sense and are equally humorous.

(Not that it matters, of course there's no real ambiguity here)

Re:Error Handling Without Throwing Your Hands Up by noelwelsh on Friday February 13, 2015 @07:25AM (#9043963)
I don't know if the double meaning was intended, but it works in either case. :)
Re:Error Handling Without Throwing Your Hands Up by hueving on Friday February 13, 2015 @07:20AM (#9043954)
Indeed it does.

"error handling without throwing up your lunch"

Re:Error Handling Without Throwing Your Hands Up by hydrogen18 on Friday February 13, 2015 @06:18AM (#9043788)
What an interesting website. With that color scheme it appears they don't actually intend to have visitors read the text.
Re:Error Handling Without Throwing Your Hands Up by davegurnell on Friday February 13, 2015 @09:36AM (#9044493)
I had a hand in the design of this site. The font looks ok to me on OS X but too light in IE8-10. I've upped the weight in IE. Hope that helps.
Re:Error Handling Without Throwing Your Hands Up by mbrd on Friday February 13, 2015 @10:19AM (#9044728)
It has the same problem on Windows 7 + Chrome.
Re:Error Handling Without Throwing Your Hands Up by davegurnell on Friday February 13, 2015 @12:09PM (#9045374)
Sigh. Different font rendering engines. I made the font blacker too. I'll review it again next week. Thanks for the feedback, all.
Re:Error Handling Without Throwing Your Hands Up by noelwelsh on Friday February 13, 2015 @06:30AM (#9043810)
It looks fine to me on a Nexus 4, iPad 3, 2009 Macbook Pro, and two LCD monitors. Is the issue you find the text too low contrast?
Re:Error Handling Without Throwing Your Hands Up by Ensorceled on Friday February 13, 2015 @07:35AM (#9043990)
Yes. Not sure why the original commenter is being down voted, it's an accessibility nightmare as far as sufficient contrast goes. Another "Works fine for me!" from a bunch of young eyed, able bodied 30 somethings ...
Re:Error Handling Without Throwing Your Hands Up by dcuthbertson on Friday February 13, 2015 @07:58AM (#9044061)
Yes. The text is pale and thin making it more difficult to read than it should be.
Re:Error Handling Without Throwing Your Hands Up by 0942v8653 on Friday February 13, 2015 @08:53AM (#9044269)
This should help:

    document.getElementsByClassName("blog-post-content")[0].style.fontWeight = 500