Question:
How to use scripting programming languages?
2009-10-05 21:52:20 UTC
I've been reading online that scripting languages are used separately in applications to make GUI's or other things. Specifically I've been looking at Python because I read I could make a GUI for a C++ program with it. Is this correct? Am I not able to create a GUI with a language like C++? If not, what is the general idea of using two languages for one application? Or if I'm just completely off-track, can someone point me in the right direction?
Three answers:
jplatt39
2009-10-06 00:17:27 UTC
Let's start with being able to create a GUI with a language like C++. Of course you can. Is it easy? No. There are 3rd-party libraries available for doing it but it's something you learn once you understand the basics of programming in a given language.



Now let us skip back to the beginning. A scripted programming language is one whose commands are parsed and interpreted each time the program is run, rather than when the program is compiled, usually into an executable file. They are usually text files, though Java compiles your program into an intermediate form (.jar) which is interpreted -- so it can be run on multiple platforms. In fact any command interpreter (such as MS-DOS's command.com or CMD.exe, or *nix's bash, csh or zsh) interprets commands typed into the prompt or can run text files (bat files in Windows/MS-DOS or shell scripts in Unix or GNU/Linux) which contain programs, command lines for these programs with variables, and so forth. I once played an Adventure-style game written entirely as a batch file (but with no GUI, incidently. This was the early nineties).



A word about the Microsoft vs. "Linux" thing: Linux is actually an operating system kernel which was written to run most of an operating system which was developed on Unix. In those days the GUI was not considered part of the Operating System, but by default, since it ran Unix programs it inherited Unix's GUI -- which is X-Windows. Much of the development of X-Windows shifted to GNU/Linux so even modern Unix installations will by default USUALLY run desktops developed on it (solaris uses GNOME) but X-Windows is older than Windows and doesn't run on Microsoft Computers because Microsoft has no interest in other peoples' standards. C/C++ is also a UNIX product, in fact the GNU Tools, like Linux, are built on GCC, one of the first GNU Tools (that "most of an Operating System I mentioned) whose real strength is its ability to compile programs for different architectures (a reason for Linux's success. Since it was one of the first, though not the only, GNU Operating Systems, that it was written for Wintel computers quickly became irrelevant as most of the early adopters and developers had both permission and the tools to compile and adapt it to other systems like the PowerPC Mac. This means that you have two different GUIs -- one intended to be cross-platform, one intended to compete with it. Apple has put its own GUI on Unix and there are both compatibilites with X-Windows and options to run it with its regular GUI. That is why there are scripting languages which take over the burden of interacting with the GUI for the programmer. Any GUI program is complicated and X-Windows is old enough so that when you dig into the guts of it you will find the words "Client" and "Server" used in exactly the opposite way from which they are used in networking.



So this rambling lecture has a point: Applications programming languages such as C/C++ are often used to create GUIs, therefore it is certainly straightforward to write programs with them. It is never easy however, and interpreted languages are generally the easiest way to write graphic user interfaces. TK/TCL has been widely used in BOTH Windows and X-Windows since the early nineties, and the qt library -- which the KDE desktop was created on -- is also cross-platform. Many commercial programs do use scripted languages. I know Freehand used to do a lot of its runtime configuration with encapsulated postscript and I believe Illustrator and Inkscape still do. Look at win.ini and you will find that that too is a text file. Scripting languages definitely have their place and I would learn how to use them, though I would try to do batch files with environmental variables and such before tackling python, which is not a beginner's language.
2016-04-06 11:00:27 UTC
I don't usually work with scripting languages, but I believe that they are interpreted at run-time. For example, if a webpage has javascript in it, the code will be interpreted by the computer when the page is actually opened. For other programming languages, completed code is usually compiled into an executable file (.exe), so it is already in machine code. This makes the program run faster. However, since not all computers can use .exe files, scripting languages are useful in online games and such, as each computer can interpret the script in its own way.
Matt E
2009-10-05 22:04:07 UTC
Scripting languages are just strings of commands run in a cmd line, while c++ is a programming language that can be compiled and run in either a cmd line or a GUI. If you are new to c++, then I would strongly suggest you get the express version of visual basic or visual studio.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...