Live data from Hacker News

Python overtakes Java to become the second-most popular programming language

techrepublic.com

291–300 of 357 posts

Re: Python overtakes Java to become the second-most popular programming language

#291

Earlier quoted context omitted.

I've often found that starting some quick-and-dirty thing in shell scripts is great, but once I get to around 100 lines of shell script code, I'm better off switching to python (or similar). Similarly, once I get to around 1000 lines of python code, I'm better off switching to compiled, statically typed language (e.g., Java, C, C++, etc.). So my own heuristic has become: shell script when

This was my heuristic years ago before Python got type annotation support. Now there are linters that take type annotations into account, and LSP servers that can catch type errors as you write Python code. I've found that using Python for large projects is both fine and productive as long as you utilize type annotations and modules. Ambiguity goes out the window when you do that.

I was super hopeful about type hints but they fell short of my expectations, unfortunately. It takes you to a place full of kluges and workarounds and hacks which is all .... really unpythonic.

In the end I feel, if you really want that, use a language that treats types as a first class citizen. There are languages with most of Python's attractive features but actual optional typing (we use Groovy), or static with really good inferred types (eg: Kotlin) etc.

Re: Python overtakes Java to become the second-most popular programming language

#292

Earlier quoted context omitted.

Just curious, what other server side languages do you feel have a better library ecosystem than Node/JS?

Depends what you mean by "library ecosystem". If it's raw number of packages then npm is number one. On direct opposite side of spectrum you can find e.g. Elixir/Phoenix - relatively small number of packages in registry but even built-in stuff covers 99% of what you want - and makes this effortless for you. E.g. after single `mix phx.new YourAppName` You get * Pre-confugured prod/dev/test environments * Preconfigured…

I've heard great things from Elixer/Phoenix fans, so I'm sure it's a great framework, but I'd argue you get a pretty comparable set of features with some of the most popular project templates for the bigger, older frameworks like Django or even Rails.

That said, I've seen that "liveview" thing demoed and that is definitely pretty slick. Off topic but it's very similar to a package I implemented in Django like 6 years ago or so (and happened to name it the exact same thing, too) --- sadly was for work in a proprietary setting, although I'm off-and-on working on remaking it now for a different project where I can open source it.

Re: Python overtakes Java to become the second-most popular programming language

#293

This might be a stupid question but anyway... Is there someone well-versed in a statically typed language who would still prefer python most of the time? Could you explain why? For me it's just the opposite. When I program I think about the types first. When I read code I care more about types than variable names. This is in my opinion the way to go even in C. Also most python programmers I know are engineers and for…

When I program I think of business problems to be solved. Types barely register. Yes, on a big project with lots of developers types become more of a priority. At that point I let an IDE worry about them.

Re: Python overtakes Java to become the second-most popular programming language

#294
post #256

Earlier quoted context omitted.

yeah, I use S7 Scheme. It's a complete scheme interpreter in one C file, super easy to embed, quite similar to Clojure linguistically. Basically all "business" logic is in Scheme, all OS/UI interaction is in C or C++. For me, it's amazing, because I write music apps and I can reuse my model code across desktop, phone, in Max/MSP or PureData, in web assembly, everywhere. Being able to prototype in Max is awesome. My m…

Interesting. This actually sounds very similar to game developers embedding Lua or V8 for various logic. I've used Lua myself in a similar way, embedded in a high perf application, with a user script driving the logic.

Yeah Naughty Dog was doing the same thing in Scheme apparently!

Re: Python overtakes Java to become the second-most popular programming language

#295

I was a total raving Python evangelist for the first 12 years of my coding career, and then got a job as the CTO for a Python based startup that had been running absent a technical leader for 5 years, with relatively junior coders making all the decisions. I still love Python, but I now have a completely different attitude to hyper-dynamic languages (like Python, Ruby, Clojure, Elixir, etc). In my new opinion, they a…

Have been on a similar journey within the company I'm at now. Starting out with fairly loose Python, and now seeing egregious bugs make it into production and hurt your team's reputation, you start asking "why the hell are we suffering from things that are highly preventable". You work your way through type hints, strict linting, code reviews, etc etc, but you end up realising you're in part just using a hammer to nail in a screw.

Re: Python overtakes Java to become the second-most popular programming language

#296

I was a Python dev for 14 years or so (now doing mostly personal projects in C/C++, Scheme, Clojure), and 10 years ago met my partner who is a biologist. I think one thing programmers underestimate is how many scientists and academics are using Python. It's not just ML, it's pretty much every kind of scientist and tons of non-science academics too. The fact that it's a great "casual" or part-time language is huge for…

I'm one of those scientists, working in industry R&D. I use Python for everything from Jupyter notebooks to a roughly 8000 line program that runs a prototype of a product. Python pulled me away from Visual Basic several years ago, and then I have a longer history going back through Turbo Pascal and ultimately originating with primordial BASIC. On the hardware side, I use C within the Arduino ecosystem. I've got roughly a half dozen other scientists at my work site using Python at various levels.

Confession: Code quality is a problem. I care a lot about code quality. My team recently brought on a couple of people with real programming background, and I've asked them to help me bring myself up to date on good techniques, and it has helped. I was lucky that some of my former training, e.g., in Pascal, was not just about how to program, but actually how to write good code (for its time).

But here's my view. Don't just tell us that our code sucks. We already know it, but we're under the same pressures as anybody else, and programming is a force multiplier that we won't give up. We need instructions that we can understand at our level, that will help us do this stuff better, perhaps incrementally. Starting with a strict discipline is hard, but Python supports the ability to go back through working code and improve it.

Re: Python overtakes Java to become the second-most popular programming language

#297

I was a total raving Python evangelist for the first 12 years of my coding career, and then got a job as the CTO for a Python based startup that had been running absent a technical leader for 5 years, with relatively junior coders making all the decisions. I still love Python, but I now have a completely different attitude to hyper-dynamic languages (like Python, Ruby, Clojure, Elixir, etc). In my new opinion, they a…

Some interesting responses here, thanks. Not surprisingly lots of people are saying "types would have saved you". I'm sure they would have helped, though I personally think they do introduce a high cost too, and I'm a lisp-head nowadays not a Haskeller. The real culprits, thinking about it since my post, were side effects and mutability . Python lets you create incredibly difficult to trace chains of side effects and…

Thanks for making this point. People focus on types but it's the whole smorgasboard of modern features missing from Python - lack of proper (idiomatic) support for functional programming, None types, etc etc.

Re: Python overtakes Java to become the second-most popular programming language

#298
post #242

Earlier quoted context omitted.

I can't actually say what the popularity of C/C++ is. But I don't know what you do for a living but in general Hackernews tends to have webdev tunnel vision. Embedded, operating system development, browser development, OS, driver dev, games, telecoms, compilers, lots of IoT, systems development generally, all of this is in C/C++, and will be for the forseeable future. That is a lot of lines of code, but mostly invisi…

I've worked (not just played with) almost twenty languages in a career about the same length in years. I'm well aware of the things C and C++ are used for. I'm currently mostly working in Rust at that moment to make use of libraries in C++. But I think web development easily swamps that kind of work in terms of number of developers.

> But I think web development easily swamps that kind of work in terms of number of developers.

does it though. IBM alone, a service company, has 380000 employees. And there are tons of service companies like that - at least in my country they are mostly doing Java and the like.

Re: Python overtakes Java to become the second-most popular programming language

#299

This might be a stupid question but anyway... Is there someone well-versed in a statically typed language who would still prefer python most of the time? Could you explain why? For me it's just the opposite. When I program I think about the types first. When I read code I care more about types than variable names. This is in my opinion the way to go even in C. Also most python programmers I know are engineers and for…

Sure — for context I’m very comfortable with Haskell, Typescript, Java and Scala, fairly comfortable with Agda, Coq, C and Rust. I don’t prefer Python (the reasons of which I can elaborate, if you’re interested), but I do prefer to do my programming in Lisp-like dynamic languages — even when not using meta-programming.

The reason for this is quite simple. A static type-system, by design is meant to invalidate programs which are incorrect and accept the programs which are correct. All static type-systems which exist invalidate a certain number of programs which are correct — that is to say, you can write a perfectly valid program, but the type-system can reject it. What we term to be a more expressive type-system, is one which rejects more programs. The line which one draws in the sand as expressive enough is completely arbitrary and the type-systems we have currently heavily rely on the user constructing their programs in a certain way, so the type-system can prove certain properties about it.

Here’s an example demonstrating what I mean. Consider a theoretical language which uses : as the type-ascription, has generics/kinds and all functions are total. A code-snippet taking the head of a list might look like this:

> let num: Option = head(numberList)

Note that the return type of the head will be Option, if the function is total because the list can be empty. Now suppose I have the snippet — locally I can reason that the type of num should be Number — but I need to prove that to the type-system. In most current type-systems, proving this requires you restructure your code in a particular way.

> let numberList = prependList(4, previousList)

> let sortedList = sortList(numberList)

> let num = head(sortedList)

What I’m trying to drive at is that static type-systems are a spectrum and at some point you will run into a case which you’ll either need to use an escape-hatch or restructure your code in a non-trivial way to satisfy the compiler. The boundary of what you determine to be correct is also completely arbitrary — you can always encode more properties and restrict your code further; how far you go is ultimately determined by you.

Re: Python overtakes Java to become the second-most popular programming language

#300
post #3

Python is certainly popular, but the TIOBE Index ranking is not credible. Quote: "The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. " According to this index, "Logo", beats out Rust, Scala, Kotlin, and Cobol. I cannot remind myself when I last time saw a course, book or even any source code covering Logo. This must be some very poorly vetted, automatically collected…

They rank C number 1. There is no way that reflects reality. JavaScript is easily number one for reasons that will surprise nobody. On the WakaTime public leaderboards it dominates to such an extent that I think programmers spend more time writing JavaScript than all the other languages combined. I don't know if that generalizes to the broader population, but it gives one an idea how ubiquitous it is.

> They rank C number 1. There is no way that reflects reality

Get a thousand random developers and ask them to list all the languages they know well. What do you think will be the most common?

C seems quite realistic given what they measure.

Post reply on HN