Hacker Newsnew | comments | show | ask | jobs | submit | wicknicks's commentslogin
wicknicks 40 days ago | link | parent | on: Java 8 Features

Yeah, I hope I am interpreting this the wrong the way. But instead of doing

  X.getA().getB().getC().getD()
we have to

   X.flatMap(X::getA)
    .flatMap(X::getB)
    .map(X::getC)
    .orElse("UNKNOWN");  //[1]
Not sure why this is going to be better?

[1] http://www.oracle.com/technetwork/articles/java/java8-option...

-----

necubi 40 days ago | link

That's not a fair comparison, as the flatMaps are eating nulls (really Optional.empty()s) while the naked calls will throw NPEs. The equivalent code for the first case is:

  String result = "UNKNOWN";
  T a = X.getA();
  if (a != null) {
    T b = a.getB();
    if (b != null) {
      String c = b.getC();
      if (c != null) {
        result = c;
      }
    }
  }
Optional (like Scala's Option or Haskell's Maybe) are useful because they force you to reason about "empty" cases. Whereas in typical java code there is no way for the compiler to force to you handle the possibility of nulls (thus leading to NPEs), Wrapping a type in Optional forces you to deal with the case where the result is not present, leading to more correct programs. Plus, it gives you handy tools for dealing with non-present values, like allowing a chain of computation--any step of which may fail--without needing failure checks on every step.

-----


The problem is not to to just get from point A to B, but to have a good experience doing it. Air travel is getting worse every year. Starting from the airport checks to the long immigration lines (when traveling internationally) and super expensive fares for those "cuddly" seats, it can make holidays more exhausting than work. And if you live an hour from the airport, well good luck!

My idea of a grand future is when we can travel across the globe in less than hour, and pay less than $50 doing it.

-----


The above link is a summary to the paper. Here is the actual publication: http://cnlab.kaist.ac.kr/~ikjun/data/Course_work/CS642-Distr...

-----


> The world is wide open to you.

In the United States probably. The author doesn't sound too old, and says that he/she got access to the internet much later. Which means the author is probably from the Middle east or China or South Asia. The work culture there is not as open as in the west. Daily job means monotonous routine work. What excited him about the prime numbers problem was the novel aspect of it, and the fact that he was in control. Later, in his/her day job, that was no longer the case -- someone else was making the decisions. Until these nuances trickle into daily jobs, most people will sooner than later burnout.

-----

z999 281 days ago | link

Then move. To a different city or a different country. It is a very difficult thing to do but you shouldn't be miserable for a third of your day!

Get yourself some good skills and apply to jobs you really think you want instead of whatever the local industry has to offer.

-----

eru 275 days ago | link

Yes, though actually moving isn't all that hard compared to all the other things you do one a daily basis.

-----


Took me a while to figure it out too. I think the title would have been best written as "Hadoop and Go".

Its maybe because I'm new to the language, but I have to add 'lang' to all my Google searches for Go documentation/tips, otherwise the keywords are almost always misinterpreted.

-----


Rich Hickey is a genius. I love how he connected music to software engineering [1]. He should write a book on some of these topics. He has a lot more than 45 mins talks to offer to the world.

[1] http://www.infoq.com/presentations/Design-Composition-Perfor...

-----

kriro 295 days ago | link

I've been waiting for a book that elaborates on simple design a la Hickey (with some examples/code) ever since I saw the "simple made easy" talk. If there is one that I missed, I'd love to know.

-----

larve 295 days ago | link

paradigms of artificial intelligence by norvig, although seemingly about something completely different, has the same "simplicity" in its code.

-----


You should give it a try. RethinkDB, imo, embraces a lot of good ideas from the SQL world. Given a few years, I feel they will have a great DB with good ideas from both the SQL and NoSQL worlds.

-----


A precursor to the compilers class is the Formal Automata one. This is very useful in understanding fundamental computation models (what is computation, why, how can we do it etc..). I was recently reading [1] to refresh some concepts and found it to be more engaging than some of the older books on the topic.

[1] http://www.valorebooks.com/textbooks/automata-theory-and-app...

-----

wicknicks 309 days ago | link | parent | on: Kindle MatchBook

Can't wait for this feature. I am wondering if they would do the opposite: Offer paper books for a lower price to customers who own the kindle?

-----

wicknicks 309 days ago | link | parent | on: Android KitKat

Reminds me of this XKCD http://xkcd.com/927/

-----

More

Guidelines | FAQ | Lists | RSS | Bookmarklet | DMCA | News News | Bugs and Feature Requests | Y Combinator | Apply | Library | Contact

Search: