Re: [OT] difference of Scripting and programming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


|TF20|Shockwave wrote:

The line between a script and a program is certainly a blurred one. I would
argue that a script is *usually* considered less complex than a program.
Additionally, scripts organize instructions just as programs do, but they
cannot create new instructions to be executed. Programs can.

[[email protected] ~]$ file /sbin/install*
/sbin/install-info: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped
/sbin/installkernel: Bourne shell script text executable
[[email protected] ~]$

I'd thought the latter is an instruction: it gets run when one installs a new kernel.

> Robustness
and complexity are usually what separate the two.

Robustness is always essential, in programs of any kind.

Complexity is in the eye of the beholder:) Apart from that, an an important part of designing a program is to break down complexity into manageable components.

Writing a program from scratch that uses indexed files is immensely complex, if done in machine language.

It's easier, but still a formidable task in an assembly language.

Many find it achievable in a language such as C++, PL/1, COBOL etc, but it's still easier to produce an unmaintainable mess than to create a work of art that will stand the test of time.

However, using a relational DBMS such as postgresql or Oracle or DB2, with an SQL interface and it becomes a doddle. One can even do it in shell scripts.

The complexity is removed from the task at hand by using pre-existing code (the RDMS and your chosen shell and maybe some other programs).

For example, it's quite easy to approach and get prices for a selection of securities using lynx, to strip out the junk with grep and awk and to stuff the prices into a postgresql database. A few hours' work at most.

Then, one can extract numbers from the database, again using shell scripts, and create reports, or import files for a spreadsheet, or input files for gnuplot to prepare pretty pictures.

If one did the whole thing in C or Java, one would have to have a working knowledge of HTTP, maybe some HTML (to parse the results), how to use ODBC (JDBC) and how to do graphics in C (Java).

It would be weeks or months, and probably relatively buggy. Might run faster though.

I've always thought of it like the difference between squares and rectangles. All squares are rectangles, but not all rectangles are squares. Similarly, all programs can be considered scripts, but not all scripts can be considered programs. ;)

Yer back to front here.




-- spambait
[email protected]  [email protected]
Tourist pics

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux