TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Java may be verbose, but who cares?

19 pointsby portal_narlishalmost 8 years ago

5 comments

hactuallyalmost 8 years ago
As someone who avoids IDES, I&#x27;ve always been wary of languages which <i>require</i> an IDE to allow people to work on a project or even make even smallest amount of changes on a project and rebuilding. The verbosity and oh-so-explicit-my-brain-hurts overt structured with too many layers of abstractions actually prevents me from fully understanding what is happening.<p>Code reviewing for me becomes a chore where I can&#x27;t focus on the purpose of the code. I can&#x27;t read it - understand it and know that my fellow engineers have understood the task. Underneath the LoC, the Maven&#x2F;Gradle mess, the structure and the plugins -- where do I see the engineer&#x27;s intent?<p>Not only is Java extremely verbose and requires an IDE to write the code for you - it is also very complex, hence hard to understand.<p>Developers spend most of their time reading code, if 70% of it is autogenerated (imports and layout and code completion to find the right 50 letter function) so why do we make them read machine generated code just to understand what, in this example, should have been 58 lines of code but instead becomes a ~440 lines long, 7 file&#x2F;entity monster when a few simple functions would have sufficed.<p>What justifies the complexity of Java? I think this decade belongs to Clojure for the JVM.
评论 #14591206 未加载
评论 #14591215 未加载
Sohcahtoa82almost 8 years ago
I kinda wish the code for the Clojure and Java implementations were posted.<p>In my limited Java experience, I&#x27;ve found that Java itself is fine, but for some reason, professional Java developers stick to these crazy idioms that result in these monstrosities of code. I&#x27;m sure we&#x27;ve all heard of FizzBuzz Enterprise Edition[1]. It&#x27;s satire, sure, but every dollar of satire contains a couple cents of truth.<p>I bet the Java version of that Spark job could have been done in under 100 lines of Java, but it was divided into 7 files totaling over 400 lines of code because there&#x27;s this feeling that you&#x27;re &quot;supposed&quot; to write Java like that.<p>EDIT: Back in college, I took a machine learning class and wrote programs that would load training data, use it to classify data, and output results. I did all the tasks in a single .java file. If I were to do it following Java idioms, I probably would have needed to separate the code that read the training data into a TrainingDataLoader class, the code that classified data into a DataClassifier, and then used a DataPrinter class to output it all, plus a main class to pull it all together. Great, my single file, ~200 LoC project is now 4 files and gained dozens more lines of boiler plate to pull it together.<p>Stop writing stupid Java code and then blaming Java for your code being stupid.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;EnterpriseQualityCoding&#x2F;FizzBuzzEnterpriseEdition" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;EnterpriseQualityCoding&#x2F;FizzBuzzEnterpris...</a>
lucidguppyalmost 8 years ago
I would very much like the industry to settle on at most 2 of:<p>- Scripting language (python, ruby...) - Fast language (c++, java.... ) - Functional language (elixir, haskell...)<p>and we concentrate on them to get tooling really good.<p><a href="http:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2016&#x2F;07&#x2F;27&#x2F;TheChurn.html" rel="nofollow">http:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2016&#x2F;07&#x2F;27&#x2F;TheChurn.htm...</a>
评论 #14592314 未加载
specialistalmost 8 years ago
Concision is a virtue.<p>Errors per LOC per programmer is stable. Reducing LOCs reduces errors.<p>---<p>As for the article...<p>Comparing Clojure and Java&#x27;s lambda&#x2F;streams. Meh. Trading LOCs (function points) for obfuscation.<p>For imperative languages (like Java &lt; 8), the correct answer is better APIs. Like the Java Language, the JDK would also benefit from serious trimming.
pawadualmost 8 years ago
&gt; Imagine deleting 87% of all the code that you have to maintain!<p>What if those 87% make your code easier to maintain and update?