5 ms·
You can write a pretty trivial Java program to copy stdin to stdout but Java is still one of the enterprise languages and people writing enterprise applications
by smoyer 5y ago
You can write a pretty trivial Java program to copy stdin to stdout but Java is still one of the enterprise languages and people writing enterprise applications don't tend to write this type of software (but they do tend to have log4j vulnerabilities). The strengths of Java are its mature dependency management system(s), its comprehensive standard library and the vast ecosystem of third-party libraries. A better test of the language is whether you can write a complicated application in relatively fewer lines of code.
I spent much of my career writing Java code but have moved to Go - it's almost a return to my roots as an embedded systems engineer (without the memory management hassles of C) and it's vastly more economical to run Go applications in containers. I do find myself writing code that I used to pull in from a library though.
- kingkongjaffa 5y agoPeople say this but where do you find libs for Java? Python has pip, JS/Node has NPM
- tlarkworthy 5y agoMaven central
- coldtea 5y ago>People say this but where do you find libs for Java? Everywhere, on the lib website, on GitHub, on Apache, etc. (including centralized places like Maven Central). You then put a ferences in your Maven or Gradle file like you would in your package.json. In fact, because for 99% of the libraries you just need to have a jar (or more) in your classpath, you don't have to have all the ceremony that Python has, and all the installation mess, venvs, and other such shite.
- Macha 5y agoUntil you end up with dependencies transitively pulling in conflicting versions of Jackson or similar and you need to mess around with dependencyManagement or exclusions.
- dionian 5y agoTransitive dependency trees are a feature, not a bug
- The_rationalist 5y ago
- deleted 5y ago[deleted]
- the_af 5y agoThe Java ecosystem of libraries is huge, it used to be one of the largest ones. I don't know how it competes today with Python and JS, but Java certainly doesn't lack libraries for almost anything you can think of. Also: Maven Central.
- smoyer 5y ago> JS/Node has NPM If this isn't a joke, I'd suggest learning the Maven or Gradle build systems. NPM has such horrible dependency management that these Java systems will seem like magic!
- chakkepolja 5y agoIMO maven is much better than gradle these days. Indeed maven or go dependency management is refreshing after you run create-react-app or shit like that.
- da39a3ee 5y agoOK, so I'm trying out maven central as people in this thread are recommending. As an example, I'm searching for a command line argument parser. The first thing I'm noticing is that there seems to be no way to judge the popularity of the libaries (an often-used proxy for quality, e.g. number of downloads, GitHub stars, etc). I enter "argparse" and the first hit isn't even Java! It seems to be a npm package?? https://search.maven.org/artifact/org.webjars.npm/argparse https://search.maven.org/artifact/org.webjars.npm/argparse I enter "argument parser" and there are two hits. One with zero stars on Github and one with 1 star. https://search.maven.org/artifact/com.github.easy-develop/argument-parser https://search.maven.org/artifact/com.github.easy-develop/ar... https://search.maven.org/artifact/com.github.raphcal/argument-parser https://search.maven.org/artifact/com.github.raphcal/argumen... "command line" brings up another 0 star option: https://github.com/AlmondBranch/command-line-parser https://github.com/AlmondBranch/command-line-parser I suppose the Java package ecosystem must be good if everyone says it is, but so far it looks to me like I'd find Maven Central very inefficient to discover high quality packages.
- Katharsas 5y agoMaven Central is the place where the libraries are hosted, but not the place where they are found by users. Use Google/Stackoverflow/Reddit and simply search for what you want. Searching for "command line argument parser java" immediately leads you to libraries and infact lists of libraries (see https://stackoverflow.com/a/7829772 https://stackoverflow.com/a/7829772), of which most are going to be available on Maven Central. Then you do your research that the library you are looking at looks valid and is trustable (!) by checking out the info available on it, maybe make another search to find opinions on it. Then when you have decided to try it, look at its docs to find out where it s located on Maven Central and use it from there.
- mindcrime 5y agoIn Java-land most people build and do dependency management with Maven or Gradle. In either case, these tools can pull from repositories based on the Maven format. The vast majority of popular libraries are in repo "Maven Central" and "just work" if added to your dependency list. A number of smaller, more specialized repos also exist, and it's trivial to add additional repos to your Maven/Gradle config as well. You can search for libraries on mvnrepository.com, or your IDE can search the index. Also most libraries will include a section in the documentation that shows the details of the blob you have to put in your pom.xml / build.gradle file.
- throwaway2037 5y agoTo compliment most other posters, they would use Maven Central: https://search.maven.org/ https://search.maven.org/ Here is an example library from Google called "Guava": https://search.maven.org/artifact/com.google.guava/guava/31.0.1-jre/bundle https://search.maven.org/artifact/com.google.guava/guava/31.... You can find the source code on GitHub: https://github.com/google/guava https://github.com/google/guava On the right side of the page, you can find eleven (!) different wants to include this dependency (and) all of its transitive dependencies with just a few lines of configuration. Here is a list of the Top 10 downloads of open source Java libraries: https://mvnrepository.com/popular?p=1 https://mvnrepository.com/popular?p=1
- tannhaeuser 5y agoErr ... the npm authors (the CommonJS modules/packages spec writers for package.json) mention maven and CPAN in their design docs and discussions as reference. Many of the early Server-side JavaScript adopters (in the 2000's before Node.js but well after Netscape's server-side JavaScript) were, in fact, Java/J2EE dropouts longing for something simpler. [1]: http://wiki.commonjs.org/wiki/Packages/1.0 http://wiki.commonjs.org/wiki/Packages/1.0
- thrower123 5y agoOne of the nice things about Java and C# is that they tend to have "chunkier" dependencies, that aren't split out into an interlocking tree of dependencies deep and wide. For the most part, anyway... Things are kind of gross if you are trying to use newer nuget packages on the old 4.8 .net framework...
- bombcar 5y agoJava is supportable in that I can get older code to build and run on Java8 still - may need a gradle update or some other minor stuff but it works. So many other abandoned programs seem to become unbuildable pretty quickly.
- JavaOnlyGuy 5y agoNo isNullOrEmptyString method, no Set operations, Java didn't have a good HTTP library until Java 11, no lazy file reading, unless you use InputStream which is a pain. vast majority of mediocre libraries and one man libraries. We use Spring because it uses the best libraries, so the other ones are discarded. Java being around for so long doesn't have a lot of convenience methods like others do languages do, like the ones I mentioned in the beginning. So no, Java is a half assed programming language which C# and NET CORE should replace
- stepbeek 5y agoWhat’s C# and .Net really like on Linux now? I know Microsoft says it’s great but I’m once bitten twice shy after trusting that Azure would be good. I am happy to try different languages but I will never again support a Windows Server over a Linux VM.
- binarynate 5y agoI use .NET 6 on Amazon ECS (Amazon Linux), and it's a pleasure to work with. The dotnet CLI makes running and building super easy. So, I just develop with VS Code and a terminal on macOS and deploy to AWS.
- tester756 5y agoI have C# web apps hosted on Linux for something like 2-3 years and it works very fine
- fesc 5y agoI think Kotlin has the utility methods you have in mind. Im not saying C# is bad as I don‘t have experience with it, just that Kotlin is a more realistic replacement for most Java shops.
- ludovicianul 5y agoJava didn't have all these things, because there were a lot of very good libraries already doing that. Adding them inside a project is trivial. I think this approached encouraged creating alternatives to the standard APIs as well as extensions which in the end made the language even more rich.
- kitd 5y agoA better test of the language is whether you can write a complicated application in relatively fewer lines of code. To a point. In many situations, a better test is whether a coder unfamiliar with said complicated application can maintain it relatively easily.
- AtlasBarfed 5y agoAgreed: https://aplwiki.com/wiki/Conway%27s_Game_of_Life https://aplwiki.com/wiki/Conway%27s_Game_of_Life
- sorokod 5y agoThe domain and the developers that inhabit that domain should be separated from the language. Below is the repo of the companion Java code to Sedgewick's "Algorithms" - make of it what you will. https://github.com/kevin-wayne/algs4/tree/master/src/main/java/edu/princeton/cs/algs4 https://github.com/kevin-wayne/algs4/tree/master/src/main/ja...
- benjamir 5y agoThanks, I have another "Sedgewick" and wasn't aware of the repo (not in immediate need of it, but nice anyway!)
- Un1corn 5y agoI'm really not sure I would call Java's standard library comprehensive. I've only worked with it for a few months but needed many Apache commons libraries.
- jimbokun 5y agoWhich falls under the heading of "mature dependency management system". Apache Commons (or Google Guava) is pretty much considered part of the standard library at this point, as they are so easy to include in projects.
- AtlasBarfed 5y agoBy the standards of the day, when Java was released it's standard library was pretty comprehensive: in addition to covering most of the c-ish stdlib, it had networking and web-aware apis. It did set a new standard in a way that was very beneficial for the languages that came after it: you're not an ACTUAL language if you don't have a "good" standard library, and I can argue that "good" was defined by Java more than C++ or anything else at the time. I also don't see any new languages, while more modernized, that have substantially pushed the envelope further to be the new gold standard of a minimum batteries included stdlib. All I could probably say is various threading/concurrency apis, but Java has added a lot of that too over the years.
- lostcolony 5y agoHTTP as well. Added in Java 11 (2018), but that's still an insanely long time to rely on third parties.
- jalk 5y agocom.sun.net.httpserver was added in Java 1.6 (2006) - comparable to the Python httpserver
- lostcolony 5y agoHence why I said "http", as in java.net.http, as in, everything around an HTTP client.
- klysm 5y agoI cannot stand go almost solely because it’s error handling. We have the ability to do so much better.