Let's put one thing out of the way, any programming language, framework, environment can have excellent documentation that instructs how to build and run a particular program / project. Github is full of examples. More likely than not, when you go to a repository, whether it's code written in Python, C, JavaScript, Ruby, Java, Go, and so on., there will be documentation on how to download and run the build product, but more importantly, instructions on how to build the software from source (hint: look for the CONTRIBUTING file)
Having said that, in practice, on the streets, in the class rooms, in the cubicles, what happens is that folks aren't usually thinking how to get their program to work in your environment. It works on their machine.
The following is my ranking for how easy is it to get someone's program to work on your computer.
For this exercise, I will assume that the receiver of the program has intermediate knowledge on how to run the code. This list is not comprehensive because it's only from my personal experience, for that reason, I'll be reaching out to friends and family to give me additional suggestions. I will try to make the criteria as objective as possible, and most likely refine it to be so as this evolves.
This is not only about programming languages, but also the various environments and systems they ran on.
The following is list is from Best to Worst.
1.
Microcomputers
I rarely have as positive experience with anything these days that can even remotely compare to the microcomputers in the old days. If I gave you a tape or floppy disk that was for the Atari, or Apple ][, or if I asked you type in source-code directly from a magazine article, it worked. There was no build instructions, other than "type Run and hit Enter". The BASICA / GW-Basic era of the IBM-PC and clones would be in the same boat. And so would QBasic.
2.
Turbo Pascal, Turbo C
If the IDE ran on your computer, whatever code you gave it would work.
3.
Visual C++
The reason this isn't in the same list as Turbo C is because it came a bit later, and as time progressed, it was more and more likely for projects to rely on third-party libraries. Sure, it's possible that the Turbo C project you gave me requires some library that you have on your computer, but you forgot to give me, but it was much less likely. Turbo C came with common extensions already included, such as graphics via BGI. Visual C++ was a bit more modern, and pretty soon started to rely on third party libraries, but not as much in the beginning.
Visual Basic
VB came with a ton of components built-right in, and in the beginning you could do a lot with what's in the box. But because of it's popular extension capability with VBXs, within a few years it was less common to get a self-contained project. In fact, it was a bit worse than Visual C++ in that, with C++, it was more likely that the third-party static .lib would be included in the source code that's delivered simply because of where the files are typically located on your own system. Whereas, VBX files had no business residing along with the VB source. You were supposed to put those in the C:\Windows\System folder. I almost want to split VB between early-years and latter years.
NodeJS
If you give me a NodeJS project, I know I can just do "npm install" to get all the dependencies. But, what I need to do next to "run" it may require me to look at the docs, or check the scripts section in package.json. Still, it's unlikely that I won't be able to run it, even if all you thought about was getting it to work on your computer and supplied no instructions. Chances are, you would have added a command in the scripts section for yourself.
I would add Clojure to this list (leiningen). Maybe Ruby, too. And Rust. Actually, I'm not that familiar with these tools. If you are, and you think they're at least as good as NodeJS, let me know.
C# with Nuget
This is almost tied with 5 because usually all I have to do is open it in Visual Studio and build and run it. Wait, or do I type 'dotnet run'. Is that enough? Or do I have to type 'dotnet restore' first? What if I use Visual Studio Code? Do I just run it? Build it?
And that's the problem. It has changed over time. There used to be nuge.exe, then we're told not to use that, as msbuild has it built-in. I think still does, but then there's the dotnet command-line tool, etc.
I don't think a few years goes by without Microsoft changing how package management works. They keep trying to solve a problem wasn't broken to begin with, whereas NodeJS is still "npm install".
If you're reading this more than a few weeks after I wrote this blog, please check against -- Microsoft may have changed the rules again.
Yes, if you're in the cross-platform command-line "dotnet run" world, I'd say your experience is as good as it is with node. The issue that Node has as far as "how do I run this", is superficially mitigated by dotnet's run command, except you have to know which project to run. Often, when I "get" a C# codebase, it will contain lots of projects. It's not immediately clear which one you "dotnet run" to start the main application. Hoping there's an .sln file which the primary project set as default so you just hit F5, like it was VB in 1991.
Modern C/C++
Yes, I know this seems too high on the list. But honestly, there seems to be two types of C++ code that is shared:
1) A snippet of code, 5 to 25 lines, that is written in such a way that will work with your latest compiler without any problem -- this assume you know how to compile and run a stand-alone C/C++ file.
2) An entire project, and is so complex that the developer themselves have to use a full make system that you will be able to leverage, cmake/meson, vcpkg/conan, ninja, msbuild, etc. You will likely be able to build it all and run.
Python / PowerShell.
These are my least favorites because often enough Python .py / ipynb, or Powershell .ps1 files are just floating around stand-alone, expecting to be run. A lot of non-programmers user these tools, and to them if it works on their computer, that's enough. So when they give you their code, their optimism is that it will work on your computer, too. Why not?
Well, I'll tell you why not. You pip installed a Python package, or Install-Module a PowerShell module 9 months ago, and you're happily using it in your code. Both of these tools come with some functionality built in (batteries included) that it's hard to keep track whether some module you've imported into your script is built-in to the environment, or is third-party?
And if yourself are not intimately familiar with what are built-in, you have to go through a trial and error phase where you run the code, wait for Python to tell you it doesn't understand an import. The you attempt to pip install it. If that doesn't work, you have to google to see what's up. If that doesn't help, you may have to contact your friend and ask, "Hey, what is this xyzzy thing you're importing?", just to them respond with, "oh, that's one of my files. I'll e-mail it to you" (facepalm)
What they're supposed to do is create a requirements.txt file, possibly with "pip freeze > requirements.txt", but that's going to output everything you've ever installed, so you have to use a virtual environment, etc., and most folks aren't going to do that 'cause they're just only thinking about what works on their computer.
It's a mess.
PowerShell is only slightly better, but actually it only teases you. You *could* add the "Install-Module" commands right at the top of the .ps1 file so that when I run the .ps1, it'll install what's needed. The problem is, the line will fail if the module is already there. So what most people do is do a -force, which means you're redownloading and installing it every time, which is awful, but not as awful as the script not working.