by dusted · 3y ago · 0 comments
It's all programs. Yes, even that one-liner.
Viewed from the right (or wrong) level of abstraction, everything that can be called a program, can be called a script, and vise-versa.
But the most important thing about this discussion, is that it's utterly unimportant. Like, what kind of decisions are made based on whether something is a script or a program?
A script is specifically a program intended to perform a user process.
Scripts may be maintained by the "user" who has knowledge of the process, rather than the domain or software engineering. Things like style guides don't matter for a script if just needs to gets the job done. They may be messy and easier to replace than refactor if the process or environment change.
In Python I also make the distinction that a script (can) use hyphens in the name, which can be executed, e.g. `python do-thing.py`, but can't be imported through a typical `import` statement (because they generally shouldn't be).
As you say, this isn't really _important_. Scripts _can be_ well written and follow engineering principles. I just use this distinction to recognize the need for these "fast and loose" programs, where there's more emphasis on making a thing happen than maintaining the code.
By saying, "This is a script," I'm really saying, "I don't expect to put a lot of energy into it."
I couldn't answer yes for any point, so considering them the same it's simpler.
I have a labrador.
instead of, I have a dog.
give any value?It depends what you are doing and who you are working with, I suppose.
"Script" is more accurately a descriptor of the language and runtime. Typically meaning it is interpreted at runtime versus complied at build time.
Every script is a program.
This is a script:
print("This line will be printed.")
Without runtime, it does nothing.
At the end of the day, a JavaScript program is delivered as text to be interpreted at runtime. A .NET C# .exe or .dll is not. Therefore, one is a script, the other is not.
In any case it's not a meaningful distinction.
Executables (binaries) run directly.
Some code requires an interpreter to run.
Really important to the OS and those who want to run the application, as you need the right interpreter for the second case.