LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


View Poll Results: Do you do any programming or scripting?
I have no idea what you're talking about. 1 1.47%
I get dizzy just looking at code. 3 4.41%
I've played around with both, but I don't do either regularly. 10 14.71%
I can write great scripts, but I leave programming to others. 10 14.71%
I do programming, but I'm not too good at scripting. 11 16.18%
I am a whiz at scripting, programming, and French toast. 11 16.18%
I refuse to recognize a difference between the two. 21 30.88%
I invented a coding language. 0 0%
This is a stupid poll. Get a life. 1 1.47%
Voters: 68. You may not vote on this poll

Reply
  Search this Thread
Old 12-15-2009, 07:21 PM   #46
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled

Quote:
Originally Posted by zsd View Post
Rubbish.

If you make an error in semantics in a compiled language, it may well execute for a while before it crashes and burns.

Similarly, some errors in syntax will prevent a script from even starting.
You have to admit, our four sentences can't completely define the difference between scripts and programs. Not much can be completely defined, while still being concise, in four sentences.
Kevin Barry
 
Old 12-16-2009, 03:27 AM   #47
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91
I used to do programming for a living, but got fed up with it.
Now I only code for fun to write things for myself.

I think I can call myself a great writer of scripts and reasonable at coding in C.
 
Old 12-16-2009, 08:58 AM   #48
zsd
Member
 
Registered: Dec 2005
Location: Nova Scotia
Distribution: Slackware
Posts: 94

Rep: Reputation: 54
Quote:
Originally Posted by ta0kira View Post
You have to admit, our four sentences can't completely define the difference between scripts and programs. Not much can be completely defined, while still being concise, in four sentences.
Kevin Barry
Your sentence implicitly claims there is a difference between "scripts" and "programs". I don't think there is. Someone could write a C interpreter... would C then become a scripting language?
Similarly, someone could write a compiler for (say) bash code. Would that change the nature of that code from a "script" to a "program"?

Further, your post to which I first replied was just plain wrong, even if for some reason you feel the need to separate some kinds of programming languages from other kinds.

A program is a sequence of instructions which tells the computer how to do something you want done. Whether the program is translated into machine language, some intermediate form (such as java .class files) or executed concurrently with translation such as bash programs(!)), it is still conceptually doing the same thing.

The poll would have made more sense to ask whether
- you don't program at all
- you prefer programming in languages like C/Java/C++, or
- you prefer programming in languages like shell, perl, ...
 
Old 12-16-2009, 09:05 AM   #49
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by zsd View Post
The poll would have made more sense to ask whether
- you don't program at all
- you prefer programming in languages like C/Java/C++, or
- you prefer programming in languages like shell, perl, ...
That does seem to make more sense.
 
Old 12-16-2009, 09:43 AM   #50
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: OpenBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 440

Rep: Reputation: 57
Quote:
Originally Posted by chrism01 View Post
Actually, no, see my (preceding) post #42
Well, see, Perl doesn't really 'compile', in the sense that C does, nor is it fully scripted like DOS bat:

From: http://www.perl.com/doc/FMTEYEWTK/comp-vs-interp.html
Quote:
From the frontend (the ``source-code to parse-tree'' compiler), you can get at the backend (the PP interpreter) via a BEGIN subroutine. Likewise, to go the other way (get back to the compiler from the interpreter), you can use an eval("string") or a s/foo/bar/ee notation. By the way, despite appearances to the contrary, it turns out that an eval { BLOCK } and s/foo/bar/e are not actually hooks back to the compiler; it already handled them long ago and far away.)

Does that make sense? Think of every call to

$ perl somescript

as being

$ perl-compiler < somescript | perl-interpreter

At no point did our perl compiler as described above engage in the actual generation of C code, assembly language, nor machine code take place.
So there is no actual literal compilation taking place, but it is sorta semi-compiled. I will give you that Perl is one of those languages that really blurs the distinction, but the fact of the matter is that Perl scripts do not live in a platform specific bytecode or machine language (like C or Java).


<edit> I think this proves the point though - the difference between programming and scripting is very small, if it exists at all. </edit>

Last edited by MBybee; 12-16-2009 at 09:51 AM. Reason: clarification
 
Old 12-16-2009, 07:19 PM   #51
bigelow
LQ Newbie
 
Registered: Jul 2009
Posts: 5

Rep: Reputation: 0
Smile How about linux assembly programming?

Believe or not, I'm learning linux assembly programming lately. I like to focus on the detail that only the assembly language can lead you to. I choose to use it in linux environment because i like the command line mode to compile and link. I found kate is a good editor in linux to write up codes.
Scripting is another thing i am planning to do in the feature.
 
Old 12-17-2009, 08:42 PM   #52
Caesar Tjalbo
Member
 
Registered: Aug 2006
Location: Ņuņoa
Distribution: KaOS
Posts: 94

Rep: Reputation: 16
Quote:
I refuse to recognize a difference between the two.
I'll even go further. Switching on a lamp: not programming. Using a timer so the light goes on/off when I want it: programming. Another example: a humble cousin of mine claimed that all this programming was too difficult for him, all he did and could was write macros in Excel. I told him he was wrong, I told him that he was very much 'programming'.

It's about human - machine interaction and the way it happens, I guess the decisive factor is doing something not directly interactive. Anyway, food for philosophers. Any difference between 'programming' and 'scripting' is irrelevant IMO.
 
Old 12-18-2009, 12:29 AM   #53
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Tht's why I introduced the example of using punch-cards early in the thread. scripting is very much a form of programming, just as punching buttons in a certain order or throwing manual switches on an ancient computer or setting up the gears on a Babbit machine.

For those stuck on the difference between compiled and non-compiled languages, what about using the tcc compiler to run C programs as scripts? A 'program' is simply a logical sequence of instructions with a given purpose. It makes no difference what the interface between the person and the machine is, nor how it works. Programming -in it's very conception- is an abstraction.
 
Old 12-18-2009, 06:17 AM   #54
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Seems to me that scripting is a subset of programming, rather a whole different thing.
 
Old 12-18-2009, 09:31 AM   #55
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: OpenBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 440

Rep: Reputation: 57
Quote:
Originally Posted by MTK358 View Post
Seems to me that scripting is a subset of programming, rather a whole different thing.
I would say that's pretty reasonable.

Perhaps it's a question of simplicity?
Would it be programming to do this:

Code:
#!/usr/bin/ksh

avp=$( ps -ef |grep avprfc.exe |grep -v grep |wc -l )
sap=$( ps -ef |grep sap |grep -v grep | grep -v saposcol |wc -l )

if [ $sap -gt 1 ]
        then

	if [ $avp -lt 1 ]
		then
		/interfaces/inbound/taxware/avprfc/start_avp.csh
		fi	
	fi
Just because there is an if statement in there?

How about this:

Code:
#include <stdio.h>
int main(){
    printf("%d bit\n", sizeof(void*) * 8);
    return( 0 );
}
Both do something useful - one is a shell script that I run from cron to verify a service is up, the other is a tiny C program I use to check if I'm on a 32 bit or 64 bit host (prior to doing a big automated install task).

Either could be done in a number of different languages.

How about this example?
Code:
HAI 1.2
BTW CAN HAS STDIO?
I HAS A VAR
VAR R 0
IM IN YR LOOP UPPIN YR VAR TIL BOTH SAEM VAR AN 10
    VISIBLE SUM OF VAR AN 1
IM OUTTA YR LOOP
KTHXBYE
I have an interpreter that turns this into an executable file, and one that runs it like a script.

Last edited by MBybee; 12-18-2009 at 09:34 AM. Reason: can't type before coffee /facepalm
 
Old 12-18-2009, 09:43 AM   #56
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Quote:
Originally Posted by MTK358 View Post
Seems to me that scripting is a subset of programming, rather a whole different thing.
I agree too for the most part -- if even not precisely a "subset", it definitely isn't a "whole different thing":

The purpose of "programming" is to give a sequence of commands to a machine, for execution. Scripting fits this description, as does the punch-card example. Whether or not there's an interpreter (a shell, a card-reader..) between the commands and the machine, is not relevant.


Sasha
 
Old 12-18-2009, 10:08 AM   #57
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by MBybee View Post
Code:
HAI 1.2
BTW CAN HAS STDIO?
I HAS A VAR
VAR R 0
IM IN YR LOOP UPPIN YR VAR TIL BOTH SAEM VAR AN 10
    VISIBLE SUM OF VAR AN 1
IM OUTTA YR LOOP
KTHXBYE
That strongly reminds me of the code samples on Wikipedia's entry for COBOL.

In my opinion scripting is writing code that affects the behavior of another program, instead of running on the CPU.

Even in something like Python, it's the interpreter that does the actual work, so the python script affects the python interpreter's behavior.
 
Old 12-18-2009, 10:44 AM   #58
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: OpenBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 440

Rep: Reputation: 57
Quote:
Originally Posted by MTK358 View Post
That strongly reminds me of the code samples on Wikipedia's entry for COBOL.

In my opinion scripting is writing code that affects the behavior of another program, instead of running on the CPU.

Even in something like Python, it's the interpreter that does the actual work, so the python script affects the python interpreter's behavior.
Yes - LOLCode reminded me a bit of COBOL too
It's fun to write in.

That's an interesting way of looking at it - so you would say something like C, which has registers, direct ASM calls, and the ability to compile to machine code - programming? Or not, because it merely compiles to a lower set that is then itself interpreted again?

This description would of course exclude nearly anything that used the MFC, Java, Perl, COBOL, and, really, almost everything but Microcode? Thanks, but no thanks - I stopped using stuff like that when I left behind my Motorola 6800

I'll stick to the more portable higher level languages that are (mostly) cross platform - ANSI C, Perl, LOLCode, etc

Last edited by MBybee; 12-18-2009 at 10:49 AM. Reason: quote was broken somehow
 
Old 12-18-2009, 12:55 PM   #59
Caesar Tjalbo
Member
 
Registered: Aug 2006
Location: Ņuņoa
Distribution: KaOS
Posts: 94

Rep: Reputation: 16
Quote:
Originally Posted by MTK358 View Post
Seems to me that scripting is a subset of programming, rather a whole different thing.
The focus of the result determines the tool being used. For (a stupid) example, there's a reason the Linux kernel isn't written in PHP and your average website isn't written in C. The tools that we could conversationally call 'scripting languages' were designed with some specific goals in mind, like not having to worry about detailed memory management or being able to produce a working GUI with just a few lines. It's what makes something like Python a "high-level programming language", intended to collaborate with C code, not to replace the language C. Therefore calling one a "subset" of another doesn't do justice to either one. C might be able to allow you to do everything you can do with Python and more, each language has areas of use where using the other would be a waste of resources. Not subset or superset but partly overlapping.

What I mean is, as an alternative (there are other ways), you can look at it in terms of "generations" of computer languages. Increased capable hardware, development in ideas about software, increased demand for productivity all led to newer languages incorporating new abstractions but being built with ideas from previously developed languages.

Quote:
Originally Posted by MTK358 View Post
In my opinion scripting is writing code that affects the behavior of another program,
That makes some sense to me although I'm not sure if I want to look at it that way. Say I write a plug-in for another program, that would affect the program but I'd give it functionality that it didn't have before. Same with writing a wrapper around an existing program. Merely piping the output of one program into another would already create a new program with behavior the original programs separately didn't have. I don't mind to call all that 'scripting' but I fail to see the relevance in distinguishing it from 'programming'.

Quote:
Originally Posted by MTK358 View Post
Even in something like Python, it's the interpreter that does the actual work, so the python script affects the python interpreter's behavior.
I argue that the necessary run-time is not relevant because there'd be no functional difference between a Pong written in Python or one written in assembly (assuming that speed of execution or development wouldn't be a functional requirement here).
 
Old 12-18-2009, 01:27 PM   #60
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
I meant that scripting IS programming, but not all programming is scripting.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is this program/script? centosfan Linux - Server 3 01-12-2008 09:01 AM
See if a program is already running in a script tytower Linux - Desktop 6 01-27-2007 01:26 AM
Script to run a program bluedude2288 Programming 3 06-11-2004 05:13 PM
Start Program Script Cafrow Linux - Newbie 1 08-17-2003 04:26 AM
Keylogging script/program TomG Programming 3 08-06-2002 03:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration