14 ms·
Java for Everything (2014)
- mk81 6y agoTo each, his or her own
- tracer4201 6y agoLately I’m writing C++. I have code that needs to deploy across different mobile ecosystems. Java doesn’t cut it, Kotlin has a cross language offering but it’s not prod ready, and Rust... well, the team doesn’t know Rust and we won’t hit our dates if we have to learn idiomatic Rust, and once we ship the code, it won’t be as simple getting some customers updates as we have customers in the wilderness and these aren’t iOS or Android devices that we can just release to using app stores. Despite Java’s verboseness and all the factory hell, with recent tooling and the massive library of great open source libraries, I do enjoy writing it. I prefer strong typing personally. But I don’t agree with Java for everything. Recently I did some data processing work on Spark. I wrote everything in Scala. The whole “trait” functionality was very nice and elegant, and it allowed me to incrementally build some nice abstractions that my team can use to quickly build and deploy spark jobs.
- elric 6y ago> all the factory hell This gets repeated so often, but it's mostly never been true in the general use case (it was mostly a J2EE/EJB thing). It's a silly Java meme that I wish would just die. If you don't like the factory pattern, don't use it.
- mrkeen 6y agoIt's not really up to us though, it's up to our colleagues.
- elric 6y agoColleagues, from my experience, tend to be human beings you can talk to. If this were a deeply systemic language issue, that would be a different matter. But this is something that's solvable by educating the rest of your team.
- mrkeen 6y agoAnd I assure you they are very happy to educate me.
- tracer4201 6y agoSaying it has “mostly never been true” and dismissing this as a “Meme” couldn’t be more off. A lot of programmer effort in any organization goes towards supporting existing software, which in the Java ecosystem tends to full of all the factory non sense. I’m sure these concepts started off in the J2EE space, but it’s infected a lot of different types of projects because people assumed these patterns were “good” or inherently part of Java. And here we are now dealing with the mess.
- elric 6y agoI've been working on enterprisey Java software for nearly two decades, and I've never come across anything that's full of "factory non sense" in the wild. Sure, I'm just one person, but I've worked on more projects than I can count. With good teams and bad teams alike. I'm sure there are shitty programmers in every language community, who will write things using concepts they understand only marginally, and I'm sure it has lead to a couple of FactoryFactoryFactories here and there. But the ecosystem is not "full" of this at all. Java isn't the same as it was 20 years ago. It grew up.
- watwut 6y agoI mean following 100% seriously: there is no such thing as factory hell. Even in the few places who do actually overuse factory pattern, it is braindead easy to figure factories out. It is not like would be something difficult to understand. The hate for Java is so strongly meme based.
- oriolid 6y agoIt's not difficult, it's tedious and ugly.
- watwut 6y agoUsing factory someone else made is tedious? In what way it is more tedious then using constructor? It is just that thing ... there are patterns that are tedious. The object mapping before hibernate was extremely tedious for example. But factory pattern ... seriously?
- oriolid 6y agoI disagree. Constructor: > Foo f = new Foo(a, b, c); Factory: > FooFactory ff = new FooFactory(); > ff.setA(a); > ff.setB(b); > ff.setC(c); > f = ff.create(); ...or the same in XML. Fluent APIs turn it into oneliner, but it's still good only for adding hours to your bill.
- watwut 6y agoIf this "adding hours to your bill" you need to speed up. And learn IDE of learn type or just watcy other programmers a bit. Cause no one I know spends hours on this. Second, factory methods today have arguments combinations too. fd.create(a, b, c) is the most normal thing in the world. Seriously, this is ridiculous.
- nathell 6y agoWell, I vividly remember reporting this bug against ws-xmlrpc 14 years ago: http://mail-archives.apache.org/mod_mbox/ws-xmlrpc-dev/200709.mbox/%3C200709041848.43136.daniel%40sentivision.com%3E http://mail-archives.apache.org/mod_mbox/ws-xmlrpc-dev/20070... as well as the mental effort it took me to figure this out – by no metric I would call it "braindead easy".
- steve918 6y agoIf you think cross platform Kotlin isn't ready for mobile then rust certainly is not.
- tracer4201 6y agoWe checked Kotlins website and they explicitly said the cross platform offering was in alpha Is it now out of beta? I’m on the website now and it shows alpha still
- pjmlp 6y agoAndroid is pseudo-Java and there are a couple of AOT compilers for iOS, Java definitely cuts it.
- melling 6y agoType inference in newer languages reduces a lot of the pain that was Java. Of course, it’s not new but adoption took some time I also like to explicitly declare immutability/ mutability let x = “hello world” var ctr = 0
- asn0 6y agoSince Java 10: var mutableVar = "Foo" final var immutableVar = "Bar"
- dtech 6y agoFinal has been in Java for a lot longer, but you're also missing the point. Immutability should be the default, or at least not a secondary citizen to the dangerous and often unnecessary mutability.
- imtringued 6y agoYes, I still remember how in Ceylon they just did "value x = bla" and the variable was immutable by default. If you wanted to actually make it mutable you had to write it out as "variable Type x = a" to make it stand out and be really annoying to have mutable variables.
- kaba0 6y agoWhich is the road taken by record classes and the upcoming primitives.
- cloogshicer 6y agoThis is not immutability, final only prevents re-assignment, not mutation: final ArrayList<String> foo = new ArrayList<>(); foo.add("Foo"); // Compiles and runs - this is mutation foo = new ArrayList<>(); // Compiler error - this is re-assignment In your example, both Strings are immutable, since Java Strings are always immutable.
- imtringued 6y ago
- dmitryminkovsky 6y agoI like Java but I think the right job for all jobs, if you're going to pick one, is TypeScript: - At this point you can say TypeScript is mainstream. It's not Java, but it's definitely not a niche toy. - Many companies stand behind it and use it in production. - It is widely supported by tooling. - With TypeScript, every element of your stack can not only share code, but can share types, too. This has been a huge boon for me. - The type system is really, really flexible. It seems possible to specify the exact degree of safety that you want for any given situation. I never feel bound by the type system. It's very liberating. Not so with Java or C#. - It compiles to JavaScript, so it can run anywhere. On the backend you can run it natively with Deno. I haven't tried this yet, but am looking forward.
- ingframin 6y agoThe world doesn't end with web apps. I use Java a lot for event based simulations and for heavy math and it works like a charm. I don't think I can easily replace it with Typescript to be honest...
- MangoCoffee 6y agoaccording to Dice, TypeScript projected to do well in 10 years with increase pay and trending up. https://visualstudiomagazine.com/articles/2021/04/01/typescript-csharp.aspx https://visualstudiomagazine.com/articles/2021/04/01/typescr...
- dtech 6y ago> - The type system is really, really flexible. It seems possible to specify the exact degree of safety that you want for any given situation. I never feel bound by the type system. It's very liberating. Not so with Java or C#. Personally this is why I believe all languages will converge into the structural, gradual typing model of Typescript.
- mrkeen 6y agoAs a hardcore fan of static typing, how would you convince me to use a gradual typing model?
- shralpmeister 6y agoI agree with all of this including his love of Python. Just replace Java with JVM language. Regarding Java's verbosity and time to develop, I can't recommend Kotlin enough.
- jillesvangurp 6y agoKotlin is indeed nice. I also like python; bit not for large projects. There are plenty of nice languages to choose from. When choosing, I recommend looking beyond the language at the library ecosystem, tools, etc. You need all of that and as it is a long term investment, you also need to look for continuity and momentum. You need that to ensure that you can still work five or ten years down the line. If you pick something really new, tooling and libraries are typically a bit lacking. It's the reason why Java stays so popular. The language is a bit dated at this point but the tooling and library ecosystem are still top. I used it for more than 20 years before switching to Kotlin. With Kotlin you have the same level of awesome tooling and libraries but with a bit more modern language. Beyond Java/Kotlin, there is of course lots to choose from but you get a significant downgrade in tooling. Jetbrains takes care of IDEs for Ruby, Python, Go, Rust, Javascript/Typescript, etc. and they are nice. But it's typically with a lot less refactorings, auto fixes, etc. than they provide for Java and Kotlin. It's just not on the same level and a bit of a downgrade in that sense. Out of those, Rust is the most disruptive IMHO. Worth investing in and a very solid library ecosystem.
- lmm 6y agoKotlin looks great in the small but it has too many arbitrary and ad-hoc things. Compared to Scala it's a huge let-down.
- cle 6y agoYou wouldn't write a web frontend in Java (not anymore), you wouldn't write your Tensorflow code in Java, nor your kernel module or device driver. You still use the right tool for the job. Java is not always that. Also "right" should factor in your existing expertise, team culture, organizational roadmaps, etc.
- MaxBarraclough 6y ago> You wouldn't write a web frontend in Java (not anymore) Bit of a nitpick, but: GWT enables this, transpiling to JavaScript. Rumours of its death have been somewhat exaggerated (it's maintained but it's not getting that much attention). I'm not sure if Vaadin still makes use of GWT.
- cle 6y agoYeah that's what I was referring to by "not anymore".
- MaxBarraclough 6y agoGot it, I thought you were referring to the demise of Java applets.
- mrkeen 6y agoI bought into GWT back in 2010 maybe. I was sold on the idea of just using one language, and I was wrong. I really regret not diving into proper html+css+js sooner.
- mtmmtm 6y agoThere is now J2CL which translates java into javascript (superfast). gmail and google sheets is written in GWT.
- kaba0 6y agoThan I would rather use TeaVM with some wrappers.
- 6y ago
- cellis 6y agoUpvoted not because I agree, but genuinely want to read discussion on this. I used to agree, when I first started doing Android development and "relearned" Java since playing with Applets at age 14, but threading made me seriously reconsider. These days I make a living writing TypeScript ( nearly exclusively ), and although the tsc says it works, I always have a suspicion it could not work. Whereas with Java if it compiles it definitely works unless you have some R build issue. I think TypeScript is a nice middle ground, but I do wish there were some lower level semantics for backend TypeScript development. I've looked into Rust and it looks very complex and unfriendly ( I would need to rewrite nearly my entire backend libraries e.g. db drivers and ORM generators ). Anyway, it's a decent take, but I wish the same could be said of TypeScript.
- dmitryminkovsky 6y ago> and although the tsc _says it works_, I always have a suspicion it could _not work_ TypeScript fails me almost exclusively due to `!`. The association is so strong that whenever I encounter an error, I am excited to see if it's due to `!`. In the absence of non-null type assertions, TS feels very safe to me, largely due to experience of not seeing it fail.
- dtech 6y agoThrow in an eslint rule to disallow ! outside of tests, you won't regret it
- dmitryminkovsky 6y agoUnfortunately I have some spots where it’s unavoidable due to generated types that I can’t control being not quite right. It’s sad! Yes, otherwise I’d never use it, or far more sparingly (sometimes it is “correct”, though with effort it can be avoided)
- renke1 6y agoI have a utility function that I use for cases where I know for sure that a value is defined: export function assertIsDefined<V>( value: V, buildMessage = defaultAssertIsDefinedMessage ): asserts value is NonNullable<V> { if (value === undefined || value === null) { throw new Error(buildMessage(value)); } } It would prevent follow up errors if the value in fact was not defined.
- jhgb 6y ago> I’ve also written a java_launcher shell script that allows me to write this at the top of Java programs: One could also use D and rdmd pretty much for the same purpose, I imagine.
- jhgb 6y agoI forgot to note one more thing: > And other languages like D and Go are too new to bet my work on. Java, the author's favorite, is 26 years old. D is 20 years old. I'm not quire what exactly makes the six year difference so important here. (Sure, Go is 12 years old, that probably classifies as way younger.)
- selfhoster11 6y agoThe author likely meant that D comes with fewer batteries included and a less mature/less numerous community of developers, not that it's literally younger.
- kaba0 6y agoWell, one of them is known by 8 million people, the other by like a couple thousands? (But don’t get me wrong, D is a cool language, but it didn’t get as popular, so smaller ecosystem, developer mindshare will weaken it’s position)
- boxed 6y agoThis article could mostly be summarized as "invest in ONE language". The arguments for that language to be Java aren't very strong compared to the arguments for ONE language.
- reidrac 6y agoI see some arguments for static typed languages as well. And some notes on performance, but mainly static types.
- jtolmar 6y agoOnce you combine those into "use one statically typed language" it narrows down the field to just a handful of languages, though. The "use one language" stipulation requires that the language is actually appropriate in a wide variety of situations, and has libraries to back it up in all of those. Like, you can't use Rust as an everything-language, it has limited libraries and is designed for a specific domain. Between the two requirements, I think Java, C#, and TypeScript might be the only languages that qualify.
- jcelerier 6y ago> Between the two requirements, I think Java, C#, and TypeScript might be the only languages that qualify. says jtolmar in a browser written in C++
- heluser 6y agoI guess “Static vs dynamic/gradual typing” would’ve been a better title. If the author had used Go/OCaml/.net/etc the result would’ve been the same : better performance and easier maintenance in long term
- ekkeke 6y agoAgree with this, except I think C# is better than Java. I write everything in C#: desktop apps, mobile apps, frontend, backend I think the language is very similar to Java but some advantages present themselves 1.it has more modern features than Java, 2. it has mobile (including IOS) and frontend support 3. (possibly not true, but my impression anyway) it has better support for writing close the metal, high performance code It really is very nice to write everything in the same language.
- mleo 6y agoThis should be tagged 2014. Most Java in use was 7 with 8 only getting released in early 2014. So any comparisons to Typescript or Kotlin or var usage in Java are newer constructs than the context with which this is written. My favorite language to develop in is Typescript/JavaScript, but daily use Java 8 due to legacy application and would love to upgrade.
- deleted 6y ago[deleted]
- void_mint 6y agoI really want to work with "modern" Java. My experience with Java was from a massive awful J2EE enterprise Java fintech company, and from college. When I see modern Java apps it seems like a pretty decent combination of modern features/tooling and an incredibly mature runtime.
- mrkeen 6y agoThe 'modern' stuff is just the enterprise crap all over again. Annotations everywhere that don't do what they say. Contexts and Factories. The Beans are called Components now I guess. Incredibly slow startup and shutdown of apps. Tests that require all the components in the system to standup before you can test one endpoint of your controller. > incredibly mature runtime Cool, but do note that modern is by definition the opposite of mature. If A was invented before B, who cares? I want whichever one's better.
- kaba0 6y agoHow is that the modern part? Beans have been around for decades! Also, there are very small libs for java, you don’t have to create a spring/JEE app.
- mrkeen 6y agoExactly! I hated my time with Spring. Compile-time bugs became runtime bugs (Cannot startup one bean because cannot find other beans). Startup was slow (looking for all the beans!). Solved problems like null-checking constructors and 'final'ing all variables became unsolved once you needed to leave them nullable/mutable for Spring to update them post-constructor. Testing a single class became slower and flakier when you needed to spin up the IOC to test - because it would start building config for all the other classes too. Keep in mind, Spring is already touting itself as modern. But along comes Micronaut[1] with a new set of promises: "...monumental leap in startup time" "Keeps your startup time and memory footprint low by doing the heavy lifting up-front" "Easily spin up servers and clients in your unit tests and run them instantaneously" Which is EXACTLY what I want in a framework. Having built two greenfield Micronaut services at work, as well as maintaining a few others, I can say it's bullshit. All the stuff I listed about Spring above is still true of Micronaut. > Also, there are very small libs for java, you don’t have to create a spring/JEE app. I like https://sparkjava.com/ https://sparkjava.com/ but I'm never going to be working with colleagues who choose it over Spring/Micronaut. [1] https://micronaut.io/ https://micronaut.io/
- pyjug 6y agoAs an experienced Java programmer , I decided to do a project in Golang to see for myself what the hype was all about. And it was...underwhelming. The Go plugin for VScode barely works - terribly slow, inconsistent autocomplete, hanging during debugging etc. I had to pay for Goland just to get a reasonable experience which is still worse than Java+IntelliJ community edition. Language wise - you need for loops for everything, no maps or streams. Also where are the concurrent collections in the stdlib? I wonder if all the Go love here is from people who never worked in earnest with Java ? Or only worked with dynamic languages before?
- void_mint 6y agoIt's interesting that you chose VSCode + Go plugin rather than IntelliJ Community + Go plugin?
- wolfi1 6y agohmm, I even use VS Code for Java
- void_mint 6y agoSure - OP seemed like they were implying they're already comfortable with IntelliJ. If you're trying a new language, and then also trying new tools to learn that language, it sounds like you're taking on too much at once. If you're already comfortable with IntelliJ, you can continue to use IntelliJ.
- pyjug 6y agoRight, I wanted to have the “modern development experience” as much as possible. Most tutorials out there still recommend VSCode to get started with Go.
- ilrwbwrkhv 6y agoYup many migrated from node js
- dimitrios1 6y ago
- kissgyorgy 6y agoEverything the author writes about is VASTLY different nowadays, but lots were false in 2014 too.
- aabajian 6y agoI learned Java long time ago and have worked on a number of large projects. I agree that it is easier to maintain code in Java. The downside, as the author described, is the verbosity of the language. Python is a wonderful language and exemplifies the "essence" of programming in that it nearly looks like pseudocode on a whiteboard. The syntactic overhead is minimal. I liken it to solving an algebra problem with pencil and paper - you would never write "int x = 5" on paper, just "x = 5." It's this simplification that makes Python a joy to use...but also difficult to maintain. Programmers have to get in the habit of following code style guidelines, rather than being (somewhat) coerced into them by strong typing. A simple example of this is the question: Where does a Python program start? If I provide a Python script, the reader would have to scan from top to bottom to see the first non-definitional line of code. With Java, there is no ambiguity; it is the main function. A company may declare a style guidline that requires Python programs define a main-check function such as: if __name__ == "__main__": main() but the developer needs to learn this policy.
- EdwardDiego 6y agoMy biggest issue with Python dev is the env management and tooling around it. My current favourite is Poetry but it still feels lacking compared to Maven or Gradle.
- kaba0 6y agoI don’t think the verbosity of modern Java is any worse than any other mainstream lang out there. The only one I can think of is that 4 plus lines of a class with a main function. But it has lambdas that are not as good as haskell with currying, but quite concise, it has type inference with var (that can even infer the Generic’s arguments), with records class definitions are one-liners. Properties are verbose but they are absolutely not necessarily for not-bean-oriented codebases.
- jtth 6y agoI think folks are missing the forest for the trees: he's saying pick a language to really focus on and own it. That's your big tool now. Of course there will be other tools for more specific contexts. But having one big popular language in your tool belt (regardless of what it is) is better than skimming the surface of the tool-de-jour, especially as that tool is likely de jour because it satisfies an en-vogue concept.
- skrebbel 6y agoI'm impressed by how well this article aged. You could do worse than follow the author's suggestion to the letter, 7 years later. And pretty much for all the same reasons.
- bestinterest 6y agoThis is an interesting take so here is my small input. Sometimes I wonder if the language matters or the community/ecosystem for the domain is more important. I like Java myself but is it ever used for a small SaaS startup? Does it have great things to empower single developers? Rails land has things like ActiveStorage, Hotwire, super easy migrations, great CLI tool etc. SpringBoot is not the replacement you want. Java feels terribly corporate and I feel its libs reflect it. I was recently looking for a Sidekiq alternative for Java land and the experience is so dramatically different all the way from pragmatism of the library and how its marketed to the beautiful documentation provided by Ruby land people. I imagine it being the exact same case for Python and data science. The language you want to go is probably the language were millions of people before you went for the exact same scenario. This is just a silly take and I will probably have changed my mind by the end of the year but a thought nonetheless.
- kaba0 6y agoThe community/ecosystem of Java is just huge, there is basically no domain where it would have no libs available. Only python has a comparably large ecosystem.
- jsnell 6y agoEarlier HN discussions: https://news.ycombinator.com/item?id=8677556 https://news.ycombinator.com/item?id=8677556 https://news.ycombinator.com/item?id=11386306 https://news.ycombinator.com/item?id=11386306
- cybrexalpha 6y agoThe takeaway for me is that the team's skill set is often the biggest factor in selecting a language. Everyone knows Java? Just use Java. But if everyone on the team knows Typescript you can bet I'd be saying "Why don't we just use Node for this"?
- mrkeen 6y agoI was part of a JS / Scala team, where one of the JS guys would constantly argue to port the Scala code over to JS, because there were more JS guys. Once the team shifted and we outnumbered him, he didn't seem to push that argument any more.
- simpleguitar 6y agoThis article is more about having a common culture than about different programming languages. If the author was in a Node.js shop, or a C# shop, or a Golang shop, it would be whatever language everyone is familiar with that would win out. Having said that though, some languages prevent themselves from being used for "Everything". Python, Perl, PHP, Ruby for example often needs to be paired with another language for performance reasons. The ergonomics of "modern" compiled languages is good enough for everything now. I've been using Go for everything for many years now, and it's fine. I know people/shops who use Java or C# for "everything", and it's fine. Fine here being defined as "not needing to learn another programming language to solve my problem".
- slver 6y agoAny language can become the language for everything, if it sees enough evolution and features enter the platform. The problem with Java is that it clearly shies away from more direct memory control, and as a result it's significantly disadvantaged on modern hardware in terms of raw performance. You may dismiss this and say "but Java is faster than C++ in some cases". In some cases yes, like when you do raw math and don't load and store much state. But handling state efficiently is Java's weak spot. Objects are tiny fragments scattered around the heap. Look at .NET and C#. Unity can implement architectures like Entity Component Systems, because C# has decided long time ago to be the "Java for everything" and that's precisely what it ended up as. It started as a Java clone, but added some features of C and C++, it has some features of JavaScript and Python, it has everything. EVERYTHING. It even has a native AOT profile, in case you wanna write a kernel driver or an entire OS in C#. The only thing stopping C# from taking over the world is the association with Windows, I bet, otherwise everything would be C# by now. As for Java... it FELT completed a decade or two ago. But now, it feels lacking. It's basically become EnterpriseScript. We'll see how Valhalla and Panama pan out, but for now evolution is a bit slow.
- mtmmtm 6y agoJava is faster in almost any way (compared to C#). Do you have benchmarks showing i am wrong ? It also has multiple AOT compilers and a much larger eco-system.
- kaba0 6y agoC# can be faster due to exposing lower level constructs. But for complex applications/not-heavily-optimized code, the JVM will likely perform better, eg. in GC throughput definitely. There is an interesting issue on benchmarkgame’s repo, where C# is ahead a bit using a clever trick. It basically halves the required allocations. And Java is insanely close with double the allocations.
- igouy 6y ago> There is an interesting issue on benchmarkgame’s repo… No. There was an interesting issue. The clever trick was disallowed and the programs that used the clever trick were removed. > … insanely close with double the allocations… No, what you see is not with double the allocations. The clever trick was disallowed and the programs that used the clever trick were removed. Read the program source code.
- dang 6y agoSome past discussion: Java for Everything (2014) - https://news.ycombinator.com/item?id=11386306 https://news.ycombinator.com/item?id=11386306 - March 2016 (83 comments) Java for Everything - https://news.ycombinator.com/item?id=8677556 https://news.ycombinator.com/item?id=8677556 - Nov 2014 (338 comments)
- zumu 6y ago> Java’s a pretty nice language, and when my code compiles, which is often the first time, it’ll usually also run correctly. This is the exact opposite experience for me. I find Java's type system to be extremely lacking (e.g. nullability, no discriminated unions, etc.), such that I write plenty of application code to mimic what a robust type system would enforce. Unfortunately, since it's not a compile time check, if you do it wrong, you get errors in production. In this way, it is the same as a fully dynamic language—what compiles has loose guarantees about correctness. Excuse me for a moment, but I'm going to be that annoying guy—but once you get some experience with an ML style language (e.g. Haskell, OCaml, SML, etc.) it's painful to go back to these class name based type systems.
- nextos 6y agoF# might be a great compromise. A HM type system plus a Java-like platform with excellent libraries and support.
- zumu 6y agoDo you know anywhere that actually use it? I've heard Walmart Labs, but that's about the only place I know about.
- lmm 6y agoScala is similar, with a somewhat nicer type system (full HKT) and an even more Java-like platform.
- shirogane86x 6y agojust as a heads up, as someone who's worked as an F# dev for the last three years: it's HM, but compared to the other languages mentioned (Haskell, OCaml, SML), it still tends to feel C#-y when doing fairly complex things. Also some things don't quite feel right: indentation is sometimes finnicky, type inference only really works left-to-right (might only be a problem for me, I do a lot of Haskell in my free time so right to left feels more natural), still has all the baggage from other .NET languages, which helps interop, but also means that when you try to bend the type system a bit you end up with method overloading. Even for simple things like optional or named parameters (which can only be done on uncurried instance and static methods, but not on functions). Type providers feel great until you have enough that they break your editor and they slow compilation down massively. editor tooling also feels pretty immature (it didn't work well at all on my machine, but YMMV). I think if you want to use an HM language, go with OCaml/Haskell, don't bother with F#, unless you specifically need the ecosystem. OCaml/Haskell's ecosystems are smaller compared to .NET, but you can still get by a lot of the time, and IMHO you get a more polished language + an ecosystem that was designed for it, as opposed to getting a language that at points feels dodgy + a big ecosystem that (for the most part) wasn't at all designed for the language you're using. TL;DR: F# is only worth it if you need to take advantage of the .NET ecosystem, otherwise just go with SML/Haskell/OCaml
- dzonga 6y agoonce again there's a confusion of static types and performance. A lot of languages are performant and are easier on the eyes | type e.g F#, Ocaml and maybe Golang. another issue is OOP damaged a lot of people's thinking. Is it a Dog or a Cat or is it an Abstract Animal ? How come the LISPs, and other functional dynamic languages don't need static type declarations. Btw LISP can be fast as C. I will give you a tip: those dynamic languages knew beforehand to separate code from data. These days they call it Data Oriented Programming. Before not so smart folks like called it dealing with values. Values don't change and easier to deal with negating types. Python performance sucks, wish there was something better with close to an equivalent community. F# would've been that language but it's treated like a red headed step child by Microsoft. And one thing about that sucks about Java and by large JVM languages well besides Clojure is the ergonomics to get started. do you use Maven, Gradle ? whereas with python -- python script.py n pip install. Yeah java has javac but you won't find anything that says use the java compiler for simple programs.
- gleenn 6y agoI definitely think Clojure is the sweet spot. It isn't easy to learn, but it is extremely simple to architecture things once you get how things are supposed to work. I've done plenty of pure Clojure projects, and am also on a large, heavily-Java-iterop project and Java is great for perf but also Clojure is still extremely fast. Things tend to get wayyy better when you start ripping the Java code out except for where you really need it.
- jcelerier 6y ago> How come the LISPs, and other functional dynamic languages don't need static type declarations. if they really didn't we'd be using operating systems written in LISP instead of C > Btw LISP can be fast as C. I will give you a tip: those dynamic languages knew beforehand to separate code from data. ditto
- rakoo 6y ago> if they really didn't we'd be using operating systems written in LISP instead of C Some people live happily inside Emacs. It has become an OS for them.
- Abishek_Muthian 6y agoIf you're a millennial and involved in SW-development then its likely Java has touched your life in some way. Java was the magic pill in late 90s in India and every Engineering graduate irrespective of their domain was told to get certified in it for a job. My sister(ECE) was one of them, my father got our first computer (Pentium-III ~900 MHz)to help with it in 2000 (which was a big deal for a middle-income family in India) and unfortunately the Dot-Com bubble crash hit its peak with absolutely no recruitment for java developers. My sister struggled for a while, fortunately was able to switch domain(non-SW) and has a great career now. Fast forward to 2005, it's my turn in the Engineering college - CSE (A premium one, so job was pretty much guaranteed). Our 2nd year has introduction to programming with Java, No C, no low level languages, straight up Java. Since meritorious, Many in my college are from very poor backgrounds who never had access to computers, taking in Java directly was very tough for them. So almost everyone went for C-programming training outside our college run by one of our alumni(He has now started his own Engineering college, one of the largest in the city!) all of them studied C, so they could understand Java(programming) better! In late 2000s it was common to define your job as a 'Java developer' and it was understood in even rural India. Famous movies were made where a character goes from rags to riches because of Java. Then in 2008 during my placements recession happened, only fraction got placed(mostly in java dev), I was into J2ME and so waited for a mobile development job. Then Android happened, got a android development job and of course Java development background helped me a lot(Worked with other major languages every now and then). Fast forward 2019, I've shutdown my startup due to health issues. I'm not writing android applications or java-back ends anymore. Wanted to switch to some other language as primary language partly because of java fatigue, partly because learning new language could help me divert my attention from the ongoing issues, but mainly because I have less time to code(Any time saved is a time I can put for my health) . I chose Go, because I've been burned before by Python when the application scaled up requiring expensive optimizations. Luckily Go was everything I wanted from a new language although it wanted me to empty my cup(pun intended). Now, most of my code is in Go be it production applications or home automation scripts. I don't think I'll be able to touch Java again(perhaps maybe it brings back memories I don't really cherish) or may be I'm just adamant. If you have made it so far, Thanks for reading.
- twic 6y ago
- quasarj 6y agoOh my GOD he is writing shell scripts in Java? This man has the patience of the gods. Not because of the writing, but because he actually has the time to wait for Java programs to start when he wants to run a small shell script? You could run 5000 bash scripts in the time it takes java to load. You could run 500 python scripts. What is this guy smoking!
- selfhoster11 6y agoBeanshell starts up pretty quickly. Besides, Bash scripts take an eternity to write safely and aren't really suitable for any sort of heavy calculations or string manipulation without resorting to arcane syntax. I would say it's an all-around good alternative to Python scripts when one outgrows Bash due to requirements.
- mtmmtm 6y agoI have also written some shellscripts in java (i did not smoke anything). If startuptime would be an issue (normally it is not) i would just use graal-vm to compile it. Just do this: "native-image script"
- tincholio 6y agoTo be honest, it seems like the author has never tried Clojure, for example. You get most of Java's ecosystem and JVM benefits (and if performance becomes an issue, you can drop down to Java), while being way more expressive and easier to write.
- Scarbutt 6y agoThe author clearly states he prefers a statically typed programming language for large, long-lived programs.
- therealdrag0 6y agoI’ve never used Closure, but I’m a couple years into Scala after many years of Java. And I don’t think I’d be happy if I had to go back to Java full time.
- slaymaker1907 6y agoFoo x = new Foo() is not the culprit. LinkedList<HashMap<MyFancyBusinessObject, String>>> is the culprit. Also something I don't like with Java is that it is a lot of ceremony to actually start a new greenfield project or script in it. My favorite experience with this sort of thing is Racket where I just launch DrRacket (after ONE very easy install on any platform), start writing my program, and hit run. I don't even need to save my program if I don't want to (it does autosave though so you probably won't lose your program even if DrRacket crashes!). To be fair to Java though, jshell is a very nice REPL which is surprising for a language like Java. It is actually my preferred way to do one off date calculations since most languages don't seem to have a nice way to do date arithmetic built into the language itself. The situation with one off scripts is something that could really be improved in Java by having a dialect which just runs the file top to bottom like C# recently did with top level programs.
- panzerboy 6y agoIf you like jshell, you should give jbang a try: https://www.jbang.dev/ https://www.jbang.dev/. It allows you to write “scripts” in Java and you can easily use any 3rd party library.
- miskin 6y agoIronically, but when you open your ex-colleague's code 5 years later, you would easily guess Foo, but you would be very thankful for LinkedList<HashMap<MyFancyBusinessObject, String>>> type definition.
- kaba0 6y agoNot exactly what you want, but if you do have a class with a main function, you can sorta run it like a script with `java Main.java`, and it will compile it automatically and run it.
- muhmud 6y agoJava 11 now has a built-in mechanism to run a single file Java program: https://medium.com/se-notes-by-alexey-novakov/shell-script-in-java-8b3339be0280 https://medium.com/se-notes-by-alexey-novakov/shell-script-i...
- yashap 6y agoI think there’s a very strong argument for trying to have only one language at your company, or at least one backend language. Of course you’re still going to have some scripts, and some config-based programming for infrastructure and whatnot, but otherwise you should basically aim for a single (backend) language IMO. Assuming you’re doing reasonably high level work (like building a typical SaaS product, not a database), I also think you’re probably best off choosing a language with the following properties: - statically typed - garbage collected - reasonably performant - reasonably easy to hire for, or at least pretty quick to learn - compiles pretty fast - has a strong ecosystem, great libraries/frameworks/tooling Java fits, but so do Go, C# and TypeScript. This article says Go is too new, C# not cross platform enough - both true in 2014, but not 2021. And it doesn’t mention TypeScript, but it was VERY new in 2014, so understandable. It’s performance isn’t as good as the other 3, but has the major advantage of letting you have a single FE and BE language for a lot of projects. My current company is full stack TS (RESTful services with TS/React on the web, TS/React Native on mobile), and it’s very convenient/productive most of the time. Scala is my personal favourite language, but I’ll agree it’s too hard to hire/train for to be a practical choice. But Java has plenty of competition from Go, C# and TypeScript.
- twic 6y ago> I think there’s a very strong argument for trying to have only one language at your company, or at least one backend language. Of course you’re still going to have some scripts, and some config-based programming for infrastructure and whatnot, but otherwise you should basically aim for a single (backend) language IMO. Perhaps the real kernel of the advice in the article is "try to use your primary language as much as you can, even for things it is not traditionally used for". My team mostly writes Java. We do write Python for a lot of little scripts - collecting and munging data, dashboards, etc. I have come to think that we should just do those in Java as well.
- davnicwil 6y agoOn the verbosity point of Java, I'd say the following: At write time, verbosity is mostly solved by intelliJ. Code gen and tab complete make it at least as fast to write code as any other language in any other editor. At read time, verbosity is your friend.
- brotherofsteel 6y agoUnnecessary verbosity is not your friend at read time. Unnecessary verbosity is also not your friend at write time. Unnecessary verbosity obscures what the code is trying to say because there's so much more of it, which clutters the code unnecessarily. Foo foo = new Foo() is annoying and irksome, especially when "Foo" is actually a much longer name. Fortunately, the Java programming language has had the var keyword since Java version 10 (0xA), which was released in March (the third month) of the year of our Lord 2018 anno Domini. That being said, I like Java. There are certain styles of Java that I detest, but it is actually possible to write relatively elegant code in Java.
- utf_8x 6y agoSo here's a controversial opinion: use whatever language you're comfortable with and use the time you'd spend in flame wars about Java to make something useful instead.
- incrudible 6y ago"The problem is that programmers perceive mindless work as painful and time-consuming, but the reality is never so bad." No, that is the actual problem. Your feelings don't care about the facts. You don't want to filter developers for their tolerance for mindless, time-consuming and painful work. If you do that, Parkinson's law will strike you so hard you'll turn out like IBM. Of course, you also don't want to end up at the other extreme, where all the parts of your stack are so exotic that only one person on the planet is qualified to deal with it - and they just left the company.
- ksec 6y ago>> @spolsky Digg: 200MM page views, 500 servers. Stack Overflow: 60MM page views, 5 servers. What am I missing? << That's the PHP factor That tweet was from 2010. Modern Day StackOverflow 1.3 BILLION page views per month, ~20X! 23 Servers including Redis, SQL and Elasticsearch. ~5x. Although Stackoverflow is pretty much a read heavy site. And while people can have an opinion on Java the language, the JVM and its ecosystem is often overlooked and under appreciated. Look at GraalVM.