TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why I like Java

339 点作者 snupples大约 11 年前

76 条评论

chavesn大约 11 年前
This is one of those criticisms that sounds right if you know a little bit about the topic, and is certainly clever enough in and of itself to make the reader think that it&#x27;s making a good point.<p>But it&#x27;s not making a good point. It&#x27;s not even close. I wish people would stop voting it up.<p>- <i>&quot;In Java, you can forget about doing it in the cleanest or the best way, because that is impossible.&quot;</i> -- cleanest in any language? Or cleanest for Java? Of course the &quot;cleanest&quot; way for Java is possible, and it does matter -- there is a huge difference between &quot;clean&quot; Java and unclean, and anyone who says otherwise is a Java pretender. And arguing about &quot;cleanest for any language&quot; is just a proxy for a language flamewar.<p>- <i>&quot;And nobody can glare at you and demand to know why you used 576 classes when you should have used 50, because in Java doing it with only 50 classes is probably impossible.&quot;</i> -- The &quot;Har-har-so-many-classes-and-don&#x27;t-even-get-me-started-on-variable-names&quot; argument. In Java, as in any language, you can over-design, or you can under-design, or you can design just what you need. The number of classes may end up higher than in other languages, but this argument is silly and tired, and yes, length is one of the tradeoffs of Java. An IDE (gasp!) should make that largely irrelevant.<p>- <i>&quot;The code was ridiculously verbose, of course, but that was not my fault. It was all out of my hands.&quot;</i> -- This word &quot;verbose&quot; keeps being thrown around as an insult, but nobody brings up the tradeoffs. Verbosity has a purpose, just like brevity and terseness do. And of course it&#x27;s never out of the programmers&#x27; hands. Once given a language, it&#x27;s all relative.<p>There&#x27;s more, but I&#x27;m arguing with a person who believes that a question about stdin and stdout is a proper gateway for measuring skill <i>toward any programming problem ever</i>.
评论 #7464582 未加载
评论 #7464583 未加载
评论 #7464656 未加载
评论 #7465778 未加载
评论 #7465537 未加载
评论 #7468595 未加载
评论 #7473075 未加载
stephen大约 11 年前
&gt; So yes, I enjoyed programming in Java, and being relieved of the responsibility for producing a quality product.<p>Wow. What a pompous thing to say.<p>How does this have 91 points and is on the front page of HN?<p>Per the &quot;most horrible answers were in Java&quot;, personally, I think he&#x27;s missing selection bias, in that many newbie programmers who wouldn&#x27;t know what they were doing in <i>any</i> language, think they &quot;know&quot; Java because they took a class on it.<p>I have no problem reading critiques of Java, not concise&#x2F;etc., and like Scala&#x2F;etc. as much as the next guy, but &quot;relieved of the responsibility for producing a quality product&quot;? Wow.<p>I suppose I&#x27;ll add the disclaimer that if his 3 years of putting in time writing Java were doing J2EE, then I&#x27;ll understand where he&#x27;s coming from. But that&#x27;s not the language.
评论 #7464596 未加载
评论 #7464402 未加载
评论 #7464407 未加载
评论 #7464263 未加载
评论 #7465128 未加载
评论 #7464452 未加载
评论 #7464398 未加载
评论 #7469944 未加载
SCdF大约 11 年前
So I was a Java developer from 2006-2012. I still occasionally touch Java at work.<p>Off the top of my head, right now, in this text box, without google, I can&#x27;t write the code to copy standard input to standard output.<p>System.out.println(System.in)? That&#x27;s wrong. You need some kind of InputReader, or BufferedInputReader, or Buffered...something. I think System.in is an InputStream, so presumably I need to do new InputReader(System.in)? Or BufferedInputReader? Should I buffer the output?<p>Ok, let&#x27;s do some API googling (ie, not StackOverflow).<p>So I was... pretty wrong. I think what you want is:<p>public class CopyInput { public static void main(String[] args) { while (true) System.out.write(System.in.read); } }<p>I haven&#x27;t tried to run this though.<p>In my defence, I have never, in all my years of working, had to ever read standard input, let alone write it out again.
评论 #7464525 未加载
评论 #7464669 未加载
评论 #7465807 未加载
评论 #7468562 未加载
huherto大约 11 年前
I don&#x27;t know why so many cool programmers hate Java. Sure the library is too big and sometimes is hard to find the proper stream class. Or the Date class is antiquated.<p>Ignoring that, what I like about java is that my programs are clear, and that once I compile my programs, they just work. I can refactor my code, and the compiler makes sure that I don forget anything. I don&#x27;t love it they way I loved Perl or C. But when I write Java, I feel confident that my program is not going to break; and even if it breaks a stack exception is going to point me directly to the offending line.<p>Of course you don&#x27;t have to use 25 Design Patterns at the same time. But lets not blame Gosling for that, that is the fault of the &quot;Enterprise Architects&quot;, I still think you can write good tight java code.
评论 #7464211 未加载
评论 #7464108 未加载
评论 #7464146 未加载
评论 #7464487 未加载
评论 #7464353 未加载
vijucat大约 11 年前
&quot;Look, he couldn&#x27;t even copy stdin to stdout, LOLOL&quot;.<p>The most probable reason for the failure is because Java is not used in industry that much as a shell programming environment. The most common use case for Java is as a server-side, long-running server, with C++-like performance and without C++-like headaches. I work with algorithmic trading engines in my job. Though I trade personally these days and the orders are small, the engines I implemented for banks typically handle $250m worth orders per stock exchange. I have NEVER, not in a single instance in the last 5 years, have had to read from stdin in Java. Why : in my particular niche in my industry, input comes via a socket that is abstracted away by an engine that implements the FIX (Financial Information eXchange) protocol. For all practical purposes, in the finance industry, the FIX library &#x2F; server IS stdin and stdout. This doesn&#x27;t make a colleague of mine who forgot how to access stdin in Java a nincompoop. It&#x27;s a failure to remember what is rarely used, not a failure to perform basic job duties. See the difference?<p>I believe the author is &#x2F; was a Perl expert? That&#x27;s why he thinks being able to read stdin is &quot;so basic&quot;. I challenge the author to confront his prejudices : hire a few candidates who fail the stdin &#x2F; stdout test. If they are allowed to do the damn work instead of jumping through your Perl-shaped hoops, they might have actually done quite well on the job.<p>Similarly, many Perl programmers would fail a test devised by someone who is used to Java.
评论 #7466751 未加载
noname123大约 11 年前
JVM is the best like the Swiss Army of creating good superficial impression.<p>Want to show off to the web CRUD hipsters, you can go Groovy, Grails and Play framework.<p>Want to show off to the Enterprise architect astronauts, you can go Hibernate, Spring, ElasticSearch and JBoss.<p>Want to show off to the Big Data ivory tower academics, you can go Weka, Lucene, Hadoop and Scala.<p>Want to show off to the esoteric language hipsters, you can go Clojure, JRuby, Jython, JScheme and Rhino.<p>Sun Microsystems and applets on IE6 live on in my big heart warmed up by hot cup of cappuccino beans.
评论 #7464281 未加载
评论 #7464998 未加载
matdrewin大约 11 年前
Never understood the hate towards Java on HN. Java is not perfect by any means but every one of the other languages he mentions in that article (Perl, Python, Ruby, JavaScript) also has their shortcomings. People focus way too much on technology and not enough on the results.<p>It reminds me of a great post by Coda Hale a couple of years back where he was explaining why he switched back to Java from Scala (which was hot shit on HN at the time):<p><a href="http://codahale.com/the-rest-of-the-story/" rel="nofollow">http:&#x2F;&#x2F;codahale.com&#x2F;the-rest-of-the-story&#x2F;</a><p>&quot;The world has yet to take me aside and ask me for my opinion of it, and in the past few years I’ve found that it’s far more profitable to build things rather than tilt at windmills.&quot;
评论 #7464229 未加载
评论 #7464693 未加载
评论 #7464636 未加载
评论 #7464448 未加载
rdtsc大约 11 年前
A language is a tool.<p>Some people obsess over the tool itself. My tool has these 10 features, and it was hand crafted and it can solve 8 Queen problem in 2 lines and it has monads or a cute puppy for a mascot and so on. People who use tools obsess about them, and it kind of becomes the end not just a means to an end. They would read about the new features in the language, they would run over tutorials in their free time and so on. There is a good amount of pleasure derived from fawning over the tool itself.<p>Others don&#x27;t care about the language or the framework, they just want to job to be done and get paid. It turns out that some part of code they are working on is written in FORTRAN, COBOL, or (oh the horror!) MUMPS, that won&#x27;t bother them much. They&#x27;ll just figure it out and fix the issue. The pleasure comes from getting paid and solving the business problem at hand.<p>Both are extremes and there is a continuum between the two on which most people fall. Neither extreme I think is healthy and at the same time there are good parts about each one --<p>Someone who cares about the tools they are using will probably also use the tool better and more effectively. Someone who is picky about the type of hammers and their design and knows the history is also probably pretty good at hammering nails in. They might spend $1000 for a titanium hammer but hey they will be good at it.<p>Also someone who cares to get the job done and derives pleasure from solving a business problem, might just be the one keeping the product&#x2F;company&#x2F;startup afloat. Making money and delivering products is the top goal of most companies. This often means what seem to be boring, old, broken, unfashionable frameworks or tools. But so what, look we are still getting a paycheck!<p>There is a validity in both.
评论 #7464415 未加载
评论 #7464133 未加载
评论 #7464345 未加载
eranation大约 11 年前
&gt; In Java, you can forget about doing it in the cleanest or the best way, because that is impossible. Whatever you do, however hard you try, the code will come out mediocre, verbose, redundant, and bloated<p>(reason for liking Java)<p>Well, here are some other reason for liking Java: <a href="https://medium.com/i-m-h-o/da3b2c180e9c" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;i-m-h-o&#x2F;da3b2c180e9c</a><p>But I really believe the future of software is affected more by having better programmers rather than having better languages.<p>Yes, it helps to have cool languages like Julia, Nimrod, Rust, even Scala (which I think is the best statically typed JVM language out there). But I tend to think that a good developer will be good in any language, Haskell, C, Java or LOLCODE.<p>I think that a good developer &quot;forced&quot; to use Java will find tools that bring out the good parts of the language: Dropwizard, Play framework &#x2F; Akka, even latest versions of Spring and Java EE are much more convention over configuration and lightweight than before. They will use Guava and Apache commons to streamline common Java verbosity and bloat. They&#x27;ll use Java 8 which allows much more robust and concise syntax to common problems.<p>But I don&#x27;t think that the language is the problem. I think that a great developer will be able to tackle any problem with the language itself easily, because the real problem is not how to implement X, but more what is X. Designing the software correctly is the main problem at hand, not how to move input to output. This is what stackoverflow is for.<p>One last point about this all &quot;I hate&#x2F;like Java&quot; type of post<p>1) If you write Java for your day job and hate it, either try to introduce something else (Clojure &#x2F; Scala &#x2F; Java 8 &#x2F; Kotlin) If you can&#x27;t introduce any of these then either accept your fate or just quit and find another job. If you can&#x27;t find another job, then perhaps you deserve to stay and write Java so stop whining, it&#x27;s not that bad (and one day you&#x27;ll get to use Java 8).<p>2) If you don&#x27;t write java for your day job but as a freelancer - start getting other non-java gigs. Not so many non Java jobs? well, continue to write Java bashing blog posts until people will stop using it I guess...<p>3) If you don&#x27;t write Java for your day job or as a freelancer, then just stop complaining about it. There are million of other things (not just programming languages) out there worth complaining about. They can use your writing talent for a better cause.
评论 #7464226 未加载
评论 #7464564 未加载
评论 #7463984 未加载
评论 #7464342 未加载
评论 #7464025 未加载
Pitarou大约 11 年前
You may well be thinking, &quot;Can it really be that hard to figure out how to open <i>stdin</i>?&quot; Having just attempted it, I can confirm that it&#x27;s hard. Shockingly hard. I could have easily failed that test.<p>I consider myself a fairly competent programmer, and I have a <i>little</i> knowledge of Java, including building GUIs and so on. Here&#x27;s the Hello World program off the top of my head:<p><pre><code> public class HelloWorld { public static void main(String[] args) { System.out.println(&quot;Hello World.&quot;); } } </code></pre> So to answer the interview question, I just need to figure out how to open <i>stdin</i>. At a guess, maybe something like <i>System.in.readln</i> will do it? Let&#x27;s look in the class libraries.<p>Bingo! I&#x27;ve found <i>System.in</i>, and it says it&#x27;s an <i>InputStream</i>. So now I just need to find ... ah ... there are three of them. Is <i>System.in</i> a <i>java.io.InputStream</i>, <i>org.omg.CORBA_2_3.portable.InputStream</i>, or <i>org.omg.CORBA.portable.InputStream</i>? The documentation doesn&#x27;t say.<p>Well, I have a vague idea of what CORBA is, and I don&#x27;t think I&#x27;m using CORBA here, so it must be <i>java.io</i>. Good first problem solved. Now, what methods can I use?<p><pre><code> abstract int System.in.read() int System.in.read(byte [] b) int System.in.read(byte [] b, int off, int len) </code></pre> These methods just read bytes! I want a <i>String</i>, or at least a <i>char</i>. And Java uses multibyte characters. Can I get away with casting <i>bytes</i> to <i>chars</i>? I don&#x27;t know. Maybe it was one of the CORBA methods after all? Or maybe ... I&#x27;m stuck!<p>I figured it out in the end, but only through pure luck: I need to wrap <i>System.in</i> in a <i>java.io.InputStreamReader</i>.
评论 #7466081 未加载
espinchi大约 11 年前
I think the author takes it a bit too far: <i>It&#x27;s possible that the Java programmers have valuable skills that we could use, despite their inability to produce even a trivial working program in a short amount of time.</i><p>The fact that I&#x2F;O management is cumbersome in Java doesn&#x27;t relate to the ability of Java programmers to provide value.
评论 #7463992 未加载
dminor大约 11 年前
If you&#x27;re writing mediocre code and are happy with it, the problem might not lie with the language.
评论 #7464009 未加载
评论 #7464052 未加载
评论 #7464457 未加载
sadfnjksdf大约 11 年前
&gt; I was a professional Java programmer for three years<p>3 years is about the amount of time it took me to get a false sense of security in my understanding of a language, imo. After 3 years i thought I knew Java. After 3 years I thought I knew Ruby. I was wrong.<p>BTW- if I were to receive a question on my application asking how to read stdin and write stdout, that would be a bad sign.<p>&gt; So yes, I enjoyed programming in Java, and being relieved of the responsibility for producing a quality product.<p>Many quality products I use have been written in Java.<p>&gt; It was pleasant to not have to worry about whether I was doing a good job, or whether I might be writing something hard to understand or to maintain.<p>Though, I understand the intended meaning of &quot;Java is too verbose&quot;, You can write code in Java that is easier to maintain. Java is not an excuse for poorly written code.<p>&gt; The code was ridiculously verbose, of course, but that was not my fault. It was all out of my hands.<p>You get paid to write maintainable code that does what is intended. It was never &quot;out of your hands&quot;.<p>I no longer like Java as much, but I don&#x27;t think Java ever was a reason to sit back and let bad code happen.
drblast大约 11 年前
Java is a likable language. It&#x27;s not a lovable language.<p>It occupies a weird middle ground where you give up the capability to code to bare metal or easily interface with C functions in exchange for nearly being able to quickly and succinctly create powerful abstractions.<p>There&#x27;s not a whole lot <i>wrong</i> with it, but I don&#x27;t think I&#x27;ve ever been using any other language and missed something from Java. But when using Java that experience is common and I find the amount of effort you have to put in to not write repetitive code is annoying and results in overly complex architectures.
评论 #7465927 未加载
rspeer大约 11 年前
Another story to go with the author&#x27;s story about people who fail a code test because of Java:<p>At MIT, in 2003, there was a class called 6.171 Software Engineering for Web Applications. The final project was, in fact, to design and make a web application. It was very open-ended and it could be in any language you wanted.<p>This particular course soon stopped being taught, because a large number of people failed the final project. They could not make an application that functioned in any way by the time the course was over. (Keep in mind: 2003. There weren&#x27;t really any easy answers to web applications.)<p>Many people had chosen to do their project in Java, because that&#x27;s what they had learned and used in the prerequisite course. And in particular, over half of the people who chose Java failed.<p>(By the way, the course on web applications is now the <i>main</i> project-based course on software engineering at MIT, and it is now taught in Ruby.)
评论 #7466821 未加载
评论 #7464872 未加载
exabrial大约 11 年前
If I interviewed for a company where a serious interview question was to copy stdin to stdout I&#x27;d probably laugh and walk out. Stating the obvious: this company obsesses over the most efficient way to re-invent the wheel... Good luck getting any real work done or learning any career portable skills!
评论 #7463883 未加载
评论 #7463833 未加载
评论 #7463871 未加载
评论 #7463814 未加载
评论 #7463986 未加载
评论 #7463935 未加载
评论 #7465111 未加载
itsadok大约 11 年前
A corollary: we use Java and Python mostly, and when interviewing candidates, the vast majority of them choose to give their answers in Java. I don&#x27;t ask particularly hard questions, but I find that I usually get a good sense of the candidate by just talking to him as he&#x27;s working out the answer.<p>This one guy chose Python, which delighted me since it&#x27;s so rare. He then proceeded to produce answers much more easily than the average candidate, and he was able to make changes as I suggested them without too much effort.<p>We hired him but had to let him go after a month, when it became clear that he wasn&#x27;t as good as I&#x27;d thought he was. Turns out it was Python that just made him look smart.<p>I like Java for actually getting things done, but it&#x27;s such a vast ocean of TMTOWTDI that interviewing in it seems harder than in smaller languages.
xkarga00大约 11 年前
&quot;I am reminded of Dijkstra&#x27;s remark that the teaching of BASIC should be rated as a criminal offense. Seeing the hapless candidate get bowled over by a question that should be a mere formality makes me wonder if the same might be said of Java.&quot;<p>Well, actually it has been said by Dijkstra again. www.cs.utexas.edu&#x2F;users&#x2F;EWD&#x2F;OtherDocs&#x2F;To%20the%20Budget%20Council%20concerning%20Haskell.pdf
pnathan大约 11 年前
Hum. If that&#x27;s a positive spin on Java, you can count me unimpressed.<p>I have a side project I&#x27;m maintaining (all in) Java that I spent a weekend on about two months ago. Frankly, it was ridiculously easy to splat out code with Eclipse (and not get anything done, but that&#x27;s mostly my fault).<p>Several fundamental issues showed up:<p>- lack of first-class functions<p>- lack of extensibility on extant classes<p>- grossly mutating state<p>- Loads and loads of code that obscured what the logic of the program was<p>Project Lombok is a heinous hack to try to get around these issues (somewhat). So is, afaict, AOP.<p>I think for the right project - and with ruthlessly non-generic design - Java is the right tool. Otherwise you wind up with reams of wasted paper and mental overhead grappling with the sheaf of low-entropy code you&#x27;ve got.
评论 #7466138 未加载
评论 #7464649 未加载
m0g大约 11 年前
I used to feel Java was a pain to write when working with Java 6. Many 250 characters lines and everything.<p>Java 7 kinda divided the line length by a factor 2 with the diamond operator, the try-resource and so on.<p>I&#x27;ve programmed some Java 8 since yesterday and it actually feels like a pretty decent language to express ideas. Nothing like Java 6.<p>I know most of the Java haters have been struggling using it day to day in settings were it was awful (over engineering + Java 6, hello, here is the gun).<p>But I feel like those haters should really try to think fresh on this one. Try Java 8 and its new features and decide for yourself _afterwards_.
guelo大约 11 年前
Is this what he&#x27;s looking for?<p><pre><code> public static void main(String[] args) throws IOException { int ch; while ((ch = System.in.read()) != -1) System.out.print((char) ch); }</code></pre>
评论 #7464048 未加载
评论 #7464138 未加载
评论 #7464355 未加载
评论 #7464046 未加载
评论 #7464037 未加载
评论 #7464379 未加载
malanj大约 11 年前
The JVM is an awesome piece of tech - it still boggles my mind that runtime performance can get &lt;2x native C speed for many applications.<p>Java itself less so. It is just far too verbose. I found that I would get completely frustrated coding in an editor without code generation. Using Netbeans to generate most of the boilerplate code was the only way I stayed sane coding in Java. I cannot imagine having to write lots of production Java code in a &quot;normal&quot; editor. If my IDE can figure out what I&#x27;m trying to do, so should my programming language.
ryanobjc大约 11 年前
Interesting polemic. The arguments aren&#x27;t super compelling to me.<p>Ultimately java is just a tool. The culture around it shapes the macro picture but still.
评论 #7464036 未加载
piokoch大约 11 年前
&quot;Whatever you do, however hard you try, the code will come out mediocre, verbose, redundant, and bloated&quot;<p>That&#x27;s, unfortunately, common misconception and excuse for writing bad software in Java.<p>Java has its own problems (as if other languages does not have them), rigid objects creation that has to be overcome by dependency injection, nulls that has to be overcome by using Optionals, badly designed time&#x2F;date handling standard libraries, etc.<p>However there is a huge number of good quality, well design libraries that make Java shine.<p>- Guava gives us functional-like programming style plus nice collection handling - Joda Time solves problems with date&#x2F;time handling - Lombok (projectlombok.org) cleans up code from getters&#x2F;setters clutter - Need a nice, collections only library, there is plenty of them (for instance GS Collections) - You need to create super performant server? Just use Vert.x, Distruptor library, you are getting nice APIs and a lot of functionality for nothing - You want to write nice, concurrent code without using low level primitives, no problem, go with Akka - You need to orchestrate actions flow in your (huge) application - do it easyly, elegantly and almost without coding using Apache Camel - Google Guice dependency injection library provides nice workaround for a rigid object creation strategy in Java<p>And so on, and so on. Java ecosystem is changing, there are new ideas that refresh language, despite its rigidness (no macros).
elwell大约 11 年前
Use Java when you&#x27;re paid by the hour.<p>Use Clojure when you&#x27;re paid by the project.<p>Use Haskell when you need to ensure job security.
评论 #7464158 未加载
评论 #7464183 未加载
pacoverdi大约 11 年前
TL;DR<p>&quot;There are many bad java programmers, hence java is bad. Even I was bad at it. Saying that I like java is just sarcastic link bait.&quot;
alttab大约 11 年前
He doesn&#x27;t like java.
评论 #7463864 未加载
评论 #7463990 未加载
gaelow大约 11 年前
I&#x27;ve been programming in java for years and I still cannot make a program that compiles on the first try, unless I &#x27;cheat&#x27; using an IDE or peeking at the API.<p>I couldn&#x27;t even do the &#x27;read-from-input write-to-output&#x27; thing mentioned in the example.<p>It&#x27;s true it&#x27;s because of the language: I&#x27;ve believe Java is more &#x27;Enterprise&#x27; and sophisticated.<p>But I KNOW that because of this I tend to write better code (at least more standardized and better structured) in Java than in other languages I&#x27;ve had the same practice with, such as C, C++ or PHP, even though I don&#x27;t need any IDE or manual of any kind to write such a simple program on those. And, no matter the language, it takes me the same time to do it right.<p>My conclusion is: If you like to &#x27;hack together&#x27; a tool Java is probably not the best choice of language; If you want to build some big project on a team and keep it robust and maintainable using efficient libraries, it is.
jbverschoor大约 11 年前
What I liked about Java is: * The IDE * Staticness and strictness * The JEE deployment model. I think this is overlooked and unappreciated. Having a standard way to specify database connections, queues, etc is very nice. I had never stored any passwords in the source repository
lawl大约 11 年前
I&#x27;m a professional Java dev and couldn&#x27;t do this from the top of my head without System.* documentation.<p>But if I can choose the language it&#x27;s easy...<p><pre><code> #!&#x2F;bin&#x2F;bash cat </code></pre> If people can&#x27;t come up with a different solution they probably just suck...
评论 #7466152 未加载
cbsmith大约 11 年前
So, this discussion has already demonstrated how Java programmers get this stuff wrong. Kind of head shaking stuff. Here&#x27;s a simple implementation. No exception handling logic (and some would no doubt quickly with allowing throws of Throwable), on the assumption that anything that actually generates an exception would actually be the kind of thing you&#x27;d not want to recover from, and it uses synchronous, single byte at a time (buffered) reads &amp; writes, but it actually runs reasonably efficiently as compared to using most scripting languages.<p><a href="https://gist.github.com/cbsmith/9755809" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;cbsmith&#x2F;9755809</a>
评论 #7465135 未加载
nbevans大约 11 年前
1. Functional programmer makes bold factual statement. So &quot;bold&quot; that it is almost perceived as trolling by imperative programmers. 2. Hacker News&#x27; usual suspects fail to grok remotely what he is even saying. 3. GOTO 1.
评论 #7465704 未加载
druska大约 11 年前
Maybe instead of grinding out code he hates, he should find something he enjoys coding, or maybe don&#x27;t code at all.
ctrager大约 11 年前
I have a decent amount of experience coding in big codebases using C#&#x2F;Java - compiled, strongly typed languages - on the one hand, and Ruby&#x2F;Javascript - interpreted, loosely typed - on the other. When I&#x27;m working in a big, unfamiliar codebase, I&#x27;m grateful for the help that the IDEs (Visual Studio&#x2F;Intellij&#x2F;Netbeans) can provide with refactoring, dead code detection. Would it be correct to say that because of the so called verbosity of Java, the IDEs are that much better at giving you instant feedback that you have broken something?
neilellis大约 11 年前
Hey I&#x27;m trying to find someone who can build a shed for me, and all these qualified structural engineers I have interviewed don&#x27;t even know the difference between a pozidrive and a phillips screwdriver. What the HELL do they teach them at University these days!<p>(sigh) I despair, honestly. Please folk, take the time to see how some of the largest scale software on the planet runs on the JVM. Horses for bleedin&#x27; courses folk.<p>Personally I write my software in Bash, Java&#x2F;Kotlin and Javascript - <i>depending on the context</i> each of these have proven to be excellent technologies.
ArtDev大约 11 年前
Reminds me of the old joke: Knock knock. &quot;Who&#x27;s there?&quot; ......(pause)......... &quot;Java&quot;
todd8大约 11 年前
Why do these kinds of posts produce so much noise on HN? Its not because HNewsers are silly or stupid. Its because programming languages really do matter. However, experience with Java isn&#x27;t enough to have a wise perspective on Java and experience with Javascript isn&#x27;t enough to have a wise perspective on Javascript. All languages aren&#x27;t alike and all languages aren&#x27;t equally good (even if Turing equivalent). University exposure to various programming languages is helpful, but programming in a language amongst other experienced programmers is more valuable.<p>I learned C while in grad school, but I really learned it at IBM while working on the Unix kernel. That gave a useful perspective on the strengths and weaknesses of C. So I can say that Java has some real advantages over C for certain kinds of work while C is the right language for kernel work.<p>Here, on HN, I&#x27;ve learned that Java programmers like programming in Java and that Javascript programmers love programming in Javascript. But please don&#x27;t pontificate on how wonderful functional programming is in Javascript if you haven&#x27;t got a reasonable amount of experience with a real functional language (OCaml, Haskell, etc.). Or that Java is better than Python because [whatever] unless you&#x27;ve really programmed in Python too.
hyp0大约 11 年前
<p><pre><code> ...this question comes up so often you&#x27;d think they&#x27;d just figure out that the chaining of streams is somewhat difficult and either make helpers to create various combinations or rethink the whole thing </code></pre> <a href="http://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string#comment152598" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;309424&#x2F;read-convert-an-in...</a><p><pre><code> java is a blue collar language </code></pre> James Gosling, <i>The Feel of Java</i> <a href="http://www.dfjug.org/thefeelofjava.pdf" rel="nofollow">http:&#x2F;&#x2F;www.dfjug.org&#x2F;thefeelofjava.pdf</a><p>Java is indeed very workmanlike. Straightforward, predictable, reliable.<p>My observation is that the Java standard libraries (packages) are like a highly skilled and conscientious C programmer trying to write OOP. The don&#x27;t want to cut off too much power from you. And that means you have to specify everything - <i>exactly what kind of list do you want?</i> In scripting languages you don&#x27;t, because most of the time it really doesn&#x27;t matter. (BTW: If you read some of the source, it is often written in a C-like style rather than Java-like).<p>The low-level style of libraries is at least half the reason Java has lost out to Python&#x2F;Ruby etc. But also for its wins.
atiffany大约 11 年前
I like the piece but I&#x27;m afraid some people will just read the title on the front page and assume that someone reputable is actually endorsing Java.
评论 #7463995 未加载
carsongross大约 11 年前
If java was brainfuck, and we still got the JVM out of it, it would all be worth it.
评论 #7464145 未加载
snowryd88大约 11 年前
I bet someone is going to post an article named &quot;Why I hate Java&quot;
wmnwmn大约 11 年前
I like Java well enough and I don&#x27;t know any other way at the moment to make an app that can run both on the desktop and over the web, on all major platforms, in exactly the same way.<p>However it is true that reading a stream from stdin is a big pain. More importantly it&#x27;s also true that students learn an over-objectified style of Java programming in school which generally produces very bad code. Students tend to create too many layers of objects and to over-use inheritance, resulting in an inflexible structure with many opaque interlinks between objects. In the real world specs change at any time, and one must program in such a way that unanticipated features can be added. Deciding what blocks of code should be broken into shared routines remains, in my view, something of an art form, and one that the current Java-based programming curriculum does little to develop.
GotAnyMegadeth大约 11 年前
&gt; But it is not a language I would choose for answering test questions, unless maybe the grade was proportional to the number of lines of code written<p>Related to this: At Uni we had a terrible lecturer for our first year C programming courses. We had a team project that none of understood. A few days before the submission, when we didn&#x27;t have anything that would compile, someone got hold of the marking system. The marking was automatic, and up to 5 of the 25 marks were awarded for the code:comment ratio. We deleted the lines that were causing it to fail to compile, then copy n pasted the whole code below again, but as one giant multi-line comment, securing us a 1:1 code:comment ratio. We got 7&#x2F;25, 5 of which was for &quot;Legibility and good coding practices&quot;.
kang大约 11 年前
Watching videos of Petr Mitrichev, who is arguable the best sport programmer, I feel that Java does allow you implement that logic in your brain, fast enough. I feel this is enough attention a mere tool should be given to, given that the main goal is actually solving the problem.
ChrisGaudreau大约 11 年前
There&#x27;s only one way to solve a given problem in Java? Tell that to my AbstractFactoryPoolBean.
评论 #7463876 未加载
molbioguy大约 11 年前
<i>But when you learn Java, there aren&#x27;t any powerful language features you can use to solve many problems.</i><p>I know it&#x27;s not pure, but Java does force you to think in an object-oriented way. And there are problems where that&#x27;s an advantage.
评论 #7467423 未加载
norswap大约 11 年前
Got to &quot;But when you learn Java, there aren&#x27;t any powerful language features you can use to solve many problems. Instead, you spend your time learning a body of technique for solving problems in the language. Java has hashes, but if you are aware of them at all, they are just another piece of the immense Collections library, lost among the many other sorts of collections, and you have no particular reason to know about them or think about them.&quot; and then I stopped.<p>If you have to be taught about dictionaries (1), you&#x27;re a crappy programmer anyway.<p>(1) I will accept the denomination &quot;map&quot; also, but they are not called &quot;hashes&quot; damnit.
laichzeit0大约 11 年前
Over the years I&#x27;ve found Java to be too chatty and a pain in the ass to use directly. I mainly use Groovy now which also runs on the JVM.<p>Just yesterday I wrote some extensions for Solr, you can do it in Groovy (hell even Javascript).<p>There&#x27;s very little point in writing things in pure Java these days. Especially if you&#x27;re just using Java libraries and gluing pieces together, use some scripting language that compiles to bytecode.<p>Here&#x27;s one cool thing about Java: The documentation is probably the best of any development ecosystem out there. APIs are wonderfully documented. For an extreme dose of hilarity, compare Javadocs to Nodejs documentation.
benjamincburns大约 11 年前
I agree that there are plenty of warts to be found in various well-known Java libraries, and that there is a shocking amount of poorly architected Java out there, but I can&#x27;t agree that it&#x27;s the language&#x27;s fault.<p>Java has become the language of &quot;the noob.&quot; For a very large percentage of programmers, it&#x27;s the first language that&#x27;s presented to them. As such, there are endless examples of Java projects written by people who are still struggling with basic flow control, let alone project architecture. Some of these projects are written by smart people, and they&#x27;re genuinely useful. As an example, think of the research biologist who&#x27;s writing code for her thesis - code for which there&#x27;s probably no measurable market.<p>Because it&#x27;s the language of the noob, it&#x27;s really easy to gain the kind of experience this author is describing. The kind where you just glide along, &quot;turning the crank&quot; not really learning anything for a long, long time. People come away honestly believing that because they&#x27;ve worked with the language for so long they&#x27;re experts. That there&#x27;s nothing left which will surprise them, or change the way they work in this language.<p>I&#x27;ve seen a lot of cases where these people bump up against some really cool things and never realize it. Because they don&#x27;t understand it they quickly write it off as bad code&#x2F;architecture&#x2F;naming.<p>One of the most common examples I&#x27;ve seen of this is when people pull class names from the Spring application framework core, parading them around with no context and no knowledge of why they exist or why they might be <i>incredibly</i> useful, let alone why they sometimes make Java a joy to work with.<p>&quot;AbstractSingletonProxyFactoryBean??! I don&#x27;t care what it is, that&#x27;s just <i>stupid</i>!&quot; [1]<p>How ignorant.<p>&gt; After all, you produced 576 classes that contain 10,000 lines of Java code, all of it seemingly essential, so you were doing your job.<p>I can agree that Java is a verbose language, and sometimes it&#x27;s really difficult to express an abstraction succinctly as compared to some other languages. I can agree that it&#x27;s also easy for people to run wild and over abstract. However, I think it&#x27;s just as likely for people to mistake well abstracted code for needlessly verbose code.<p>&gt; And nobody can glare at you and demand to know why you used 576 classes when you should have used 50...<p>Without a specific case, it&#x27;s hard to figure out what&#x27;s really going on here, but if this is a primary target metric, I&#x27;d say you&#x27;re prioritizing the wrong things.<p>&gt; ... because in Java doing it with only 50 classes is probably impossible.<p>Just throw separation of concerns out the window and you can write just about anything in one class.<p>1: <a href="http://docs.spring.io/spring/docs/2.5.x/api/org/springframework/aop/framework/AbstractSingletonProxyFactoryBean.html" rel="nofollow">http:&#x2F;&#x2F;docs.spring.io&#x2F;spring&#x2F;docs&#x2F;2.5.x&#x2F;api&#x2F;org&#x2F;springframew...</a>
评论 #7464130 未加载
评论 #7464384 未加载
评论 #7464100 未加载
wobbleblob大约 11 年前
Why I like it when people are overconfident pompous noobs on the internet
jaimebuelta大约 11 年前
I think this is a very advanced trolling... X-D<p>A great application of Poe&#x27;s Law[1]<p>[1] <a href="http://en.wikipedia.org/wiki/Poe&#x27;s_law" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Poe&#x27;s_law</a>
elchief大约 11 年前
I couldn&#x27;t care less what language I am using. I care about the quality of the libraries. That&#x27;s what helps you get shit done fast. And JVM has a shit-ton of high quality libraries.
koevet大约 11 年前
It&#x27;s ironic how this kind of Java bashing comes from a Perl guy.
blazespin大约 11 年前
Java is one of the best, most elegant choices for certain types of problems. For other types of problems, it is horrid. This can be said of many programming languages.
josephpmay大约 11 年前
Very misleading title for a great article. I will probably point people to this in the future when they ask me why I don&#x27;t like Java (yet continue to use it).
olalonde大约 11 年前
&gt; My current employer uses an online quiz to pre-screen applicants for open positions. The first question on the quiz is a triviality, just to let the candidate get familiar with the submission and testing system. The question is to write a program that copies standard input to standard output. Candidates are allowed to answer the questions using whatever language they prefer.<p>I wonder if &quot;cat&quot; would count as a valid answer.
nemasu大约 11 年前
I hate Java, and loved this article. Not what I was expecting. Now excuse me as I have 213 more classes to write each containing about 2 lines of real code.
mrmondo大约 11 年前
&quot;What are you? A RAM salesman?&quot;
ksikka大约 11 年前
I love this. Keep calm and java on.
louisdefunes大约 11 年前
Is it me (not a native english speaker) or isn&#x27;t this article all but sarcastic?
bakhy大约 11 年前
i certainly wouldn&#x27;t want this Negative Nancy paying me any compliments ;)
nu2ycombinator大约 11 年前
He has a point. Once I used this online technical interview questions. Understanding the submitting output of the program through using java took longer than the Python or Ruby.
sreya大约 11 年前
Copy standard input to standard out? It&#x27;s like 5 lines of code in Java<p>Scanner scan = new Scanner(System.in) while(scan.hasNext()) { System.out.println(scan.nextLine()+&quot;\n&quot;) }
评论 #7464264 未加载
Nekorosu大约 11 年前
Nice article! After reading it I can tell I like Java too.
general_failure大约 11 年前
The issue with java is not the language. The language is great.<p>The issue is the totally over-engineered APIs
Ramonal大约 11 年前
I like java since I learned it.
z3phyr大约 11 年前
I really love the JVM. Inversely its related to Java™. I hate it passionately.
ASneakyFox大约 11 年前
This post is nerdbait. Not hn material.
happycube大约 11 年前
&quot;cat -&quot; :)
cpdean大约 11 年前
what is this, fonts for ants?
评论 #7463830 未加载
评论 #7463803 未加载
评论 #7463872 未加载
suyash大约 11 年前
I love Java :)
anon4大约 11 年前
Isn&#x27;t it all just<p><pre><code> StreamUtils.copy(System.in, System.out) </code></pre> I&#x27;m pretty sure there is a function that just copies an input stream to an output stream in commons-lang.<p>Still I agree with him - I won&#x27;t write Java in a test like that. It is almost impossible to write Java fast without an IDE to autocomplete everything for you. There are way too many names to remember. I can&#x27;t even tell you what package StreamUtils are in or if it&#x27;s StreamUtils or FileUtils.
评论 #7466187 未加载
teemo_cute大约 11 年前
I love Java because when you add &#x27;script&#x27; to it you have a pretty sweet language.
评论 #7464935 未加载
freeasinfree大约 11 年前
Typical ESL Java programmer
Ramonal大约 11 年前
nice article!
ky6b79大约 11 年前
Nice article!
评论 #7464479 未加载