431 points · by abunuwas · 6y ago · 347 comments
Sure, this is a problem of people, not language. But there is something to the argument that absent discipline and experience, these can be dangerous. One can detangle a dog's breakfast in Java Spring a lot more easily.
(ever seen "import gc" in a Python program? yes, that means what you think it means..)
One company I worked at had "we hire the best!" as its slogan, and they used it to justify so much bad practice. No code reviews (we just don't hire people who write bad code), no unit testing (same reason), python used for huge sprawling 10+ year old codebases that's on its third or fourth generation of maintainers, and no documentation anywhere. Everything is a spelunking expedition, and there's no type safety or anything to help you figure it out. There are more than a few thousand-plus line functions that make PyCharm chug every time your touch a character.
On the flip side, the Java and C++ codebases were similarly abused (no tests, no docs, four generations of maintainers/oral tradition, no code reviews ever) but are at least two orders of magnitude easier to traverse because the type system keeps everyone honest across decades in a way that dynamic languages just do not.
I'm writing some Java at the moment for an Android app, and it's just killing me after doing Scheme and Python, but I have to admit, if that start-up had used Java or C#, they might have been better off in the long run.
Hiring really good, disciplined people is super, super hard. My current thought is that if you don't have a super-star CTO who can attract and keep real A+ coders, don't use advanced languages. And if you do have that CTO, do it, but make sure you are architecting to make the rewrite in C# or whatever doable when you sell your company. If I were starting my own business now, I'd use Clojure or Scala or F#, and design things so that in 5 years new owners had a decent path to switch to C# or Java wherever they want.
Android isn't Java though. It's some frankenstein contraption made from a mutated version of Java from a decade ago.
> I were starting my own business now, I'd use Clojure or Scala.
I personally wouldn't ever choose Scala for anything. It's tooling is horrible (Sbt is a special hell, and scalac is as slow as a C++ compiler).
I'm currently in a code base like you describe, scala core with a switch to Java. It's not fun. Were stuck with these legacy library and framework choices that don't fit into the Java ecosystem and it slows down development considerably.
that’s a logical fallacy. chances are that if they used Java or C# they might be dead by now (ie it sucks but usually it’s a good problem to have)
For any significant Python codebase, I make sure to put extra effort into precise and strict type annotations so I can rely on type safety. Sometimes after fixing all the statically detected type problems, my program works on the first try.
Python was strongly typed from the beginning, before it was statically typed. When you add a string to a number in Python, you get a type error. Python's static type system– which is formally part of the language and has multiple implementations– is an elegant and natural fit to the language. Unlike TypeScript, where the type system is artificial, and restricts what you can do with JavaScript.
Language features that made it into ruby– like blocks and unless– were rejected from Python because they would have made it possible to create advanced DSLs, which is something the language maintainers aim to avoid– enabling the creation of arcane application-specific special languages.
PEP-484 is the static type system's name: https://www.python.org/dev/peps/pep-0484/ (implementations include mypy and Pyre)
I don't feel confident when I program in Python, nor in Javascript exactly for the lack of proper typing. One could argue that if you know exactly what you are doing, types can even be ignored, which is kind of true - but they're there to help the developer and his team. I don't see any good reason to use Python over Golang, for example, if we only consider the language itself and the confidence that you get from using a statically typed language.
So my own heuristic has become:
shell script when < 100 lines of script
python code when < 1000 lines of code
else statically typed, compiled languageHowever, I have to acknowledge that modern IDEs (and even advanced code editors like VSCode) have pretty good support for dynamic scripting languages these days that make working with them in larger code bases not entirely painful.
These were the go-to "prototyping" languages people in science, R&D, etc. used (and still use!), and then you'd port those into more manageable languages for larger scale projects, or actual software products.
These days, Python does all that. Unless you need some extreme performance for your final product, a well-optimized Python program will work just fine.
But still, there's some of that matlab legacy left - instead of one comprehensive application, you have tons of smaller programs floating around, for one-off/single-issue uses.
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.
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.
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 mutations, and has basically no decent ways to prevent this. In Scheme, my code is still super small and I can dynamically create all kinds of object like things, but if I want private, I can make it god-damned private. In Python, anything can be changed by anything ("we're all consenting adults") and using side effects in weird ways is actually part of the idiom. I don't know how many times in Python literature I've seen some variant of "you don't need those baroque patterns because we can use 'import' as a singleton, running class initialization as the constructor". And so all the frameworks have crazy thread-local magic happening from bloody import statements!!! Do that too much and you have no idea what's happening where and why, and something as trivial as changing the order of imports can kill your app. Where I was, this had gotten so bad that the app couldn't even be turned on and tested in the normal way, and none of my predecessors had been willing to go through the pain of figuring out what the chain of imports were doing to bugger it up. (Because that didn't look like doing anything productive, I'm sure you all know the drill...)
If I were doing it again, personally, I'd use Clojure and Spec, and worry more about mutability and side-effects than anything else. Just my two cents Canadian.
The best codebases I have touched, in any language ecosystem, either didn't use a framework, or kept the framework firmly isolated from the other code. If you build your code "inside" a framework, it will eventually become an obstacle to change.
Furthermore, the best Java codebases I have seen avoided annotation-driven-development, reflection, classpath scanning, DI frameworks, AOP, etc. Anything that feels at all magical should be handled with great suspicion.
This. True in any language.
I agree with you, asking everyone to be discipline with their code in a dynamic language is a bit too much to ask (unfortunately).
Here I go about the batteries included vs micro thing. People pick Flask because it looks approachable but then DIY features in. The same thing happens with Sinatra+Rails. If the python ecosystem grows and other communities come in, maybe they will bring their culture and standards in.
Take poetry for python. It's basically, "hey ... cargo/yarn/mix/bundler all kind of figured out these ergonomics". Poetry's "why" section in the README really resonated with me. Cross pollination of ideas across tribes is _good_.
But then, I'm biased/blub-paradox of course. And it's definitely in line with the productivity/DSLs/rapid vs types/verbosity/slower modes discussion.
Fun fact, D language forum website is probably one of the fastest and the most responsive websites on the planet [2], and it's written in D but not based on vibe.d or Diamond [3].
[1] https://code.dlang.org/packages/diamond
Not job hunting, but always happy to chat with people doing cool stuff sort-of locally.
I also think rust's ? makes the "return err" pattern much nicer to deal with.
After 30 years of mediocre programming things I hate are unplanned/hidden side effects, train wrecks due to mutable state, and out of control dependencies. Error handling at this point seems like Weltschmerz.
People always ask me 'how do I become a programmer' the first thing I always tell them is 'you need to learn python it is fairly easy to pick up and learn' I aim them at the python org website and their excellent tutorials. Funny enough it weeds out the people who do not really want to be a programmer but thought it sounded cool, as they have to stop and learn something.
Some people may argue, "but documentation would make this an non-issue". Guarantees built-in to the platform itself are more reliable than human aspirations, or automatic memory management as a feature wouldn't have gotten popular.
I've seen the same occur with Spring based Java. To me this is similar to the old "no one has gotten fired for going IBM". The new phrase would be "no one has gotten fired for going with a static typed language."
When someone writes bad Java code, we tend to blame the developer. When someone writes bad Python code, we blame Python.
If you think it's the lack of types that make things more difficult to follow, you can always force build failure if type hints aren't provided (which Python has supported for a while now) in the same way you can fail your Java builds if test coverage isn't up to par.
Yeap. I ended up dragging my team to Golang due to this. Sure they didn't write unit tests and they still aren't writing unit tests. But at least now a compiler will take a look at the code before it's run. Lots of stupid errors at runtime disappeared.
For personal projects? Something like Python, Lua or Scheme is great. It can still be great in large teams, but they need to understand and care about what they are doing.
> but I would have been happier stepping into C++
Oh no you wouldn't. That's the nuclear foot gun.
I've been tasked(along with some great engineers, most more experienced than myself) to fix a mess left by two other teams. A project that was severely over budget and very late.
It was the worst abomination ever known to man. Crashes in random places. Race conditions. Global variables. Memory corruption galore. Lack of understanding of C++ in general (copy constructors, assignment operators, initializer lists) leading to many more bugs. Leaked like a sieve.
A lot of this wouldn't be possible in other languages (memory corruption in general). Some issues would happen no matter what (two modules opening the same file and writing on it simultaneously), unless something like Rust or Haskell was used to make this more difficult.
So far, that's the only project I've contradicted Joel Spolsky and it was completely thrown away and rewritten. Again in C++ because that was the requirement, but with proper modules this time, smart pointers and the like. It was completed in 3 months.
All of these are trivially detected with msan, tsan, lsan and ubsan.
Rails has a lot of magic that gets you running fast but it doesn't even have a service layer - and instead promotes the abomination that is mixins (concerns), fat models, fat controllers - stuff that gets you running with minimal effort but then crying over the code duplication all over the place and lack of logical separation.
ASP.NET is more verbose out the gate but you're basically guided in to stuff like repository pattern, service layer with POCO models, thin controllers and IoC. Static typing gives you guarantees when reading the code (I've seen RoR concerns that relied on random fields being present in target class, but had conditional logic with implicit assumptions about which class it would be included in - it was a hell to reason about). It's verbose but consistent and built to scale - I'll take a dirty ASP.NET project over a dirty RoR project any day.
This has serious implications for how you develop large systems. Don't try to get too sophisticated on a larger or longer-lasting project. You'll have people on it who won't' be able to play at that level, and if you try to make them, they'll make a mess.
The same thing happens over time. Sure, your team is only 20 people... today. But if the program lives for three decades, how many people will work on it? 100? Will they all be superstars? Even those maintenance people you hire 20 years from now? Probably not.
Actually, I find Nim language [1] to be a great alternative to C++ as far as compiled, statically typed, high performance modern languages are concerned. Moreover, Nim's meta-programming capabilities (generics, templates, macros) are second to none for creating elegant DSLs. And its syntax makes Python developers feel at home. Preempting questions about garbage collection -- Nim allows to switch off GC and manually manage memory if a programmer so desires. Or you can manually manage memory in some critical parts of your program while letting the rest be garbage collected.
In the several years I spent doing .NET consulting, I believe that this is the crux of the problem, and not Python per se.
In .NET land (probably Enterprise Java too), this often manifests as an apparent goal to get every single pattern from PoEAA [1] into every file rather than extensive metaprogramming - but the root cause is the same - juniors not having appropriate guidance.
I don't think so. It is a problem of language.
Or more specifically, of dynamically typed languages (DTL) vs/ statically typed ones (STL).
We know for a fact now that DTL's simply don't scale to large code bases. And before dozens of people tell me there are a lot of large apps written in DTL, this doesn't mean it was a good idea in the first place nor that these large apps are easy to maintain and improve (they're not and they would be much easier to maintain and improve with type annotations).
We don't know that. This is not a fact.
Or they eventually come up with a hybrid micro services.
I recently spent half a day implementing a hacky workaround for something using gc. Once I was happy that I got it working, I immediately laughed at how absurd it was and deleted it.
I still don't think I will ever be happier in C++ but I'm only 11 years into python, and 6 years into coding full time, so who knows :-).
Abuse of untyped ViewBags to pass data to views, using ViewBags to pass things to Helpers, badly configured AOP or XML-based dependency injection, people using Dictionaries/dynamic/JSON instead of objects for passing data between application layers...
As soon as you have escape hatches you get those things that make refactoring a nightmare in large projects and cause new employees to always fail to grasp the full-picture because of how fragile projects were.
In the frontend I feel the same about Vuex. It's a great library, way more ergonomic than Redux and the defaults are great, but the fact that actions and getters are untyped by default in Typescript is a major source of bugs in projects I work on, even in codebases with 100% coverage.
"Since y'all can't seem to use classes and interfaces correctly, let's physically separate the software so changing the service contracts becomes a bigger pain in the ass"?
I'm not even trying to be sarcastic. I'm genuinely curious. I feel like 90% of the benefits of microservices would be accomplished with discipline and good code review, but those things of course are more easily said than done.
(I understand your Facebooks and Netflixes benefit from having completely separate teams responsible for services with more autonomy, but I'm talking about small to midsize orgs that seem to have adopted microservices.)
1. More decoupling means you can use an entirely different langauge
2. Services can be deployed, restarted, etc. independently.
But that comes with disadvantages. The contract then becomes message passing and serialization/deserialization, which is fairly primitive. You can't pass functions/callbacks, and simple static checks become a whole validation problem. It also limits your ability to use interesting types across services.
The XML craze 20 years ago tried to tackle all of these problems (remember XML schemas?), but it became unweildly and didn't really succeed despite a huge enterprise push.
In certain languages, developers may find it difficult to maintain code quality and good design in a codebase of a certain size. So they find other ways of achieving good design by introducing service boundaries.
In fact I never thought I'd say this - for the first two years of discovering sum types, I thought they were the silver bullet of computing, and certain experiences have sadly tempered me there :)
I still agree that types _can_ make the flow and transformation of data in the system clearer than if there were no types. Though without experience, we could very well end up with convoluted designs and that can be as difficult to untangle as a dynamic spaghetti.
Elixir is all about immutable structs and pattern matching. I don't think "hyper dynamic" is a fair characterization at all.
The upside with the python code is that a complete rewrite of parts that has get extended beyond recognition tend to be easier than expected.
That sounds like a disadvantage tbh
I agree on this part. The problem is many teams with 5 Ruby programmers is doing what 100 Java programmers' work. There would usually be many teams in Java projects, and nobody have full picture of the project. Then people would create jobs out of nowhere because they have to do something... Just see how many projects have dedicated teams writing piles of code for Kubernetes.
I would rather hire much fewer elites for higher price instead.
Engineers are perpetually keeping mental tallies and notes in search of data on which tools, methods, and technologies will help them reach the promised land. I think really the majority of that is noise.
I'm using it sometimes, what's the issue?
Yes, I see it all the time. People think that `gc.collect` collects all the garbage, but that's not true. It only checks for reference cycles.
So a hierarchy of choice for me would be like:
S The languages mentioned above
A Languages with Hindley–Milner type system and inference (SML, OCaml)
B Your typical blue collar languages (C, Pascal, Go, Java, C#)
C Scripting dynamic languages (JS, Perl, PHP, Lua)
That said: I wish you the best of luck!
It does suffer from an excessive overloading of operators (“a” times 6 shouldn’t work). But that’s neither here nor there.
If Python wasn’t strongly typed, it wouldn’t be conceptually possible to move it towards explicit typing as the current push is.
Now, it’s not statically typed. You don’t get to assign values and interpretations to memory addresses. This is what “performant” people usually defend. But _that_ has nothing to do with typing assuming semantic roles in codebases.
Here are some references (there might be some overlap):
- https://labs.ig.com/static-typing-promise
- https://danluu.com/empirical-pl/
- https://medium.com/javascript-scene/the-shocking-secret-abou...
- https://www.researchgate.net/publication/259634489_An_empiri... (one of the original studies)
I hope it's clear I'm not implying that there are no advantages in using a statically typed language, only that it's often seen as a solution to a problem that doesn't originate there.
PS: what is up with the downvotes? What is this, Reddit?
Source?
Personally I believe this is exactly why Python is dominant in ML now. We are harvesting after 20 years of academics happily writing libraries and tools for academic work in Python. :-)
So I have no idea how the article got their numbers, but I'm not at all surprised to see the sheer number of people programming in Python exploding.
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.
- tests (unit, smoke, acceptance) (eg. https://mattsegal.dev/alternate-test-styles.html, https://understandlegacycode.com/approval-tests/)
- continuous integration (via GitHub actions eg: https://mattsegal.dev/pytest-on-github-actions.html)
- 10x performance improvements via cProfile (https://julien.danjou.info/guide-to-python-profiling-cprofil...)
- getting fast feedback on code changes by visualizing outputs with Streamlit (https://www.streamlit.io/)
- input parameter validation (eg. https://pydantic-docs.helpmanual.io/, https://mattsegal.dev/cerberus-config-validation.html)
- total automation of data processing job (eg. https://www.prefect.io/ - we don't use this but that's the kind of thing we have)
>I've asked them to help me bring myself up to date on good techniques
Here's an old draft of our onboarding document[1], and a few comments here on HN about this[2].
PS: in case anyone is wondering how I found the segment in question, I use a Chrome extension called "YouTube Captions Search"[3] went to the video, activated closed captions, clicked on the extension's icon, and searched for "geographic" because I remembered that the system the student had built was a geographic information system (GIS).
- [0]: https://youtu.be/iOp0mSDCh6c?t=1084
- [1]: https://jhadjar.gitlab.io/kbase/hiring/#resources-to-learn-o...
- [2]: https://news.ycombinator.com/item?id=15576496
- [3]: https://chrome.google.com/webstore/detail/youtube-captions-s...
Since there are many questions about the way the TIOBE index
is assembled, a special page is devoted to its
definition. Basically the calculation comes down to counting
hits for the search query
+"<language> programming"
In the next few sections it is explained what search engines
qualify, what programming languages qualify and how the
ratings are exactly calculated.
Search Engines
There are 25 search engines that are used to calculate the
TIOBE index. The selected search engines are the 25 highest
ranked websites of Alexa that meet the following conditions:
The entry page of the site contains a search facility
The result of querying the site contains an indication of the number of page hits
The results should be available in HTML with clear tags
Search engines in languages with special characters should be encoded properly
The search engine should at least return 1 hit for 1 query
The results of querying the site shouldn't contain too many outliers
Porn sites are excluded
[1] https://www.tiobe.com/tiobe-index/programming-languages-defi...Gave me a laugh. Engineers would initially qualify a porn search engine to search for this sort of experiment
Most of us really underestimate what "non" programmers can achieve with if/else, loops, equality tests, a repl and autocompletion.
It's like being an anaerobic bacteria complaining about the abundance of oxygen in during the Cambrian explosion.
"Back in my day no stinking, puny, oxygen breathing things were around, only sturdy creatures such as myself" :-)
Yeah, it was messy, but that's how we were able to have humans, hundreds of millions of years later.
Julia is on the radar but even in Julians’ wildest dreams Python remains relevant through PyCall. Why rewrite it if you can reuse it? (Obv I refer to boring-to-write non-performance-sensitive code here)
You had Matlab, R, Octave, Java, C++, Lisp, etc. all depending on what type of scientist or engineers you worked with (Statisticians used R/SPSS/etc., Physicists and Electrical Engineers used Matlab or C++, Computer Scientists used Lisp etc., and the list goes on)
At least today, most is written in Python - only the libraries are different.
Also, sharing code is a breeze today. Back then you'd have to download or manually transfer the codebase from other users, check dependencies, install software, check licensing, and what not.
Today you can fire up a Python notebook, and that's it - very nice for smaller stuff. Even larger applications is a easy as pie.
Trained as an EE and this is true. We used MATLAB/Simulink for signal processing and control systems. Octave, too (because our sensor technology teacher was more comfortable with that). x86 and Microship Assembly, C, and Pascal. Used LTSpice and NI Multisim for circuit design and simulation. Cadsoft EAGLE for printed circuit board (PCB) work. Played a bit with LabVIEW.
However, I started coding as a child with BASIC/x86 Assembly/C/Pascal/VB/Delphi. Doing mostly Python for the past several years. I suppose one could find reasons to "love" or "hate" anything, but I always found that nuance keeps sanity.
I've found the reliability and tooling really unsatisfactory, at least compared to Haskell.
The libraries are there, though, and familiarity is in the departments (psychology (maybe more R?), physics, &c.)
Some people just stick to the basic stuff but there's plenty of other, more complicated programs that are developed by academics/students. Guess what they're going to use? The language they first used to make that pretty graph.
Python is certainly #1 in ML, for example, but far from #1 in web.
I had a "which stack" argument with a client recently for a web server processing tons of data. He wanted to use Node (which I hate, but also use when performance doesn't matter because TypeScript is so good).
I showed him that the Node library ecosystem is actually pretty weak (many libraries, but most abandoned, single-contributor, and/or low-quality). Of course, browser libs for JS are amazing.
My point is just that mixing all these things together in popularity rankings is pretty meaningless.
[Access to this page may require you to create an account.]
For years, IEEE has ranked the top 55 languages based on five use cases typical of IEEE members: overall, web, enterprise, mobile, and embedded, and ranked three ways: trending overall, in demand for jobs, and used by open source.
The 2020 results, ranked overall:
1 Python 100.0
2 Java 95.3
3 C 94.6
4 C++ 87.0
5 JavaScript 79.5
6 R 78.6
7 Arduino 73.2
8 Go 73.1
9 Swift 70.5
10 Matlab 68.4
11 Ruby 66.8
12 Dart 65.6
13 SQL 64.6
14 PHP 63.8
15 Assembly 63.7
16 Scala 63.5
17 HTML 61.4
18 Kotlin 57.8
19 Julia 56.0
20 Rust 55.6
21 Shell 52.0
22 Processing 49.2
23 C# 48.1
24 SAS 45.2
25 Fortran 43.0
26 Cuda 41.0
27 Visual Basic 40.3
28 Objective-C 38.9
29 Delphi 38.6
30 Perl 38.2
31 Verilog 37.6
32 VHDL 36.7
33 LabView 36.7
34 Elixir 35.8
35 F# 34.7
36 Prolog 34.6
37 Lua 34.4
38 Lisp 33.0
39 Ada 32.8
40 Apache Groovy 32.0
41 Scheme 31.4
42 Haskell 30.8
43 Cobol 30.4
44 Clojure 29.8
45 ABAP 29.5
46 D 27.7
47 Forth 23.7
48 Ocaml 23.7
49 TCL 22.1
50 LadderLogic 19.5
51 Erlang 18.3
52 Eiffel 16.5
53 CoffeeScript 15.9
54 J 14.3
55 Racket 0.0
* Pre-confugured prod/dev/test environments
* Preconfigured webpack for the environments above
* DB migrations
* telemetry/metrics with live dashboard
etc
P.S. encrypted signed cookies, changesets (validations for db models or arbitrary forms), clustering, websocket stuff, "liveview" serverside rendering ...
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.
I haven't tried Spring Boot, so I can't speak to that, but gather that a lot of people like it. Otherwise, though, it's kind of a mess of too @#$% many options and no clear winner aside from the legacy stuff that nobody actually enjoys working with on the flagship language, an alternative language that was initially promising for web development but ultimately collapsed under the weight of its own creeping featuritis, an alternative language that collapsed under the weight of efforts to turn it into Jonathan Livingston Programming Language, an alternative language that collapsed under the weight of a cult of personality, and an alternative language that looks poised to collapse under the weight of Oracle v. Google.
The performance lacks somewhat and the debugging tools are not as mature as JVM's. But the libraries, frameworks, and overall development productivity are great.
Not only better library ecosystem, more performance and tooling.
To say nothing of trying to get patches into the core. Be prepared to wait months for any response at all, every time getting the feedback that there is some new minor problem (or even worse, a "this needs to be talked about" without any followup).
It's not a healthy ecosystem. For that you require high-quality core libs, a strong developer ecosystem (that doesn't mean a lot of devs, it means good ones) and a culture of third-party libraries being few but high-quality. Anything else is going to end up pissing you off, guaranteed.
The original project I was discussing ended up going with Kotlin on the server, and everyone (including devs) are super happy with it.
I program in Node/JS currently and programmed in Java about 10 years ago. But my preferred language will always be Ruby. I will never understand why "the community" (ML, scripting etc) preferred Python to Ruby.
Do keep in mind that one of the reasons people choose Python though, is exactly because it is used in a few different domains. E.g. I'd rather my server-side language be the same as my video-processing language be the same as my data-science language, it makes things easier.
Here are some stats that you could and should take with a grain of salt: https://w3techs.com/technologies/overview/programming_langua...
My anecdata also says neither Django nor Flask are very populate. I have yet to encounter either one already in use by a client. Rails is also rare. I think scrappy startup frameworks are a different population than what most devs (who work at big firms) use.
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 data that tripped over something provoking the ranking.
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.
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 invisible to people whose role in the industry is "full stack development" type jobs.
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.
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.
[1] https://insights.stackoverflow.com/survey/2020#most-popular-...
Besides that it's also influenced by how good the language is at explaining to the user what is going wrong. Clear error messages mean the user uses StackOverflow less, while arcane errors would mean they need to look for longer for the solution for their issue.
StackOverflow is also a place for asking questions. C is a relatively simple language and one which has been around for longer than most developers have been alive. There may just not be much left to ask about it.
This only represents the sad state of Javascript documentation, I think.
SQL is justified though. I’ve met quite a few BAs or DBAs who can do magic in a sql developer suite but don’t have a programming bone in their body.
So I guess it just doesn't count JS developers as skilled engineers?
(The parent link has a quote from TIOBE CEO that illustrates they are not considering only professional software engineer use)
It also didn't have the simplicity that Phoenix / Elixir still has, for example when you Google how to solve problems you have Python 2 versus 3, the old way to handle requests which is limited and the new way to handle requests which isn't as documented, yes you have type hints and named arguments but they're not everywhere yet and so on.
So I don't think I will circle back to use Python again unless there's some kind of reason I can't easily go around it. There are still some very good ideas in there (I like the braceless approach to code hierarchy and a standard on code formatting in general) and it's definitely not as dumb as JavaScript but it has accumulated too much cruft.
Python definitely doesn't have conceptual simplicity, because there are many competing concepts in the language, and lack of focus on uniformity. (Example - enums are implemented with a metaclass and dataclasses with a class decorator - arguably the latter is the wrong choice, because it is already evident it limits what kind of features can be added to dataclasses).
Another example just because it makes me irate - `typing.NamedTuple` has been added as an "alternative" to `collections.namedtuple`. Same name, new capitalization, slightly different features. Add to that, a collection type that's inside the module `typing` which is supposed to be for.. type annotations, not actual implementations.
> (Example - enums are implemented with a metaclass and dataclasses with a class decorator - arguably the latter is the wrong choice, because it is already evident it limits what kind of features can be added to dataclasses).
I'm curious about what features can't be added to dataclasses because it's not using a metaclass.
If anything, I think that not using a metaclasses is a good thing: it allows you to use @dataclass with classes that do require a metaclass. That metaclass would likely be incompatible with the metaclass that such a hypothetical @dataclass implementation would use.
What's it called? Google didn't turn up anything.
Requests is one of the modules that had more change on 2-3, but being basically the most popular language (for good reason), it’s pretty easy to find documentation for either version. I imagine a lot more than for Phoenix/elixir whatever that is.
I think you’re being difficult for the sake of being difficult. I am not a leet programmer and that is why I use python- it does everything for you very well and no more. If you want more “cruft” pip install cruft
Why? I was just trying to get something done that I've done in a variety of different languages already so there's a perfect comparison.
> I imagine a lot more than for Phoenix/elixir whatever that is.
I don't know how you manage to come to Hacker News often enough to find exactly my post to answer to but at the same time managed to have never heard about Phoenix/Elixir. What's the point of coming here if you're not interested in staying current in your field?
My Python setup is as follows:
* vscode
* pylance
* black formatter
* flake8
* python typing annotations used as much as possible
This seems to work very well with regards to autocomplete and preventing run-time errors.
One thing I do miss is proper refactoring support.
You should try PyCharm then. That, and their debugger is orders of magnitudes better than VSCode.
The first reads like english, the second doesn't.
Could you elaborate on this?
Though Python can look a bit more clunky than modern JS.
Python is really a Perl replacement. It was meant for the scripting world, not software development - pretty much stuff that was too complex or cumbersome to do in bash.
It mainly seems to massively overvalue historical significance, the older the language the higher it is. E.g. the current ranking has Perl 5x more popular than Typescript, and Visual Basic 2x as popular than PHP.
It's definitely the case that Python is very popular though. It's everywhere. As others have pointed out, it's become very prevalent in scientific/academic circles. Outside of that, it's very useful for scripting. They teach it in universities as an introductory language. It's in use at every workplace I've been.
Since I started to follow it systematically (mid-2019), the trends I perceive are: Java or Scala -> Kotlin, JS -> Typescript, Angular -> Vue. Growth of (non-web) Python, React, Go and even PHP. Besides Kotlin, mobile tech demand seems stalled (Swift, React native, etc). Frontend demand is shrinking.
I also wonder, thinking back over my experiences and reading others here, if we are mis-ordering how these things come to be. Maybe it's not that python codebases are, for a given line count, worse than other languages. Maybe it's that python allows teams to continue using practices that aren't suited to their current scale longer than other languages. The reason that we all have seen hulking, monstrous, nearly unworkable python code bases is that most other languages would have already collapsed under the mismatch between approach and desired outcome.
I think we often approach software engineering as a puzzle - where you have a set of inputs (a too-large codebase, for instance) and a question of how to a better state. But programming projects are path-dependent creatures. Huge codebases must develop over time - they don't spring out of the heads of developers fully formed. If you were a typed language and your engineers had a lower LOC output per-day, then of course your code base will be smaller. Is that better? You iterate more slowly, but the scale of your code is also more manageable. In my experience, the challenge of large python code bases comes from the context that you need to understand from the surrounding environment: what are all these objects, what are their objects, etc. Typed languages force you to carry around more context, so any given function is easier to read, but you can still write un-navigatable code.
I remember trying to write a program to simply understand our dependency graph so we could decouple some of our services (we were just starting our SOA efforts at that time). This is something other languages give you for free.
Our build times were exceptionally slow, as a direct result of Python's dynamic nature. For example, test discovery took over 2 minutes on each test run. This also made it painful to have distributed test runs, as splitting up tests across multiple processes would require the test discovery step to be run in each process, incurring a 2 minute penalty per process.
We also had deployment issues, because of Python's dynamic nature. Some code paths were only exercised during a production deployment, and were not sufficiently tested before deployment. This is despite the fact that we had tens of thousands of tests and sunk many hundreds of person-hours into testing as much as was possible. Despite a very professional engineering culture, and a constantly expanding test suite covering these corner cases, we had deployments fail about once a week for this reason.
I adore Python and still use it extensively most days (mostly its data science/ML libraries). But I now think that large projects would really benefit from static typing and strict compiler checks, as well as just being able to actually compile a binary (which would have solved many of our testing woes). In contrast to some other smart people on this thread, I don't think that even disciplined developer teams should use Python for large projects, at least not in the long-run.
But the language problem remains. I think there are a lot more good language options today for backend services than there were in 2010, and if I were writing new backend code for a big website/service today, I might pick one of those.
Along the same lines, IoT depends heavily on C and even stepping out of that, pretty much every piece of silicon requires extensive C code to be written around it.
I still wonder about JS though. Billions of websites with JS and the JS gets rewritten every few years (or less during the framework wars period).
So, at least some of the gains are at the expense of Java.
For C and C++, you're probably not going to reach for Python as a replacement. It's not like in the 90s when these were considered general purpose. If you're using them these days, it's more likely due to needing to use them.
Java is still used for a lot of other things where a language like Python would be fine and likely more productive. Also, I have a feeling that the large growth in go from #20 to #13 likely also came at the expense of Java.
That, and the pie is growing. Python is taking a larger share of the larger pie.
The only one that is growing, although I rather not, is Go, as we now start to jump into the same container bandwagon as everyone else. And even there it isn't taking anything away from our Java/.NET setups, rather complements them.
As for Go, when they adopt generics, until then I rather spend my productivity in Java and .NET land, and only deal with it in the context of containers eco-system.
Um... nobody _loves_ Java. We use it, but we don't love it.
You can still run into something old and enterprisey, but Java is much less baroque than it used to be for getting things done.
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 them it would be a waste of time to learn C++. I would like to know why an experienced developer might prefer python ...
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<Number> = head(numberList)
Note that the return type of the head will be Option<A>, 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.
I'm aware of the fact that every type system will reject some valid programs. C evades this problem by letting you "escape" the type system. Many people criticize this without being aware that the language would be useless without this feature.
I don't think that an expressive type system rejects more programs though. You don't have to escape the type system that often in C++ (compared to C).
Nonetheless I probably should look up some design patterns you can do in lisp, to get a feel for what I'm missing
The easiest example is web applications, especially internal ones, which are essentially shuffling JSON messages around from different SaaS and internal APIs. Adding (and testing!) a different ApiResultSerializer in between each of these points can become a huge headache when everything boils down to JSON string or number in your result anyway.
Though I do use C / C++ (recently some Rust) where business problems are not the priority, and I can focus on technical efficiency / correctness.
By adding stricter typing and a bunch of middleware I can easily imagine a Python EE one day but let's hope that doesn't happen. Duck typing, a taste of functional paradigm, non-verbosity is what makes Python special IMO.
I wonder if Go, Rust might make it to top C one day.
This and the fact that C is number one suggest something very wrong. While C really has a place in my heart, you should have very good reasons to use it when "starting to build a new software system".
And three of those very good reasons are:
1) you're writing a library and you'd like to make it usable from a number of other languages as well, the most popular of which are at least partially implemented in C or C++ themselves to some degree, eg. Java, Python, Perl, Ruby, Haskell etc. Writing said library in C (in particular) makes the library much more accessible from those languages.
2) the platform you're writing for is partially if not largely written in C or C++, the most popular of which are Windows, MacOS, Linux etc. So the toolchain/runtimes used to build the systems are already supported, extremely mature and well tested.
3) the platform you're writing for is especially space constrained (eg. embedded Linux), also fits the criteria for (2) above, and where performance may also be a factor due to reduced CPU/bus speed, availability of RAM and storage. For every interpreter or JIT compiler you want to add to those kind of systems for a higher level language, you can normally fit a larger number of C or C++ programs to implement your device's required functionality.
There is far more years of effort required yet to overcome the inertia of the above than the average HN webdev would realise.
IME Java still has a very real stranglehold on business logic code, especially in bigger companies.
Golang and Rust are eating away at it, but more for infrastructure related projects rather than higher-level business logic.
This is an important distinction and often missed from programming language discussions.
Engineering languages like C++, Java, Rust focus on being able to create robust APIs, handle incredible complexity, deal with dependencies, etc. Hacker languages like Python, PHP, erlang, and Go focus on an approachable language, libraries that tackle problem domains, etc.
There is obviously a lot of overlap. But I think it's good to keep in mind that engineering and hacking don't always align.
Something else to consider is the Python shell at python.org/shell. Students often have Chromebooks. I'm about to mentor second year high school students who are interested in CS. Several of them have Chromebooks only. I can recommend Python and point them to the shell.
I would think Python got a good bump through Hour of Code and other programs to introduce people to coding.
Still, with C bring #1, one has top wonder about the quality of the index. Both Python and Java are much more common in the business.
Although such rankings are mostly good for entertainment, I'd whish there were a better, more solid index. Redmonk is better, but a bit too limited in its data source (Stackoverlfow and GitHub).
These ratings seem pretty meaningless. Visual Basic is #6, tell you pretty much all you need to know.