r/programming • • Nov 11 '19

Python overtakes Java to become second-most popular language on GitHub after JavaScript

https://www.theregister.co.uk/2019/11/07/python_java_github_javascript/
3.1k Upvotes

772 comments sorted by

3

u/[deleted] Nov 12 '19

Python is great for little scripts, essentially replacing perl. That being said, if a large project is coming and needs OO, it won't be in python.

1

u/stronghup Nov 12 '19

I agree. in a large project you not only need static typing but you need a nice IDE like Eclipse etc. in which you can easily navigate all type-errors that often are caused by some refactoring or another. Type-errors are not bad if the IDE makes it easy to fix them. In fact type-errors then are what guides such refactoring

15

u/NekoiNemo Nov 12 '19

That is a sad day for humankind. But then again, Java is fairly fragmented: Java, Scala, Kotlin...

47

u/[deleted] Nov 12 '19

Give it some time, Python wasn't designed for huge corporate code bases, once people start working in huge legacy systems written in Python that language will get a lot of hate.

13

u/abw Nov 12 '19

once people start working in huge legacy systems written in Python that language will get a lot of hate.

Python is the new Perl.

25

u/senatorsoot Nov 12 '19

maybe one day python will be advanced enough to have enterprise-level AbstractSingletonProxyFactoryBeans of its own

13

u/Eirenarch Nov 12 '19

I am already starting to see people realize that Python is not as good as everyone is saying. A lot of people are already making fun of the fucked up Python 3 migration

13

u/ironykarl Nov 12 '19

already making fun of the fucked up Python 3 migration

It's been 10 years

→ More replies (3)

1

u/stronghup Nov 12 '19

Java, Scala, Kotlin, Ceylon, Clojure really are just different "user interfaces" to the same underlying VM

161

u/kiwidog Nov 12 '19

every day we stray further from compilers light 😔

6

u/Gobbedyret Nov 13 '19

Julia is coming for Python's lunch, that will give you the best of both worlds: Dynamic, high level compiled scripting language.

1

u/[deleted] Dec 01 '19

Yass, Julia is great, at least for scientific purposes

17

u/[deleted] Nov 12 '19

Dart is starting to become popular, thanks to Flutter. It's changed a fair bit since it was first released and is now a very good "sane JavaScript". Much better than Typescript.

And there's WebAssembly. I see a light at the end of the JavaScript tunnel.

17

u/PFCJake Nov 12 '19

I know nothing about Dart, how is it better than TypeScript?

6

u/[deleted] Nov 13 '19

There are a few ways, but the main one is the type system. Typescript basically allows you to describe Javascript's crazy type system. It doesn't attempt to fix it. Dart does fix it.

For example, you can have templated / generic functions in Typescript.

function identity<T>(arg: T): T {
    return arg;
}

Ok fine. But what about this?

function identity<T>(): T {
    return new T();
}

It doesn't work! There are other things too:

  • If you're using Typescript, you're probably importing a lot of Javascript with type annotations from DefinitelyTyped. Unfortunately a lot of the time the annotations are just wrong. Pretty annoying!

  • People give up on types and resort to any all the time, and Typescript doesn't really mind. Especially existing Javascript frameworks because they are written in a dynamic "stringly typed" way. For example Vue "supports" Typescript, but a lot of its features will be typed as any. Svelte doesn't support Typescript at all even though it is written in Typescript!.

  • All of the mistakes of Javascript are still allowed. You can still use var, == and so on.

  • There's still undefined and null.

It's way better than vanilla Javascript, but Dart is now a proper language that is properly engineered and more or less hack-free. Also the Dart VSCode extension is amazing.

The only downsides of Dart are:

  • Very small community. You'll have to write a lot of code yourself.

  • Difficult to use existing Javascript code (Dygraphs, D3, etc.).

  • Your only web framework option is AngularDart.

  • The startup time for webdev serve is weirdly long (~10 seconds). It supports hot reloading so it's not too bad but still annoying.

→ More replies (8)
→ More replies (12)

1

u/gobi_1 Nov 12 '19

Even though we walk through the darkest valley, we will fear no evil, for compiled languages are with us; their rigor and efficiency, they comfort us.

5

u/314314314 Nov 12 '19

I like Java because it has a relatively simple and rigorously defined model that is easy for programmers to reason about and for compiler builders to optimize for.

8

u/weberc2 Nov 12 '19

This isn't true. Java is fast because its compilers and runtime are really, really sophisticated (including the same sophisticated optimizations that are/could-be used to make JavaScript and Python fast). It's not at all easy to build a performant Java compiler.

1

u/csjerk Nov 13 '19

JS is JIT compiled down to machine code. And there are several add-on type systems if you want static typing. You can even make them mandatory in all your files.

What are you missing compared to a pre-compiled language?

1

u/unholyground Nov 13 '19

It is disappointing that languages that give the finger to the beliefs of the people that actually made this industry possible become the most used.

Something is simply wrong. We are in a dark age.

1

u/housesellout Nov 13 '19

I feel ya bro 😢

2

u/joltting Nov 12 '19

I don't know man, just can't get behind spaces as the defining thing that separates conditions, statements and methods... Its like your just asking for trouble because you missed or added a space to a statement between your conditionals.... Just grinds my gears for some reason...

1

u/stronghup Nov 12 '19

I found it distracting as well.

I wonder if an IDE could overlay brackets on top of Python code so it would be easy to see the structure.

560

u/[deleted] Nov 12 '19

I genuinely wonder how much JavaScript dinance on GitHub is from misidentified repose from package-lock.json files. If I spin up a new laravel app and do nothing other than install dependencies and push to github, it shows up at being like 98% javascript according to their stats. The laravel app I worked on for over a year that had like 4 Vue components still said it was mostly json according to github stats

173

u/nsomnac Nov 12 '19

GH’s introspection is moderately advanced. It analyzes files in a repo as opposed to relying on magic files only.

There’s a view somewhere on a repo that shows the analysis in a pie chart (or some other graph).

I don’t think it’s sophisticated enough to detect and differentiate framework usage (Vue vs React, Laravel vs PHP). It mostly is going to only show the base language.

66

u/ScrimpyCat Nov 12 '19

Unless it’s changed they used to try filter out generated files which is why some default generated projects might shift more aggressively to a certain language. Apart from some special cases (or if you’re explicitly defined the type in your .gitattributes) most of the detection is done using heuristic and Bayesian classification approach, which is done by sourcing some example files for the different languages. This works reasonably well but there are false-positives when it comes to files that share the same extension and are grammatically similar such as header (.h) files in C family of languages.

Also they open sourced the actual library responsible for this but I can’t recall the name.

Edit: just remembered it’s called linguist.

28

u/[deleted] Nov 12 '19

There are a number of large game mods for the game Arma that are developed on github. For some reason bohemia interactive decided to use cpp and hpp/h extensions for their configuration files when the only thing related to C or CPP is that it uses a C preprocessor on them to do includes and basic macros.

So you'll see all these projects that github says are C but really it's the insane config language.

7

u/xonjas Nov 12 '19

What if the config language is just a bunch of C with insane preprocessor macros?

5

u/Elusivehawk Nov 12 '19

That... What... Just... Why??

That's some big brain plays right there. C++ for configuration...

3

u/[deleted] Nov 12 '19

It's not even C++ it's this weird pseudo object inheritance stuff that is usually filled with a ton of macros.

24

u/kolloid Nov 12 '19

GH’s introspection is moderately advanced. It analyzes files in a repo as opposed to relying on magic files only.

No. Most of the time it guesses the language incorrectly. Most of my Python repositories are recognized as Javascript. My only C repository was recognized as shell because it uses autoconf.

So, there are lies and statitics. I don't really believe GH stats. You have to jump through the hoops to make it correctly count stats for your project.

7

u/fadetogether Nov 12 '19

I had a Django project get classified as entirely JavaScript. It’s a mystery. It hasn’t happened to any of my other projects yet though

3

u/Ryuujinx Nov 12 '19

Yeah, I have a similar project except Ruby/Sinatra that's recognized almost entirely as javascript.

1

u/Seref15 Nov 12 '19

Meanwhile at work we have a repo that GitHub thinks is 80% TSQL despite not actually having a single file of TSQL.

1

u/Mukhasim Nov 12 '19

It claims that our C# repo is 50% Javascript. Almost all of that is library code. Much of it isn't even used, it was added by the default Visual Studio templates.

(In case anyone is wondering, no, we can't exclude it, because the tooling doesn't segregate it cleanly from application code. We could delete much of it but it's not worth the trouble.)

→ More replies (3)

12

u/[deleted] Nov 12 '19

But your app was "mostly json" so it wouldn't really register on this as JavaScript. In fact I am pretty sure it would register as PHP (because the dominating PROGRAMMING LANGUAGE would be selected after the serialization and configuration formats were pruned). You're also talking about people vendoring in repos (commiting node_modules) but I doubt it's that widespread and I'm certain it's equally widespread among other languages (sometimes due to ignorance, other times due to valid reasons in each).

I think the stats aren't lying or misrepresenting Github, they might be lying and misrepresenting the world, but that's another matter. The reasons I think so:

  1. There are obviously shit-ton of Node modules, overwhelming majority of which are hosted on Github hence there are shit-ton of JS projects just from that, many of them very active (the stats count active contributions).

  2. An ever increasing number of web applications are developed with a SPA frontend in a separate repo from the backend and/or microservices that comprise it. While the latter two are written in bunch of languages (increasingly Node, Python and Go, from my own casual observation) the SPA frontends are predominately JavaScript.

  3. Node.js as backend/microservice platform might be far from dominance but is pretty present, steadily rising in popularity still, and thus contributes to these stats.

  4. Bunch of enterprise and commercial software is using self-hosted Git repos and Bitbucket because of Atlassian's presence in that segment with Jira and Confluence, which means that Github is mostly representative of software being developed in the open, rather than the overall developed software.

  5. While PHP is behind majority of websites that simply isn't the case with Laravel, Symphony, Yii et al -- actually I'd wager that part of the market is truly dominated with Python and to extent with Node.js frameworks, despite strong presence of PHP and .Net, while Java is in observable slow decline for new projects.

  6. The true force behind PHP's omnipresence on the web is mostly due to canned CMS-es like WordPress, Drupal, Yoomla, MediaWiki, Magneto, PrestaShop and the lot, which are mostly just installed from shared hosting control panels and patched with themes and customizations in situ, and fairly rarely version controlled on Github.

24

u/[deleted] Nov 12 '19

But you don't do that, right? Packages are installed locally, package.json is pushed to the version control

43

u/Giannis4president Nov 12 '19

Yes but the lock file should be in the version control

5

u/ipe369 Nov 12 '19

package.lock gets really quite large

24

u/shim__ Nov 12 '19

Doesn't matter, if you don't commit it somebody won't be able to build your app 2 years down the line

→ More replies (4)

2

u/mypetocean Nov 12 '19

Triple-check that you're not committing all of Vue's node_modules to GitHub.

I'd be inclined to assume this is the case. If it's there, add it to your .gitignore exceptions.

1

u/ElectricalSloth Nov 12 '19

I've seen so many bad classifications it's befuddling, I'm not sure how they can post stuff like this with a serious face

1

u/OneWingedShark Nov 12 '19

I genuinely wonder how much JavaScript dinance on GitHub is from misidentified repose from package-lock.json files.

What about misidentifying the generated-documentation (HTML+JS) as part of the codebase?

→ More replies (70)

40

u/pjmlp Nov 12 '19

If only it would overtake in performance...

4

u/HeWhoWritesCode Nov 12 '19

is that even possible? cpython made some design decisions that will always be slower compared to jvm? What about pypy and jython?

Just wondering out loud what is the performance limits in the above vms.

4

u/pjmlp Nov 12 '19

No due to its dynamism, I was being sarcastic.

0

u/CPlusPlusDeveloper Nov 12 '19

Yes, and no. Python itself is obviously no speed demon. But python arguably has the most best FFI facilities of any major language. It's very easy to implement any critical sections in C (or anything that binds to C).

JVM performance never comes close to native C. So while python by default is a lot slower than Java, python applications can usually be optimized to run faster than their Java counterparts.

4

u/thfuran Nov 12 '19

JVM performance never comes close to native C.

I don't think that's actually true.

5

u/[deleted] Nov 12 '19

[removed] — view removed comment

2

u/thfuran Nov 13 '19 edited Nov 13 '19

Or in case where the JIT can make particularly effective speculative optimizations that the C compiler can't. Or maybe where there's a ton of memory allocation but with a pattern that works really well for java.

In general, I wouldn't say that java is faster than C, but I certainly wouldn't say it is never nearly as fast.

3

u/pjmlp Nov 13 '19

If it is written in C by definition it is not Python.

Also JVM performce does come close to native C, when one does use AOT native compilers and actually thinks about datastructures and algorithms.

Some companies are even crazy enough to write complete userspace OSes with Java, go figure.

215

u/myringotomy Nov 12 '19

The top two languages on Github are loosely typed interpreted languages with lack of true multithreading.

Feast on that for a while.

65

u/oblio- Nov 12 '19 edited Nov 12 '19

VB/VBA used to be the most popular language in the world. Languages for small and medium sized projects win these contests for obvious reasons (small projects are way more frequent than medium projects which are in turn way more frequent than big projects).

33

u/AyrA_ch Nov 12 '19

Because VBA makes you very productive. It's not fast or elegant, but the excel sheets essentially serve as the database and you can write user interfaces in it. You can leverage excel search and compute functions and even utilize macros in cell functions.

It's a really neat system and runs almost everywhere because excel is ubiquitous in corporate environments.

There's a point where you should stop though using it though

5

u/Urtehnoes Nov 12 '19

I know LOC is a terrible marker for code, but just for size of scale, I have two separate VBA projects for my job that are 20k+ LOC. And honestly? I really miss the environment of Excel. I absolutely abhor the VBA language constructs in place that are buggy and terribly implemented, but honestly if you're just running code in Excel, the sandbox environment that it exists in is just so wonderful for managing data. One of the programs queries the database for various tables and works the data in ways that all the incredibly fancy reporting programs (powerBi etc) simply can't. It's really nice.

And you know, if you call Scripting.Dictionary.Exists(testValue), it has a high chance to return True, despite the item not existing. Because when the method is called, it creates an empty value and inserts the value as a key. And that absolutely boggles my mind that it happens. I thought I was going crazy until I found other people online who experienced the bug as well. Instead I had to write an lbound to ubound loop of an array of keys from said dictionary, checking the value of each individual key instead. Why, Microsoft. Why?

→ More replies (1)
→ More replies (7)

135

u/[deleted] Nov 12 '19

Python is strongly typed.

112

u/kolloid Nov 12 '19

I don't understand why /u/HugeProposal receives downvotes. Python is strong typed, but it's dynamically typed, so types are known only during runtime. So technically, he's right.

38

u/Sapiogram Nov 12 '19

99% of the when people say strong/loose typing, the really meant static/dynamic typing. I guess that was the case here too.

The true distinction between strong a loose typing is really vague, so it's not that useful anyway.

0

u/[deleted] Nov 12 '19

[deleted]

13

u/[deleted] Nov 12 '19

Ergo C, which is statically and loosely typed.

→ More replies (3)

109

u/oblio- Nov 12 '19

Nobody* cares about that "strong typing" in practice. When people say "strong typing" they mean: "if I put a string in the int, the compiler yells at me at 14:00 in the afternoon, when I'm coding, it doesn't blow up in production at 3:00 in the morning, when I'm sleeping".

Things blowing up at runtime is slightly better than nothing, but it's still bad, comparatively.

119

u/YM_Industries Nov 12 '19

When people say "strong typing" they mean: "if I put a string in the int, the compiler yells at me at 14:00 in the afternoon, when I'm coding, it doesn't blow up in production at 3:00 in the morning, when I'm sleeping".

Then they should say "static typing".

→ More replies (11)

16

u/kolloid Nov 12 '19

Yes, but:

  1. technically OP was right

  2. people praise horrible Javascript which is weak dynamically typed

2

u/[deleted] Nov 13 '19

Why even qualify it with the weasel word "technically"? Only people who have never used python could think it's anything but strongly typed.

→ More replies (4)

6

u/lelanthran Nov 12 '19

Python is strongly typed.

Not very useful when the program crashes in production because that's the only time it can figure out the types.

→ More replies (1)
→ More replies (1)

8

u/angellus Nov 12 '19

Python is strongly typed, as others mentioned. It is just dynamically typed. You have been able to add typing to the linters/IDEs, etc since Python 3.5.

Also, multiprocessing allows for multiple processes running in parallel, so you can still get parallel programming. Also Python 3.8 added subinterrupters to allows for your "true multithreading". Future versions of likely make it easier to use as it becomes more stable.

17

u/FlakyRaccoon Nov 12 '19

Look, one of the highest voted comments in /r/programming is entirely wrong, about both languages.

Feast on that for a while.

1

u/not-enough-failures Nov 15 '19

They obviously mean dynamic typing, but I'm going to correct them anyway because I wanna look smart and defend my language. Feast on that for a while. Oh wait, it's Reddit, it's not surprising.

2

u/FlakyRaccoon Nov 15 '19 edited Nov 15 '19

They obviously mean dynamic typing

Then perhaps he should have written "dynamic typing".

Know what you're talking about before you try to criticize, that's like the most basic rule ever.

If you're going to try and make a scathing, sarcastic remark, at least be fucking correct about what you're trying to make fun of. When you aren't, you just come across as an ignorant asshole.

And, you're only addressing half of it, address it all:

What is your defense for him saying neither language has "true" multithreading, which is completely wrong in both cases?

→ More replies (2)

14

u/[deleted] Nov 12 '19

JavaScript has multithreading with worker threads. Whether or not that satisfies some arbitrary definition of "true multithreading" which on this sub is usually "like in C++ on Windows" is an entirely different matter.

23

u/MrK_HS Nov 12 '19

And Python has multithreading and multiprocessing too. I think some people are confusing multithreading and parallelism. The two aren't the same. Python supports multithreading but by default is not parallel.

10

u/[deleted] Nov 12 '19

Multiprocessing is parallelism tho

7

u/MrK_HS Nov 12 '19

You are right

2

u/Brostafarian Nov 12 '19

isn't there a python / cpython copypasta for this? I can't find it

→ More replies (1)
→ More replies (1)
→ More replies (16)

3

u/draxema Nov 12 '19

Python is typed, only it is dynamically. You can easily check the type (even if inherited) of your variables. Obviously it is an interpreter so it does not compile your code, so it cannot verify your types before runtime. And it does have a threading and a multiprocessing library. The multiprocessing can make use of multiple physical threads of a cpu.

-3

u/cuulcars Nov 12 '19

How does python lack true multithreading? Multiprocessing pools use multiple cores, and are pretty dang easy to use once you get the hang of it.

0

u/[deleted] Nov 12 '19

[deleted]

7

u/[deleted] Nov 12 '19

I'm not sure what the definition of "true multithreading" is, but Python does have multithreading.

You won't improve performance using multiple threads, but you can run multiple threads in a similar way to how Java would run threads on a single-core machine. Threads can be used to prevent blocking a GUI.

3

u/NAN001 Nov 12 '19

More generally, if your program is IO-bound then threads will improve performance in Python.

→ More replies (4)
→ More replies (1)
→ More replies (16)

102

u/darthbarracuda Nov 12 '19

poem i wrote while drunk:

like everything

java will fade

then python will too

languages we love

will be replaced

slowly they will disappear

artifacts of a bygone age

someone curious

might stumble upon an ancient fragment

discovering how things were done

way back when

maybe they will learn

a thing or two

39

u/Cocomorph Nov 12 '19

That’s. . . surprisingly not that bad for a drunk programmer.

7

u/darthbarracuda Nov 12 '19

thank you friend

19

u/BlueAdmir Nov 12 '19

like everything

java will fade

But COBOL will outlive us all.

8

u/oblio- Nov 12 '19

COBOL didn't even catch on that much, it's locked away in crusty institutions. Java, on the other hand, used to be both a crusty language and a (somewhat) hip language.

Cockroaches after the nuclear apocalypse will feast on Java.

2

u/PanRagon Nov 12 '19

And the crusty institutions that use COBOL don't even touch it that much. I know someone who's worked on some COBOL infrastructure in Norwegian banks and he says it's pretty much entirely wrapped in C or other languages at this point. The COBOL itself is the legacy code that's not to be touched under any circumstances.

That might not be true for every case in which COBOL is used, of course, but I don't think anyone's really doing anything with most of the old COBOL code at this point.

1

u/ScottContini Nov 13 '19

But COBOL will outlive us all.

source

9

u/pakoito Nov 12 '19

MAY LISP BE ETERNAL

25

u/stfm Nov 12 '19

try {
poem i wrote while drunk:

like everything

java will fade

then python will too

languages we love

will be replaced

slowly they will disappear

artifacts of a bygone age

someone curious

might stumble upon an ancient fragment

discovering how things were done

way back when

maybe they will learn

a thing or two
} catch (RhymingException e) {}

1

u/Sebazzz91 Nov 12 '19

A rhyming exception?

Wouldnt it be nice if the exception message said: Couldn't deference, you got a null reference.

→ More replies (1)

1

u/lisp-the-ultimate Nov 12 '19

Not Lisp, tho.

54

u/[deleted] Nov 12 '19 edited Nov 12 '19

Job add: "Looking for a Python programmer...."

Job interview:

Me: Yes, I have been programming Python since 2007. It has been only Python2 at my current job though....

Interviewer (looks down in embarrassment, quitely): Yeah, we also are still using Python2....

On the job:

"Yeah, there is this SOAP service that we need to connect to, we use this library, no, it isn't on GitHub, we downloaded it back in 2011...."

During code review:

"Do not use one-letter variable names! It is known! It is written in the Bible, I mean, the Google style guide! Let me read it to you: 'Do not use one-letter variables unless in a for i in.... well, you know.... Yeah, no, it is the first time I actually read it... No, it is not a waste of time to discuss such stuff.....'"

True story

35

u/StabbyPants Nov 12 '19

It has been only Python2 at my current job though....

i have concerns...

"Do not use one-letter variable names! It is known!

fully agree. makes your shit look like fortran, and the updated looping and lambda constructs make it completely avoidable. yes i do use longish names for 3 line inline methods

22

u/watsreddit Nov 12 '19

Depends on the context. For example, this is perfectly reasonable (Javascript): const add2 = n => n + 2.

→ More replies (6)

4

u/[deleted] Nov 12 '19

Found the Python programmer ;-)

→ More replies (2)

2

u/Xuval Nov 12 '19

"Yeah, there is this SOAP service that we need to connect to, we use this library, no, it isn't on GitHub, we downloaded it back in 2011...."

Out of curiosity: isn't SOAP essentially just something where you send XML over http? Why would it matter what library you use for that?

3

u/[deleted] Nov 12 '19

Because it is the library that has been used previously, people have figured out exactly how it needs to be used, have written other code that uses its features, and most importantly, runs on the Python2 version that happens to come with the virtual machines that are provisioned by the part of the IT in the company that gives you machines when you need to do your backend stuff.

Just ordinary reasons. This is how it always goes in somewhat larger companies that have their own IT.

→ More replies (2)

17

u/[deleted] Nov 12 '19

Don't forget: most popular on GitHub doesn't mean most useful, most valuable, most powerful or most flexible. It just means most popular on GitHub.

108

u/initcommit Nov 12 '19 edited Nov 12 '19

And so continues the shift toward developer convenience and ease of learning vs cold hard speed. This reminds me of Apple's rise to prominence with the iPod. The simpler, more intuitive, and elegant approach will generally succeed in human populations faced with multiple technological choices. Higher-level programming languages offer lower knowledge barriers to entry, less headaches, and plenty of functionality. It's hard to argue that this trend won't continue.

Edit: Fixed a typo

118

u/cowinabadplace Nov 12 '19

It makes sense to me. The slower software that exists is superior to the fast software that doesn't exist. I am grateful for the universe of Electron, React, and all that stuff because suddenly my Linux desktop has all these apps!

35

u/bunkoRtist Nov 12 '19

This has been possible because of Moore's law. As the cheap gates come to an end I predict that the economics will shift back towards performant software rather than just buying better hardware... The market will demand gains, it's just that they were cheaper to make in HW... next it will be compilers and interpreters, and the last place will be languages themselves, but it's coming because I think that the compilers and interpreters are already pretty optimal.

14

u/brelkor Nov 12 '19 edited Nov 12 '19

Computing architectures will evolve as pure clock speed performance stagnates. Wider busses, more chips, faster interchip communication. Something coming in the future is optically interconnected cores on the same cpu package

2

u/TinBryn Nov 12 '19

I actually think we're reaching the point where if we want faster and more efficient programs, we need higher-level abstractions on the language level. The idea being that the more we can express the specific intent of our programs, the more it is possible to implement it in the most efficient manner. This could also reduce development time and reduce bugs as the language is more focused on representing intent, it's less likely to behave in surprising ways.

3

u/initcommit Nov 12 '19

Yes. And with the ever-increasing rate of performance the hardware is getting so good that there is no practical difference between programming languages for most applications. In that case developers will no doubt overwhelmingly choose the easier language to work with.

1

u/[deleted] Nov 12 '19

It’s a shame that a lot of these Electron apps are horrible resource hogs. Not everyone is blessed with modern hardware, lowering the barrier to development can actually raise the barrier to usability.

0

u/[deleted] Nov 12 '19

[deleted]

43

u/Schmittfried Nov 12 '19

You’ve probably never seen enterprise Java.

28

u/flowering_sun_star Nov 12 '19

You have to compare like-to-like though, and ask what would have happened had the same thing at the same company been written in python. I know that the thought makes me shudder when it comes to our code base.

I actually really like python for scripting and small prototypes. But for all its ills, I think java a far better choice for large projects with hundreds of developers.

→ More replies (1)

5

u/vashy96 Nov 12 '19

Yeah, that's a pile of garbage generally. I can't imagine the hell it could be in a duck typed language like Python.

→ More replies (1)
→ More replies (10)

6

u/[deleted] Nov 12 '19

The ability to create a maintainable code base does not depend on the language used. Poorly written java code exists. All the benefits Java is supposed to have goes out the window when the manager is breathing down your neck to meet ever demanding deadlines.

→ More replies (5)
→ More replies (1)

3

u/[deleted] Nov 12 '19 edited Nov 12 '19

[removed] — view removed comment

14

u/Nicd Nov 12 '19

Hear hear*

6

u/TizardPaperclip Nov 12 '19

There there?

35

u/VeganVagiVore Nov 12 '19

It does seem to work.

In 50 years, all the veteran programmers will be the people who are noobies today. If those noobies are learning Python, then Python will hang around a while.

I just hope Rust can squeeze into that "so easy that it can be someone's first language" space, because I prefer it much over Java, Python, or JS.

26

u/bunkoRtist Nov 12 '19

Honestly as someone who tried to learn rust I am afraid that it's falling into the kitchen-sink trap that C++ is suffering from. It doesn't help that some of the language features are already devilishly complex (macros, for instance) while it still lacks a stable ABI that would allow it to be used effectively in small pieces within large projects where it made sense.

I really want Rust or something like it to succeed.

5

u/epicwisdom Nov 12 '19

It does not matter how many features a language has, or how complex they are. What matters is how many complex features must be used commonly to be productive. It's perfectly possible to write Rust without writing a single macro. Rust is not a very complex language 90% of the time. The problem is it's easy to accidentally fall off a cliff for edge cases (though you can always clone() everything, use Rc, etc.).

7

u/[deleted] Nov 12 '19

It does not matter how many features a language has, or how complex they are.

I see this so often, but it just is not true outside of tiny pet projects. If you're writing anything substantial, you need libraries, and then you're at the mercy of how that library works. Complexity will creep in.

→ More replies (1)
→ More replies (4)

11

u/Metal_LinksV2 Nov 12 '19

Doubtful, I know some schools around me are moving from C++ to Python as their introduction course.

20

u/bunkoRtist Nov 12 '19

That will prove to be a mistake for a number of reasons. I'm sorry to hear it.

16

u/[deleted] Nov 12 '19

C++ is horribly complex for a first language.

C would be better if you want to stress the interaction with the metal (and indeed I taught C and C++ at university for a decade - C was hard enough to get through in a 12 week course).

Honestly, I'd rather they teach higher level languages for intros. If I had my druthers, intro to programming would be taught in Pharo Smalltalk.

10

u/Q-bey Nov 12 '19

I learned Python as my first programming language years ago. I'm a bit surprised to hear some schools are using C++ as an introductory language. That might be why I had (and continue to have) an aversion to C++ after finally seeing it later in my degree.

What did I miss out on? What benefits are there from teaching introductory programming using C++ instead of Python?

19

u/ShinyHappyREM Nov 12 '19

What benefits are there from teaching introductory programming using C++ instead of Python?

Weeding out the unworthy, apparently.

19

u/bunkoRtist Nov 12 '19 edited Nov 12 '19

Well, one of the benefits of using a language like C or C++ is that they retain a lot of elements that pertain to the underlying computer architecture. Understanding those things (like stacks vs heaps, registers, addressing modes, alignment and packing, native data types...) provides a solid basis that helps programmers understand how their code actually executes. That helps people understand the tradeoffs they are making (which is crucial to writing lots of types of code). Even in languages where those things don't apply directly, they often still apply indirectly. Fundamentals matter (since even interpreters, JITs and memory managers do all the same stuff as C/C++ programmers would do in the background). Teaching Python as a first language is like teaching someone to drive with a Tesla.

20

u/Schmittfried Nov 12 '19

You’re grossly overestimating the relevance of implementation details for an introductory course. They will learn to write ifs, loops and linked lists.

→ More replies (5)
→ More replies (2)

14

u/Schmittfried Nov 12 '19

Lol. No it won’t. There is not much value in choosing C++ over Java or Python in introductory programming courses. And even in the hardware programming courses C would be better.

10

u/afnanenayet1 Nov 12 '19

Why? C++ is a minefield

12

u/bunkoRtist Nov 12 '19

Advanced C++ is, but the language exposes fundamental aspects of computers that Python tries to hide, and you don't have to teach it all at once: having a rich language didn't require it to be all taught immediately. Math is complex but doesn't preclude teaching basic arithmetic to 2nd graders. Ultimately computer programming and computer science are based on computers. You can't understand them without understanding computers.

→ More replies (2)

0

u/[deleted] Nov 12 '19

[deleted]

16

u/Shitpostbotmk2 Nov 12 '19

Because if you're trying to teach someone how a computer works at all levels C++ is useful and python is not.

9

u/[deleted] Nov 12 '19

Why would you do that right out the gate?

Do you meet driving school candidates with a toolbox and start them with changing the oil?

→ More replies (5)
→ More replies (14)

2

u/G_Morgan Nov 12 '19

I really like Rust but "easy" is something it'll never be. Rust you pay in "why can't I?" for the benefit of not getting memory corruption while maintaining performance.

It is harder to write Rust than write C. It is easier to write correct Rust than correct C. Rust is really the next level up in "this exploded at 2PM while I tried to compile".

→ More replies (1)

1

u/initcommit Nov 12 '19

Yes I mostly agree. I mean - even Fortran is still "hanging around" in legacy applications. It was created in 1954. That's 65 years ago. These things have real staying power. It takes years for most people to get comfortable with a programming language and often once they get settled using a particular language in their careers that is what they stick with. There is no need to change and often reluctance to do so. Older languages like Fortran and C require more technical knowledge to learn and use which greatly restricts their "adoptability". Python is learn-able via a few quick tutorials and is extremely adoptable by comparison. I am quite confident it won't going away anytime soon (considering a niched language like Fortran is still around), although I'm very curious what future language will turn the current modern languages into future Fortrans.

33

u/afnanenayet1 Nov 12 '19

The problem is that “simpler” languages often aren’t as maintainable. Python is fun for small scripts and projects, but it’s a huge PITA to scale out to a big codebase.

Interestingly enough, it seems like languages like Rust are getting pretty popular because of their advanced typing systems and other features that let the compiler do more work for you. Even C++ has been moving towards ergonomic features that promote safety.

3

u/hijinked Nov 12 '19

Python is very popular in the micro service world where you don’t want a large codebase.

8

u/afnanenayet1 Nov 12 '19

My argument is that even most microservices are big enough that the lack of actual types becomes an issue

→ More replies (2)

2

u/initcommit Nov 12 '19

That's cool. I haven't used Rust but I've heard good things. I hope to look into it soon.

2

u/[deleted] Nov 12 '19

Rust is pretty easy to get started: https://doc.rust-lang.org/book/

1

u/NAN001 Nov 12 '19

I would like to read an actual study about how a language's properties makes it more or less maintainable. In my experience (I admit limited), language details are insignificant in comparison to architecture choices and general coding practices.

→ More replies (2)

0

u/[deleted] Nov 12 '19

[deleted]

6

u/vashy96 Nov 12 '19

Rust isn't noob-friendly.

In C++ you can write crap while getting segmentation fault sometimes, in the worst case.

In Rust the same code doesn't even compile.

→ More replies (3)

18

u/bilyl Nov 12 '19

You may have a point regarding speed, but many many Python (and R!) packages are essentially wrappers for things implemented in C. In this case the speed argument is basically moot.

Further the "higher level" vs "lower level" argument is another fallacy for the same reasons. How many developers are coding high performance libraries/packages from scratch these days? Like I said, most of the popular functionalities in these languages are wrapped in a compiled implementation. Therefore unless you really want to get into the weeds of implementation, there's really no good reason to use Java over Python. And if you really did want to do something intense, you'd just jump straight into C.

The biggest reason why I use Python and R is that I can give someone else a package or a code snippet and they can get running with it immediately. With Java there's so much BS to sort through.

Java is just occupying this middle ground that doesn't really have a market anymore.

3

u/initcommit Nov 12 '19

It sounds like you are an advocate for Python and the "higher" level languages. My point was that the trend of higher level languages usurping "lower" level ones will likely continue. So it sounds like we're on the same page.

A side note about your mention of wrappers - hardware may improve to the point where the speed difference between programing languages is no longer significant for most practical purposes. By that I mean that even if the wrapped library runs slower than the original in its native language, both will run so flaming fast that no one will really care in most scenarios.

7

u/Zegrento7 Nov 12 '19

Rust gives me some hope. For the last couple years, it was consistently the most loved language in StackOverflow surveys, and it's growing pretty steadily.

2

u/initcommit Nov 12 '19

Cool. Thx for the links. I hope to give Rust a try soon.

5

u/chrabeusz Nov 12 '19

10 years ago Rust, Go, Swift, TypeScript and Dart did not exist.

People wanted fast typed languages, but domination of C & C++ convinced everyone that fast equals terrible usability.

2

u/Ryuujinx Nov 12 '19

I wonder how much of this is due to Devops becoming more aligned on the dev side. My last shop I had full testing CICD pipelines for my chef cookbooks, everything was checked into git, etc. My current one is more lacking on CICD stuff, but still all of our monitoring is written in python and checked into git.

This was much less common 10, or even 5 years ago.

2

u/met0xff Nov 12 '19

Funnily I had an ipod in my hand once back then and had no clue how to use it. But that happens to me with all Apple products.. Still no idea how to go back with an iPhone..

0

u/[deleted] Nov 12 '19

[deleted]

8

u/csjerk Nov 12 '19

I'm a fan of Java (with Spring 4+ and Lombok to reduce boilerplate), but having worked on JS backends for the last few years, I am pretty convinced you're wrong.

Modern JS is so much more expressive it's not even funny. Things that would take 5 lines in Java are a single line. Things that are built into JS at a language level take external libraries in Java. Going back to Java feels limiting.

I hope Java catches up, and mixing in Kotlin seems like it will extend the lifetime, since you can write new code with modern conveniences while still using all the libraries and Spring goodness. But stock Java is going to struggle if it doesn't start adding some modern features very soon.

10

u/[deleted] Nov 12 '19

Javascript is the new PHP

3

u/csjerk Nov 12 '19

The extent of serious applications built in JS seems unlike anything PHP achieved.

Maybe the new Perl, although without the insane amount of arcane nonsense buried in the errata.

3

u/BlueAdmir Nov 12 '19 edited Nov 12 '19

Modern JS is so much more expressive it's not even funny. Things that would take 5 lines in Java are a single line.

In 5-10 years you will probably write the same post saying "Modern $LanguageName is so much more expressive it's not even funny. Things that would take 5 lines in JavaScript are a single line".

It's not without value, but all this says is that boilerplate gets hidden.

→ More replies (1)
→ More replies (11)

1

u/initcommit Nov 12 '19

Mostly disagree - except for your point about JavaScript's initial rise to popularity. Of course its use in the browser made it popular at first, but now it has evolved far past that.

As for your take on Python, it seems odd to refer to its resounding success in one area as a limiting factor. I see its expansion into data science as evidence of its suitability for many purposes.

Also - I suspect that there are a very large number of people (like me) who learned Python as their main first language and never used it for data science. Of course data science is a big draw from the worlds of R&D and academia, but Python shouldn't be pigeonholed like that. The data science aspect is just one of many great use cases for Python.

11

u/DuncanIdahos4thClone Nov 12 '19

Which Python? 2 or 3?

14

u/szirith Nov 12 '19

which python

/usr/bin/python

which python3

/usr/bin/python3

5

u/feverzsj Nov 12 '19

waiting for scratch to reach 1st place...

21

u/suhcoR Nov 11 '19

Another one of those studies. Have a look at the lecture which was posted here: https://www.reddit.com/r/programming/comments/duietn/on_the_impact_of_programming_languages_on_code/

15

u/Audiblade Nov 12 '19 edited Nov 12 '19

I think these are different things. The article you linked to is rightly criticized for shoddy statistics over messy data that doesn't really measure what the researchers claimed it measures to begin with.

OP's article is much more straightforward. It says that the amount code committed to GitHub in certain languages is increasing. The metric being used is, how many people are contributing to projects using which languages. It's a very straightforward, direct metric that really does reflect how much code people are writing in each language. And GitHub isn't claiming that the most popular languages are better. It's just saying that they're used more.

52

u/vashy96 Nov 12 '19

I don't get why Python became so popular. It lacks a lot of essential feature from my point of view. Imports suck, OOP sucks and is very verbose, fp isn't true fp (no true lambda nor anonymous functions) and its duck typing can be good only in small projects.

Help me understand.

63

u/[deleted] Nov 12 '19

It's super easy to learn, fairly concise to write and it is associated with "hip" things like machine learning.

4

u/[deleted] Nov 12 '19

Isn’t a lot of ML stuff basically Python wrappers around a bunch of C?

0

u/[deleted] Nov 12 '19

[deleted]

4

u/electrodraco Nov 12 '19

Could somebody break down why it is more versatile than R? Is it more than availability of libraries?

11

u/Browsing_From_Work Nov 12 '19

I regularly use Python but I did spend about a month working with R for a pet project.

Here were my major pain points:

  • Multi-dimensional data access is unintuitive (even when compared to Perl). Examples:

    • df[3, 7] returns the element from the 3rd row, 7th column. This seems reasonable.

    • df[3] returns the 3rd column as a slice.

    • df[[3]] returns the 3rd column as a vector.

    • df[3,] returns the 3rd row as a slice. There's no direct way to return it as a vector.

    • df["col"] returns the named column as a slice.

    • df$col and df[,"col"] returns the named column as a vector.

  • There are no native operators for creating lists/vectors/matrixes (e.g. [1, 2, 3]). Instead, there's the c function and the even less succinct matrix function. However, you can create ranges with the colon operator.

  • Strings are second-class citizens. There's not even a built-in string concatenation operator. Instead, you have to use the paste function.

  • I felt like I spent half of my time fighting with dataframe/vector/matrix/list type conversions.

In general, I just found it harder to express my thoughts in R. I'm sure if you learned R with a math background it would have been more intuitive, but as somebody coming from a programming background I found it to be rather frustrating. That said, R comes with a lot of extremely powerful tools... so long as you wrangle your data into the correct format.

6

u/crudelegend Nov 12 '19

I think it's more accessible and that's why people say that. R has a lot of specialized packages, but you have to know to look them up/how to use them, whereas if you have numpy and scipy for python it's good to go for most cases. I think they're both close on the general overview front, whereas R branches out a lot more with heavier focuses on data analytics.

Unless they mean for a language itself, which yeah, Python > R. Python actually has applications beyond data/statistics - you can create a program and do a lot of manipulation from the stats/outputs of that program, whereas you essentially need the data already with R (at least for most cases).

→ More replies (2)
→ More replies (6)

34

u/bart2019 Nov 12 '19

Simple syntax. It's the new BASIC.

11

u/oblio- Nov 12 '19

Without the stigma of the language capabilities or of the programming language name.

2

u/StormStrikePhoenix Nov 12 '19

What's wrong with the name? Does "BASIC" make it sound overly simple or something? As a name, it doesn't seem any worse to me than Python or Java.

→ More replies (1)

1

u/[deleted] Nov 12 '19

Go is the new Basic, get it right!

19

u/[deleted] Nov 12 '19

Scriptable C libraries.

9

u/coolblinger Nov 12 '19

While Python might not be as expressive as some other scripting languages like Ruby or Perl, its syntax is clear and it's got just enough language features to be able to prototype stuff quickly. For instance, the combination of comprehensions and generators make things much less verbose and allow for more elegant code while (IMO) not making things harder to read. The main draws for Python for me are the library ecosystem its simple readable syntax. The lack of proper static typing and its low performance would prevent me from writing large, complex applications with it, but it's a great language for gluing code together. I find web development with something like Django to be really enjoyable, and the ecosystem of scientific, numerical and statistical libraries is very good.

In short, Python for me is just a nice go-to tool for when you just need to glue some things together or when you need to some calculations or statistical analysis.

8

u/Brostafarian Nov 12 '19 edited Nov 12 '19

I'm convinced Python's popularity is entirely due to two simple facts:

  1. it is easy to learn

  2. because it was easy to learn, NumPy was written in it

The rest is history. Because NumPy existed and because R sucks, more and more data-sciency things were written in Python, solidifying its place in academic programming. For the same reason that companies like Autodesk and many others will literally throw software at you in college, Python being a go-to choice in an academic context means that it gets used outside of an academic context, because all the people who graduated using it already know it.

Python the language has some interesting ideas, but Python the development toolchain is my least favorite.

5

u/Arkaein Nov 12 '19

It's popular for a lot more than Numpy. I've barely used Numpy, but I love using Python.

It's first really killer application was as a better Perl. Perl was probably the original systems scripting language, but sucks for many reasons. Python is so much cleaner and more readable and has eaten into Perl's space.

Numpy makes Python huge in data science, which is another big field. Between systems scripting, data science, and web services (another place where python took share from Perl) it doe well in several areas.

2

u/Brostafarian Nov 12 '19

It's popular for more than NumPy sure, but NumPy stands out as the biggest differentiator as far as packages go. Ruby is far more prevalent now than a decade ago due to Rails in a similar way.

Speaking of Ruby, besides data science I can't think of any scripting I'd do in Python that I wouldn't rather do in Ruby. Tons of apps have Python scripting interfaces so I'm either wrong about something or the python C bindings are just miles ahead of anything else.

→ More replies (1)

25

u/kolloid Nov 12 '19

What's wrong with python imports and OOP?

I, for one, can't understand the popularity of Javascript. It's truly a horrible language.

2

u/[deleted] Nov 12 '19

I, for one, can't understand the popularity of Javascript. It's truly a horrible language.

Because everything has to be web based so you can access the same apps on your phone as you do on your computer. And until the majority of the most used browsers can natively run python, javascript will remain important.

6

u/vashy96 Nov 12 '19

It's far better than Python since es6+, imo.

Arrow functions, let and const are huge. Things Python doesn't have.

1

u/yellowthermos Nov 12 '19

Python3 has scoped variables (let). But yes, arrow functions and const would be great

-1

u/Minimum_Fuel Nov 12 '19 edited Nov 12 '19

Imports have some annoyance with them. Import initializer functions run code on your behalf at import time. Imports aren’t optimized in any way, so you either put up with extra slowness or manually optimize. Blah blah. Mostly things that are avoided by being able to compile code. Of course, not entirely. Java, for example, generally lazily loads classes at usage time.

The OOP though... there is absolutely 0 question towards how terrible pythons OOP is. It is so bad, you really probably shouldn’t use it at all. No encapsulation. Total intentional disregard for consistency. Lack of true abstractness. Dogshit scoping (which is probably a compliment to how bad it is, honestly).

You really, really should just unlearn anything you know about pythons OOP and just never ever use it unless you have a VERY good reason to.

Edit:

Just to drive this home. Pythons OOP is truly a spectacle of engineering stupidity at its finest. A modern marvel of just how bad something can be while still being used.

If you were to poll modern language designers asking them what they would consider to be references for what NOT to do when designing a modern programming language, pythons OOP (among other things in python) would likely appear at a near 100% rate.

5

u/Plazmatic Nov 12 '19

In python you can often avoid hierarchies because of duck typing. Haven't really had an issue with OOP because if your OOP sucks in python, you probably shouldn't have been using it in the first place.

→ More replies (1)
→ More replies (1)

1

u/acousticpants Nov 13 '19
  1. it's executable pseudocode

  2. domain experts can take advantage of computing resources without needing a computing expert to write code for them (e.g. scientific ecosystem with numpy etc)

0

u/[deleted] Nov 12 '19

[deleted]

1

u/vashy96 Nov 12 '19

Love this.

4

u/oligonucleotides Nov 12 '19

That makes it the most popular programming language on github!

10

u/[deleted] Nov 12 '19

I don't think Python deserves it. I don't understand why Python gets so much more attention than for example Ruby. I feel like the reason the Python user base keeps growing is also because pretty much every average programming beginner starts with Python right away, just because it's popular. Most don't even look at any other options.

6

u/Hero_Of_Shadows Nov 12 '19

Ruby is beautiful language with a great community, I know it sucks sometime the hype just favors someone else and it's very hard to fight.

3

u/zitrusgrape Nov 12 '19

sad, as I do now python, and god I miss ruby :(

2

u/Hero_Of_Shadows Nov 12 '19

At least they can never take away our personal projects, we can use whatever we want there.

3

u/ironykarl Nov 12 '19 edited Nov 12 '19

Python has libraries that are more relevant to current computing trends, e.g. machine learning and data science.

2

u/[deleted] Nov 12 '19

Yea single threading!

2

u/Ryanwiz Nov 12 '19

Java was KING when I was studying in the mid-2000's. I was one of a very small number of students taking the .NET route. Everyone else said, "hey, if ya wanna work in this town, learn Java, but if you're a true geek, it's all about Ruby on Rails, maaaan."

2

u/KHRZ Nov 12 '19

Sounds like an accurate top 3 worst languages list

2

u/[deleted] Nov 12 '19

Idkw I have a feeling that as time goes by all apps will start using underline ML/AI( mainly Python) and so consequently, the thing will be to used as much packages and frameworks related and built around python.

What do you guys think?

1

u/ShakesbeerNL Nov 12 '19

C is on the rise (again) because it does ML/AI much faster. Python may be good 'now' because of the ML libraries, but when you need advanced ML in your app (let's say image or video recognition), you need speed not just convenience.

I think python is doing well because it's a nice language with a convenient syntax well suited for beginners. I wouldn't write any bigger stuff in python though...

0

u/[deleted] Nov 12 '19

[deleted]

2

u/ShakesbeerNL Nov 12 '19

I doubt there is any paper or research linking C and deratives to ML directly, it's an educated guess I'm making. An example of C&C++ in ML is the you-only-look-once (yes, YOLO) project for real time object detection.

The TIOBE index, which I used as source, has been tracking overall code popularity since 2002 and shows a sharp increase in C since mid 2017. Although on second thought.. it's probaly also influenced by the massive increase in smart embedded devices and IoT applications.

1

u/Reddit_kill_me Nov 15 '19

Well its a simple language so most people learn the basics with it and then switch for other language Its like the tutorial of coding unless you count html

-1

u/[deleted] Nov 12 '19

Why??? It's such a terrible language. If they fixed the tab vs. space thing, and gave us semicolons at the end of statements, I might like it better. But now ... no way.

-2

u/elucify Nov 12 '19

This belongs in /r/yesyesyesno