Difference between Programming and Scripting??

I hear a lot about how c++ or c# are programming languages and java script an lua etc. are scripting…but what exactly is the difference??

“Scripting languages are programming languages that don’t require an explicit compilation step.”

http://stackoverflow.com/questions/17253545/scripting-language-vs-programming-language

I think this definition pretty much fits. Yes, some languages may compile to some degree but it isn’t a required process for the developer to do. It is typically handled by the application itself.

The interesting thing about this is that some languages can handle both roles. C# is one example of a language that can be used as both a programming and scripting language.

4 Likes

This.

Ultimately it is a difference that isn’t really important in a practical sense. At least when discussing languages themselves. For example in Unity, C# is primarily used for scripting, but it can also be complied. The difference is more important in a discussion about scripting or programming in general (or applied) or at a much higher level.

2 Likes

There is not a clear boundary, especially when the terms are used informally.

Some concepts that people might have in mind when using the terms ‘scripting’ or ‘programming’ include
Interpreted vs semi/compiled
Strongly typed vs weakly typed
Scripting as code that ‘drives/scripts’ an existing framework, rather than building a new framework (so smaller units of code vs larger frameworks of code)
High-level vs Low-level languages

So if you take the idea that scripting is driving/gluing another larger lower-level framework with shorter pieces of code then the related traits I listed above make some languages more suited than others. E.g. you want high level of abstraction, weak/dynamic typing, and little or no compilation steps. A language that ticks all these boxes is a good ‘scripting language’. And all scripting languages are programming languages.

I think it’s marketing more than anything else. Scripting sounds easier than programming.

For example, SuperCard uses a token lookup system so it’s just pointers to assembly code. “Loose type” is an understatement there. The compiler will treat anything like anything, until it finds a match. It’s one of the slower languages, but it also can create and run instances of itself in real time. For example, you could use SuperCard to write a program that would run every line right after it runs. And it uses mostly human English as the language. There was a plug-in for SuperCard that would “compile” SuperTalk. It could build assembly code, and supposedly newer versions of the plug-in were compiler were actually written in SuperTalk. I built the first multiplayer Flash server in SuperCard, with a few compiled plugins for networking. It was “slow” by comparison to raw C, but it was fast enough to handle around 10k simultaneous people playing poker.

LiveCode uses a similar system that (supposedly) compiles the code into assembly. It’s not as flexible as SuperTalk’s native language, but it’s a lot faster, especially in some specific cases like text parsing. I’ve seen LiveCode parse text as fast as C, on the same machine. I honestly don’t know how they did that.

Userland Frontier uses YACC to compile its ‘scripts’ into machine code. It’s as fast as Objective-C. Faster, in some cases. But it’s still called a scripting language, despite that it can inherently build assembly code on the fly, when prompted to.

RealBasic, now Xojo, uses a compiler, too. Supposedly it would build assembly from Basic code. But it was slower than Frontier or LiveCode for years (no idea now).

Unity’s “scripting languages” are surprisingly fast to me. Mono is impressive, to say the least. I don’t know if it builds assembly language code–I doubt it. But it’s really, really fast.

The use of the term “scripting language” came about to make programming seem easier to do. But what it honestly entails under the hood is anyone’s guess.

I’m pretty sure the two terms are used more to describe the types of work you’ll do with them. But under the hood, there’s very little actual difference.

Indeed. And the boundary continues to get more blurred. The distinction was much more defined in the past when systems were less complex and abstracted.

Not much more to add here, hmm…

When you script people, they know they are acting. When you program people, they are unaware that you are changing who they are. :smile:

1 Like

True :stuck_out_tongue:

Unity calls them scripts but from a software engineering perspective, it would be more accurate to call them components. Really, they’re just C# files (or whatever language) that get compiled with the rest of the project. Like others have said, calling them scripts was probably to make it sound easier, and so it would be compared with Lua scripting. Unity “scripts” are compiled.

“A scripting language or script language is a programming language that supports scripts, programs written for a special run-time environment that can interpret (rather than compile) and automate the execution of tasks that could alternatively be executed one-by-one by a human operator.”

“The term “scripting language” is also used loosely to refer to dynamic high-level general-purpose language, such as Perl,[1]Tcl, and Python,[2] with the term “script” often used for small programs (up to a few thousand lines of code) in such languages, or in domain-specific languages such as the text-processing languages sed and AWK.”

Many scripting languages are compiled now. The differences separating the two concepts have largely been eliminated with the only real difference remaining being who compiles them.

If your code is automatically processed, it is a scripting language. Creating and modifying code in Unity is handled by an external IDE, but you don’t actually tell the IDE to compile the code. Rather you save it and Unity automatically processes it in the background when necessary.

If your code is manually processed, it is a programming language. Creating and modifying code in Unreal 4 is handled by an external IDE, but you also have to tell it to build the code. It won’t simply do it for you.

“Component” means something quite specific which does not apply to all code in Unity. MonoBehaviours are components, but you’re not restricted to MonoBehaviours.

Really, the line between “programming” and “scripting” in Unity is so blurred that it may as well not exist. Compare something like JavaScript in web pages (interpreted, only makes sense in its specific context, refers explicitly to the content it’s a part of) to something like C++ writing an application (compiled, needs no context other than the operating system it’s running on, operates on content rather than in it) and there’s a clear difference. In Unity the exact same tools span that entire gamut, though - there’s no practical reason to discriminate between some being “scripting” and others being “programming”.

I feel like I’ve asked this before, but don’t browsers have JIT compilers?

I believe so. Does it make any difference whatsoever in the context of what you’ve quoted, though? The important part of that is that the code itself is a part of the content, not an external thing acting on the content. Whether it gets converted to machine-specific instructions before or during execution is neither here nor there, it makes no difference to the user or to the coder.

No, but that’s essentially my point. It is not as simple as labeling one as interpreted and one as compiled because many languages now compile themselves. Rather it is how the language is used by the platform. Whether or not the compiling stage is handled automatically is part of this.

Which is why that’s not what I was doing. :wink: The distinction I was making is one between “computer instructions that are a part of the content” and “computer instructions that facilitate the content”. Interpretation is mentioned as one thing amongst other, equally important things because it helps demonstrate the concept, not because it alone is the sole deciding factor.

1 Like

For me scripting is creating spaghetti code without real structure or just some functions that call each other.

And programming is creating a system with a smart structure, e.g. using design patterns and abstraction.

But there is no black and white with this of course.