Embedded SQL directly vs calling as an API - sql

Most database applications require a host programming language to use
SQL to communicate with the database. A wide range of programming
languages can be used with SQL, from traditional languages such as
COBOL, FORTRAN, and Assembler to more modern languages such as C/C++,
Java, and Visual Basic. Your choice of host programming language can
impact the way you will have to code SQL. For example, SQL is embedded
directly into a COBOL program, whereas a language like C requires an
API like ODBC to issue SQL statements.
source: Craig S.Mullins-Database Administration The Complete Guide to Practices and Procedures
What is the difference between embedding SQL directly in the host programming language and calling as an API?

Convenience, that's all. What Mullin's comment leaves out is that COBOL language doesn't understand SQL statements so a preprocessor is used to strip them out of a program prior to compiling and replaces them with, you guessed it, API calls. I believe preprocessors exist for C as well as other languages so I don't really see where he's coming from.

Related

Difference between a scripting language vs programming language? [duplicate]

This question already has answers here:
Scripting Language vs Programming Language [closed]
(14 answers)
Closed 11 months ago.
Please, can anyone explain to me the diff between these two types of language?
And, can one language be these two types at the same time?
Basically, most scripting languages are programming languages, but not all programming languages are scripting languages.
The theoretical difference between the two is that scripting languages do not require a compilation step and are instead interpreted. For example, a C or C++ program normally needs to be compiled before running, whereas a scripting language like JavaScript or PHP does not need to be compiled.
Here are some of the main differences between scripting languages and programming languages.
Programming language code, when compiled, creates executable files in binary code, also called .exe files, which take up memory, whereas scripting languages do not create executable .exe files.
User interface design and graphical design are often partially supported by programming languages, whereas user interface design, data types, and graphical design are all greatly facilitated by scripting languages.
Programming languages are designed to facilitate full-fledged software development, while scripting languages are used to assist programming languages and make coding easier and faster. Scripting languages are generally used for open source projects and web development.
Programming languages are self-executable while scripting languages require a host.
Programming languages are compressed into small packages that do not need to be interpreted by another language or application, while scripting languages are written in one language and interpreted in another program. For example, JavaScript must be embedded in HTML, which is then interpreted by a web browser.

Is programming language compulsory for HP LoadRunner?

I am new to HP LoadRunner. Do I need to have great programming skills to use this tool?
Or is it that I can manage this tool without havign to code or script?
Am new to to this tool. Kindly clarify me.
From my experience, you don't need to have great programming skills, But for some functionality and logic you need general programming skills. If you have little knowledge in C like looping and file then it will enough as a beginner.
About script this tool intelligent for manage scripting activity.
It is a foundation skill for every performance tester to be capable in the language of your tool or you will be incapable in your role
Maybe not "great," but you definitely need some fundamental skills.
You'll need however much programming knowledge is needed to build a simplified version of the business logic and server communication interface of your client.
The business logic complexity depends on your client and what scenarios you want to represent in the test.
There are function libraries in Loadrunner to support standard server communication protocols. If your system follows a supported communication protocol it can be as simple as calling the relevant function.
In my experience the challenge has been in understanding how the client works. That has involved more reading of code than writing of code.
Loadrunner does support quite a few languages. Off the top of my head: C, C#, Java and Javascript. At a minimum you'll need basic programming skills in one of these.

Are there any C-like (in syntax) scripting languages other than JavaScript and PHP?

I am looking for a general-purpose (considering PHP is actually made and initially meant (I understand they are be used different ways some times) for server side Web and JavaScript for client-side web) with C/C++/C#/Java-like syntax. Do you know of such?
Mythryl is a general-purpose scripting languages deliberately designed around C syntax.
Perhaps Pike with Fins
There's also Ch, an embeddable C/C++ interpreter.
Just look through the Comparison of programming languages, and see which ones fit your needs best. You might look at the language with dynamic Type Systems, because those are scripting languages. Hyped languages include Scala, Ruby (with the Ruby on Rails web framework), Groovy and others, if you need a start.
In general, Wikipedia's C language entry lists many: "C has directly or indirectly influenced many later languages such as Java, Perl, Python, PHP, JavaScript, LPC, C# and Unix's C Shell"
Specifically, for general-purpose "scripting" language that is very similar to C, I would strongly recommend Perl which fits the bill perfectly.
Perl's syntax (or at least a sub-set of it) is VERY C-like (to the point that ex-C programmers starting in Perl are unfortunately known to code in "C-ish Perl" style which is pretty much straight up C).
In additional to general syntax ideas, Perl supports a vast majority of C system functions and many other C-isms (e.g. fully functional printf, process control and IPC).
Perl these days is definitely a general purpose language - it is used for anything from web development (including modern frameworks like Catalyst MVC, Plack etc...), to enterprise software development including full blown servers, to system administration scripting and general "scripting" glue tasks.
In addition, it supports both Object Oriented programming (either using classic Perl OOP or using modern Moose), as well as functional programming.
Please note that when evaluating Perl, you should not rely on the numerous myths that exist out there - most of these are due to either people not being sufficiently familiar with Perl, or judging Perl based on a large mass of poor-code-quality dirty scripts written by system administrators who weren't software developers, or judging Perl based on its features in Perl versions that were popular 15 years ago (e.g. any criticism of Perl OOP circa 1998 is pretty much useless unless the person doing it is closely familiar with Moose).
P.S. Since your questions seems to be in "...coming from PHP" context, you should also note that PHP is in fact very similar to a subset of Perl - by design. To quote from php.net:
The syntax itself was similar to that of Perl, albeit much more limited, simple, and somewhat inconsistent.
Matter of fact, PHP started out as a collection of Perl CGI scripts.
I am currently working on a new project called Cpy, using Python's execution engine, but wrting codes in C-syntax. It is built with ANTLR and Python. Take a look at it: http://www.ideawu.com/cpy/
Pawn. Not general purpose (depending on your definition) but very good as a small embedded language.

Is Objective-C a 3GL or 4GL?

I'm having a little debate with a friend about Objective-C being a 3GL but he believes it is a 4GL because descriptors make the language english like.
I disagree with this and I know it is sometimes a fine line.
Is Objective-C a third generation language or a fourth generation language?
References to support your answer will be appreciated.
According to the wikipedia definition of a 4gl language:
"A fourth-generation programming language (1970s-1990) (abbreviated 4GL) is a programming language or programming environment designed with a specific purpose in mind, such as the development of commercial business software[1]. In the evolution of computing, the 4GL followed the 3GL in an upward trend toward higher abstraction and statement power. The 4GL was followed by efforts to define and use a 5GL."
Objective-C is definitely not 4gl. It is a superset of C with full object oriented support and dynamic binding. Although mainly used to develop on OS X systems it can be used on *nix as an alternative to c++.

Which scripting language to support in an existing codebase?

I'm looking at adding scripting functionality to an existing codebase and am weighing up the pros/cons of various packages. Lua is probably the most obvious choice, but I was wondering if people have any other suggestions based on their experience.
Scripts will be triggered upon certain events and may stay resident for a period of time. For example upon startup a script may define several options which the program presents to the user as a number of buttons. Upon selecting one of these buttons the program will notify the script where further events may occur.
These are the only real requirements;
Must be a cross-platform library that is compilable from source
Scripts must be able to call registered code-side functions
Code must be able to call script-side functions
Be used within a C/C++ codebase.
Based on my own experience:
Python. IMHO this is a good choice. We have a pretty big code base with a lot of users and they like it a lot.
Ruby. There are some really nice apps such as Google Sketchup that use this. I wrote a Sketchup plugin and thought it was pretty nice.
Tcl. This is the old-school embeddable scripting language of choice, but it doesn't have a lot of momentum these days. It's high quality though, they use it on the Hubble Space Telescope!
Lua. I've only done baby stuff with it but IIRC it only has a floating point numeric type, so make sure that's not a problem for the data you will be working with.
We're lucky to be living in the golden age of scripting, so it's hard to make a bad choice if you choose from any of the popular ones.
I have played around a little bit with Spidermonkey. It seems like it would at least be worth a look at in your situation. I have heard good things about Lua as well. The big argument for using a javascript scripting language is that a lot of developers know it already and would probably be more comfortable from the get go, whereas Lua most likely would have a bit of a learning curve.
I'm not completely positive but I think that spidermonkey your 4 requirements.
I've used Python extensively for this purpose and have never regretted it.
Lua is has the most straight-forward C API for binding into a code base that I've ever used. In fact, I usually quickly roll bindings for it by hand. Whereas, you often wouldn't consider doing so without a generator like swig for others. Also, it's typically faster and more light weight than the alternatives, and coroutines are a very useful feature that few other languages provide.
AngelScript
lets you call standard C functions and C++ methods with no need for proxy functions. The application simply registers the functions, objects, and methods that the scripts should be able to work with and nothing more has to be done with your code. The same functions used by the application internally can also be used by the scripting engine, which eliminates the need to duplicate functionality.
For the script writer the scripting language follows the widely known syntax of C/C++ (with minor changes), but without the need to worry about pointers and memory leaks.
The original question described Tcl to a "T".
Tcl was designed from the beginning to be an embedded scripting language. It has evolved to be a first class dynamic language in its own right but still is used all over the world as an embeded language. It is available under the BSD license so it is just about as free as it gets. It also compiles on pretty much any moden platform, and many not-so-modern. And not only does it work on desktop systems, there are variations available for mobile platforms.
Tcl excels as a "glue" language, where you can write performance-intensive functions in C while still benefiting from the advantages of a scripting language for less performance critical parts of the application.
Tcl also comes with a first class GUI toolkit (Tk) that is arguably one of the easiest cross platform GUI toolkits available. It also interfaces very nicely with SQLite and other databases, and has had built-in support for unicode for quite some time.
If the scripting interface will be made available to your customers (as opposed to simply enabling your own engineers to work at the scripting level), Tcl is extremely easy to learn as there are a total of only 12 rules that govern the entire language (as of tcl 8.6). In fact, Tcl shines as a way to invent domain specific languages which is often how it is used as an end-user scripting solution.
There were some excellent suggestions already, but I just wanted to mention that Perl can also be called / can call to C/C++.
You probably could use any modern scripting / bytecode language.
If you're willing to put up with the growing pains of a new product, you could use the Parrot VM. Which has support for many, if not all of the languages listed on this page. Unfortunately it's not done yet, but that hasn't stopped some people from using it in a production environment.
I think most people are probably mentioning the scripting language that they are most familiar with. From my perspective, Tcl was designed specifically to interface with C, so your problem domain is tailor-made for the language. However, I'm sure Python, Perl, or Lua would be fine. You should probably choose the language that is most familiar to your current team, since that will reduce the learning time.