Hacker News new | past | comments | ask | show | jobs | submit login
Python overtakes Java to become second-most popular language on GitHub (hyvor.com)
27 points by SupunKavinda on Nov 10, 2019 | hide | past | favorite | 24 comments



Not a Python fan (like, at all) but can't say I'm surprised. I'm doing still lots of Java development as freelancer to pay the bills, but the Java9+ "update" has just deprecated too much of the Java ecosystem. World-class backward compat was the one thing that Java got right, but lifting a couple years old Java apps to Java 8 and 9 was such a painful experience (with Spring 3->4, idiotic deprecated "REST" frameworks, and old netty servlet and jspc maven conflicts, none of which had a reason to exist in the first place IMO). Ironically, as we're moving to a world of closed language ecosystems, and nobody produces regular shared or static libs anymore in favor of the respective language's own little package manager, the Java ecosystem could have played to Java's strength. It's depressing to loose a whole generation's work of love who saw Java as the go-to language for such a long time with two world-class IDEs to choose from, but I guess Java has run its course as a language that started as a bytecode format for set-top boxes. Will Python (started as the ABC language for non-technical users) take its place? I highly doubt it.

Update: do you have a recommendation for a Java exit strategy? Like, using a language that can compile to JVM byte codes to integrate with existing code bases, yet can also be compiled into native code on x86/64 and ARM/64 for linking against?


Java was a one size fits all language. Nobody wants that anymore. I work for a bank, most of our applications are in Java, but like 90% of these programs are very rudimentary transactional applications: take this piece of data and send it over there.

We had a small pilot project to test replacing a Java app with a NodeJS app. The node app was a single file of about 50 lines of code, whereas the Java app had all sorts of bullshit associated with it. It needs to be compiled and the dependencies need be installed, you need a specific version of the JDK, make sure you run in with special flags... all to receive an HTTP request, pick out some data, then forward it on to a downstream server. Huge productivity gains from never having to fight a build, it was stupid easy to set up the deployment pipeline too, much to the chagrin of the devops manager. Git pull, npm install, node app.js and that’s it.

The Java exit strategy is to find the technology that serves your needs. There’s just so much bullshit associated with having a language that does it all that I think people are starting to look for solutions with common sense defaults. Why, in 2019, is it still so fucking awkward to deal with JSON in Java? Why do I have to handle so many interfaces and classes to make a simple HTTP request?

C++ is facing the same reckoning as Java, thanks to Rust. You’d be stupid to start a C++ project these days, given all the sanity that Rust brought to that ecosystem.


As much as I like Node.js since the CommonJS days for lightweight web backends, I think it's a crap environment for the kind of apps Java is used for. Those being complex business logic where Node.js' always-async, cooperative multitasking model is a regression not helping maintainability. And it just plain doesn't work well with even slightly CPU-bound tasks unless you're starting extra V8 isolates/processes.


> Java was a one size fits all language. Nobody wants that anymore.

That sounds like a very opinionated claim. Can you back it up with any kind of evidence?

Also, am I the only one that finds it kind of ironic that you describe how a scripting language, whose main use is creating interactive web pages, is used as a Java replacement?


Javascript is a functional programming language. Bash is a scripting language, perhaps you’re confused.


No more ironic than using Java the original purpose of which was for developing portable interactive apps on set-top boxes ;)


It is ironic because the poster claimed that no one want one size fits all languages anymore. And then he goes on to describe how they replaced Java with Javascript.


> C++ is facing the same reckoning as Java, thanks to Rust. You’d be stupid to start a C++ project these days, given all the sanity that Rust brought to that ecosystem.

The whole world disagrees[1]

[1] https://trends.google.com/trends/explore?date=today%205-y&q=...


Rust came out in 2010, of course it’s not going to have the same numbers as one released in 1985.


> but the Java9+ "update" has just deprecated too much of the Java ecosystem

Such as?


As I said: netty, jspc, jax rs still maintained on java8+ with Spring 4 and maven packaging plugins, etc.


These projects are all alive and well. And both Netty and Jersey (JAX-RS) had their latest release less than two months ago.


> Like, using a language that can compile to JVM byte codes to integrate with existing code bases, yet can also be compiled into native code on x86/64 and ARM/64 for linking against?

Any language supported by GraalVM (https://www.graalvm.org/) should be able to do this (including Java).


Yes but there's no non-JVM-only, statically-typed language supported last I checked.


> two world-class IDEs

I can't say I've done enterprise work (so maybe these tools pay for themselves), but the idea of a project bound to its editor fails to warm me.


> Not a Python fan (like, at all)

Could you please shed a little light on this? I'm genuinely curious.


My preference (for a language to replace Java): compiles to native code, statically typed, proper language spec with multiple implementations, unopinionated

Python: dynamic (yet with soft-typing bolted on), interpreted (and quite slow due to GIL); worst package management story compared to all the alternative; "the Python way" is not my cup of tea, I hate significant whitespace, and have been burnt by the Python2->3 fiasco

I value portability and formal language spec with multiple implementations as being the most important for me, precisely because of the experience of loosing code bases due to language lock-in.

So far, I've come up with JavaScript as a meta-language, and running it on Node.js, browsers, and also compiling a subset of it into native code, but while JavaScript is a good enough practical language for small apps, the direction it is being taken to in ES6+ and HypeScript to become "more like Java" doesn't make it a non-terrible language for large apps IMO. Also, it doesn't satisfy my static typing criterion.


> quite slow due to GIL

I don't want to defend the GIL, but that's not the reason CPython is slow. PyPy can be 100s of times faster, and it has a GIL too.


You're probably right, I'm not a Python insider.


I'm not the GP, but here's my take on it.

First some good: Python is amazing for how approachable it is. I've tried to teach (non-programmer, but smart) people I know other simpler programming languages, and it doesn't take. For some reason, when I show them Python it goes so much better. Despite the flaws, Guido and crew clearly got this part right. I don't think any other language makes new programmers feel comfortable so quickly.

Ok, for the bad:

Python is a very slow interpreter. If all you're doing is gluing together C/C++ libraries and invoking them from Python, it works just fine. However, my experience writing new algorithms in pure Python is that they run between 50 and 1000 times more slowly than nearly equivalent C.

Python exposed so much of its its internal implementation for making C extensions that the developers hands are practically tied when it comes to improving the implementation. If you look at the Python C API, you'll see most of the structs exposed and 100s if not 1000s of public functions. Important (and complicated) extension modules (such as Numpy) are now dependent on lots of the current implementation details. This is the reason that alternate implementations of Python (such as PyPy) can never really catch up to compatibility. Many other languages provide the same functionality for C extensions/plugins without the same exposure to all of the internals.

Python painted itself into some odd corners by not requiring variables to be declared. Most programmers are surprised by the behavior of this snippet.

    a = 0
    def doit():
        print(a)
        a = 1
    doit()
    doit()
Also, it doesn't happen a lot in my experience, but typos in variables names can be silent errors because it will just introduce a new variable. Similarly, they needed to add a "nonlocal" keyword for when you want to modify something outside your scope. Note, you don't need nonlocal to just read it though.

If there was a "var" keyword required to declare a new variable, you wouldn't need global or nonlocal, you could catch more typos in variable names, and the program above would behave correctly.

There are other issues too, but this post is getting long already, and these are the some of the big ones to me.


> Python is amazing for how approachable it is. I've tried to teach (non-programmers) ...

This I can agree on. Had a great experience teaching Python to 8-9 year-olds. OTOH, teaching JavaScript to 12-13 year olds for light browser gamedev was a disaster.


> Most programmers are surprised by the behavior of this snippet.

Ok. I'll bite.

I get UnboundLocalError: local variable 'a' referenced before assignment

shouldn't it print 0 twice, since a is considered a global variable at the time print(a) gets called?

EDIT: If I delete print(a), then it prints 0 twice. What the hell?



Well deserved




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: