6 ms·
There's still a lot of getters everywhere though, which seemed to me to be the bulk of the analogy. this.wallet = colleague.getWallet(); Code blocks are d
by bencoder 11y ago
There's still a lot of getters everywhere though, which seemed to me to be the bulk of the analogy.
this.wallet = colleague.getWallet();
Code blocks are done with 4 space indentation at the start
- reitanqild 11y agoWhich is not a fault of the Java language: trainwrecks (this->getThat()->getThose()-foreach(){ do stuff } is a general antipattern. The correct way is IMO: colleague.getMoney() which can easily be implemented in Java, PHP etc. I'm getting a bit tired of this constant pecking at Java (nothing personal). There are a number of questionable designs yes, there is a lot of ugly code out there, yes, but almost every alternative might have been worse: Teaching everyone C? Good luck. Switch to C#? Until recently that would prevent you from using Linux on your servers unless you were ready to put in technical effort and bet on MS not suing you or the upstream effort. Perl? PHP? Catch my drift folks? Java filled a niche. It was almost as easy as PHP once you got started (although onboarding still is messy I think) and provided superior tooling.
- woah 11y agoI think people just hate all the hoops you have to jump through to satisfy arbitrary constraints the language places upon you to conform to some pedantic definition of object orientation that only works well in textbook examples. Not saying Java isn't a good choice for some things. Also, if functional programming languages were more popular, they would probably be subjected to the same ridicule for the same reasons.
- sevensor 11y agoBy the same token, I think the superior tooling is part of the reason people who aren't primarily Java users find it incredibly painful. I've seen Eclipse experts in action -- most of the work seems to be picking the right thing from a drop-down. All kinds of things just appear where they're needed. Accustomed as I am to typing source code, I can't quite get my head around it.
- bencoder 11y agoDespite the name, I didn't see the article as taking a pop specifically at Java. It seemed more about bad OOP in general. As you say, you'll see the same patterns in every OO language.
- lmm 11y agoThe story is explicitly about a bad citizen in Javaland.
- workitout 11y ago>> Which is not a fault of the Java language: trainwrecks (this->getThat()->getThose()-foreach(){ do stuff } is a general antipattern. While I agree with you, isn't that what the new streams in Java does? The map reduce complex?
- steveklabnik 11y agoyou only need two spaces, actually https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc