66

When you have behavior that you don't want to have to recompile the program in order to change. This is exactly why so many games use Lua as a scripting/modding language.


44

I did this, and I recommend that you don't. What I did was write all the business logic in Lua, and stored that Lua script in a database. When my application started up it would load and execute the script. That way I could update the business logic of my application without distributing a new binary. I invariably found that I always needed to update the ...


42

Let me attempt to find a dividing line between these three types of language. Of course, there will be numerous exceptions and counterexamples, since this is just my opinion. A markup language is used to control the presentation of data, like "represent these user names as a bullet list or as a table". A scripting language is used to mediate between ...


40

Embedding a language (I'll avoid characterizing it as "scripting") means that the following has been done: The interpreter and runtime are running in the same process as the host application Enough of the standard types and the standard library are also available from within that runtime Most times, the application has its own library available to the host ...


37

Piping dynamic data into an interpreter of your implementation language is usually a bad idea, since it escalates the potential for data corruption into a potential for malicious application takeover. In other words, you are going out of your way to create a code injection vulnerability. Your problem can be better solved by a rules engine or maybe a domain-...


28

This technique can be used to implement core logic that is easily portable between different language environments. For example, I have a calculator simulator where all the internal calculator logic is implemented in 100% JavaScript. The user interface code is of course different for each platform: Web browser (JavaScript) iOS (Objective-C) Windows (C++ ...


23

Developer scripts go also into version control, because usually these scripts also depend on the items in version control, e.g. file paths. If these scripts are versioned they also should work for all developers to avoid that every developer writes his own set of scripts, which becomes a maintenance hell. In addition bugfixes or improvements of these ...


18

Very broadly there are two situations where you would apply this pattern: This is used internally to leverage some quality of the embedded language. This is used to provide external programmability. Internally Typically the embedded language is interpreted which allows changes to be made and tested quickly without a re-compile. The embedded language may ...


16

What does it mean for a programming language to be interpreted and how are they compiled before execution in the terminal? Compilers and interpreters are very similar things, right up until the last step. For a compiler, the last step is to generate code in the output language and save it. For an interpreter, it's not trying to save your code; it's trying ...


15

bash has been around since 1989, and its syntax is largely compatible with that of the much older Bourne shell, which was released in 1977. Huge swaths of core functionality in many operating systems (most Linux distros, OS X, and indeed most POSIX-compatible operating systems), and many real-world systems (make systems, automated tests, initialization ...


14

It's particularly strong at handling a ton of file I/O and I would expect it to handle a ton of network communication well too. It seems particularly popular for socket-driven apps. The important thing to keep in mind is that if your needs aren't met by existing libraries (there are many) you may need to dive into some C which can be bound to JS commands. ...


14

A "script" is a set of instructions that do something the user could do themselves, only faster and with less possibility for error. Sure, I could delete all my old log files manually, but the script Bob wrote does it just fine. An "application" or "program", in contrast, is an automated or interactive bit of software that can be thought of as doing ...


13

It depends on what code is in the include file. Did you try putting the #include for <stdio.h> inside main()? Depending on how the standard library is implemented on your system it may not even compile. Header files can contain not only function declarations, but function definitions. Standard C doesn't support nested functions. If your header file ...


11

C programmers, on the whole, will expect the #include directives to be at the beginning of the file. Why risk confusing them without any significant benefit?


11

A markup language is a language which is used to represent structured data. For example, HTML enables to specify that some part of the document is a title or some other part is a list, by comparison to a flat text document. Markup languages are not considered as programming languages¹. The difference with programming languages is not always obvious. For ...


10

Basically the difference is just one of degree. A script tends to be a lot more formally defined, with a well-defined scripting language behind it, while a macro is usually something more simple and ad-hoc. Macros are frequently "recorded" by telling a program "watch everything that I do" and then performing the action, whereas scripts are generally ...


10

In addition to @simon's answer. Not all in the software engineering is about programming, designing or modelling. There's a myriad of tasks we perform continuously during the working day. You already mentioned one -building the project outside the IDE- but there are many more. Experienced / proactive developers tend to automate these tasks. Some, even ...


10

The main factor is typically the API that's used by host applications to access the language libraries. Languages like Lua are designed to be easily 'connected to' from host applications. The language may be available in library form, the API easily callable from other languages (generally a plain C API). The API usually provides functions to run a script,...


10

In theory any language can be embedded. If there are no constraints on the solution, it is actually the case. It's natural consequence of Turing completeness i.e. you can always build an emulator. What I think you are asking is "what makes a language practical for this purpose?" I think one of the main things that makes a language a good choice for this ...


9

Real world examples would include:- Most web browsers which will support embedded JavaScript. Microsoft Office Suite -- Excel Word etc. all support embedded VBA scripts. Many network routers include script APIs, in a variety of languages TCL, Perl , Lua. Many embedded devices are implemented using a very small set of core C functions which are glued ...


8

Sounds like support engineer to me. Granted you're an internal corporate developer getting tossed halfway between IT tasks and projects, but using code as your go-to tool for solving problems makes your job one as a programmer/developer/engineer regardless of everything else. I would call it support engineer or even something like internal professional ...


8

In most cases, behind a successful language is a powerful sponsor. AT&T gave us C and C++, Microsoft created the .NET family, Java came from Sun, and even though they didn't invent it, Apple is almost completely responsible for the recent popularity of Objective-C. (Though that's a borderline case, since pretty much nobody outside the OSX/iOS ecosystem ...


8

Things that belong together should be kept together. Don't have me open another file just to find some _internal_helper_function() that can't be reused in another context. This re-usability is another important point: If the code you've written could be useful in future projects, structure it as a reusable library. Separate it both logically (dependencies) ...


8

If you've ever used RESTful APIs, you've come across at least one where you have to make multiple API calls to get all the data you want. It just kinda comes with the territory. The benefits of a granular API are that you can get exactly what you need and nothing you don't. The cost is multiple calls, which can get bad if you need to build a deep object ...


7

Macros come in different flavors. The original kind was macros in assembly language, where a group of instructions could be named and each time the name was used the instructions were substituted for the name. C and C++ also have macros that work this way. But as with most things in IT, why have one term or one meaning when we can make things more ...


7

I would tell you to go to the single file approach, because the other approach (many single-variable files) is at least extremely unorthodox. The advantage of the single file approach, which has been used successfully for decades, is that all configuration settings of a program (or aspect of a program*) can be moved together to another location, compared ...


7

I see a few possible options here. There are probably other ways about this, too. See Microsoft Visual Studio 2017 Installer Projects and the MSDN docs on it. This will let you set up an installer project for your C# project. You can specify to include the .vbs file and where on the target machine you want that file copied. You can put that file either in ...


7

Scripting is automation. Scripting languages were specifically developed for automation tasks. They often have features that make scripting easy, e.g. simple mechanisms for invoking other programs or a less strict language (usually, no type system, or no requirement to declare variables, built-in collections, …). E.g. Perl was designed to “make easy things ...


Only top voted, non community-wiki answers of a minimum length are eligible