LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2017, 05:12 PM   #16
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,893

Rep: Reputation: 339Reputation: 339Reputation: 339Reputation: 339

Quote:
Originally Posted by justmy2cents View Post
Im just starting to get into shell scripting and it's fun, but I hear a lot of people say that shell scripting is not programming. So im wondering how different is programming compared to shell scripting? The main thing I want to know though is, is there a plethora of commands you have to memorize like in Linux? I accumulated (learned) I feel a nice set of Linux commands, but it took me awhile to do so and really understand them and their options. Will that process repeat for leaning something like Ruby/Python or Lua? Thanks in advance!
When you learn your first programming language you have to learn a lot of things that are applicable to any programming language. The things that you learn include absolute logical thinking, modular logic, providing code for every possible case, creating error correction routines and failsafe code, documenting programs, handling different type of input/output, and so on. If you learn a second language you will have to learn the new language's commands, syntax, and logic flow but there is a whole lot of carry over in the areas I described from the first language to the second language. You will learn the second language much faster than you learned the first language.

The one exception to this rule is when you learn your first assembly language. As dave@burn-it.co.uk described assembly is so much further from human thinking than a high level language that it just takes a long time to learn to solve problems the assembly way.

--------------------------
Steve Stites

Last edited by jailbait; 05-16-2017 at 06:05 PM.
 
Old 05-16-2017, 06:45 PM   #17
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918
To put in my 2c, I consider scripting to be programming, it's just a certain subset of programming.

One definition on the interwebs states that programming is "The process of developing and implementing various sets of instructions to enable a computer to do a certain task."

So, programming is a very generic term, ranging from the use of assembly language, through low-level and high-level languages (compiled, interpreted and the many, sometimes exotic, mixtures of the two), to educational graphical systems such as Scratch.

Last edited by hydrurga; 05-16-2017 at 06:46 PM.
 
1 members found this post helpful.
Old 05-16-2017, 09:29 PM   #18
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Pascal is the historical teaching language, but nowadays I think many people just go straight to C.
 
Old 05-16-2017, 10:15 PM   #19
sharky
Member
 
Registered: Oct 2002
Posts: 539

Rep: Reputation: 74
Quote:
Originally Posted by hydrurga View Post
To put in my 2c, I consider scripting to be programming, it's just a certain subset of programming.

One definition on the interwebs states that programming is "The process of developing and implementing various sets of instructions to enable a computer to do a certain task."

So, programming is a very generic term, ranging from the use of assembly language, through low-level and high-level languages (compiled, interpreted and the many, sometimes exotic, mixtures of the two), to educational graphical systems such as Scratch.
I agree with this completely. Guess that makes it 4c.
 
Old 05-17-2017, 01:17 AM   #20
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
If you want to learn programming it's best to learn the overall purpose of object-oriented programming. Practically every language nowadays is oo. Every component of the program is an object. Objects have properties, events and methods.

Objects can use one of three ways, or any combination, to accomplish their function: sequence, selection and/or iteration. Usually, for programming, you want to use an IDE, because the IDE lays out the libraries and their objects, and tells you which properties, events and/or methods each object does.

Libraries are collections of objects you can use so everyone doesn't have to write the same code over and over. I learned programming formally, and I just don't think it's possible to program well without at least some formal instruction.
 
Old 05-17-2017, 02:03 AM   #21
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 5,583
Blog Entries: 16

Rep: Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316
There have been several references here to the number of commands you need to know. I think this is an important point. Programming languages like C have very few commands, mostly flow of control stuff like "while" or "if". Everything else is your own creation. You write functions in this limited language set, and they become commands for the main program to use. It's more about creativity and logic than learning.

In shell scripts, every command that the system recognises is available to you. The script is simply a cord tying them together. When people talk about learning bash, what they are actually learning is bash plus unix utilities.
 
1 members found this post helpful.
Old 05-17-2017, 07:50 AM   #22
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,238
Blog Entries: 4

Rep: Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263Reputation: 3263
Quote:
Originally Posted by Laserbeak View Post
Pascal is the historical teaching language, but nowadays I think many people just go straight to C.
Even "Bash scripting" is, technically speaking, "programming." (It's just that the language sucks. )

Today, I think that most programmers routinely use scripting languages, because they are efficient. They resort to "C" only to do low-level stuff, which they access from the scripting language. Some programmers use Java, or Flash, both of which are compiled to an intermediate representation. (Python actually does the same thing, "on the fly.")

Some programming languages are non-procedural, such as Prolog. (If you're itching to solve Rubik's Cube, or a logic puzzle, or a Sudoku puzzle, and you don't know how to write a procedure to do that ... Prolog – especially gprolog – is your friend.)

Last edited by sundialsvcs; 05-17-2017 at 07:52 AM.
 
Old 05-17-2017, 10:26 AM   #23
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
This is why I prefer the term "coding" over "scripting" or "programming" because they are confused terms with blurred lines between them.

One thing I would note that I forgot earlier is that BASH does error handling very different to most Scripting/Programming languages. Bash will often not terminate or die on failure whereas most programming and scripting languages will die on error if there is not specific error handling in place

Code:
# cat fail.sh
#!/bin/bash
echo "works" > /tmp/works.txt
echo "does not work" > /doesnotexist/doesnotwork.txt
echo "still executes"
rm -f /tmp/works.txt
# sh fail.sh
fail.sh: line 3: /doesnotexist/doesnotwork.txt: No such file or directory
still executes
Most languages would terminate or die on trying to write to "/doesnotexist/doesnotwork.txt" but BASH continues on to the next line, a piece of behavior to be aware of. Naturally if error handling is in place (you should try to handle your own errors), then the program would continue. Depending on the language, what stops is different, in a fully multi-threaded OOP language, then it maybe only the individual thread or function that fails.

Last edited by r3sistance; 05-17-2017 at 10:29 AM.
 
Old 05-17-2017, 11:28 AM   #24
GazL
LQ Veteran
 
Registered: May 2008
Posts: 5,964

Rep: Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954Reputation: 3954
Quote:
Originally Posted by justmy2cents View Post
Im just starting to get into shell scripting and it's fun, but I hear a lot of people say that shell scripting is not programming.
To be frank, I think that's mostly just language snobbery at work. Much like the derision that BASIC tended to get from some quarters in the past. If you're having fun, then good on you, just ignore the nay-sayers.

Whether something gets called a script or program seems mostly down to common convention and little more than that:
  • sed, awk, expect, shell, perl, python: script
  • BASIC, Pascal, C, C++, Java, etc: program.

If you try and come up with some sort of hard criteria for a distinction you'll just find yourself with lots of exceptions to the rule, so best not to even try. Just have fun coding and don't worry about it.
 
1 members found this post helpful.
Old 05-17-2017, 11:40 AM   #25
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
@Jailbait
Quote:
You will learn the second language much faster than you learned the first language.
That's good to know and I hear that even more so true when learning C languages like C, ++ and C+ as their all similar..

Quote:
The one exception to this rule is when you learn your first assembly language. As dave@burn-it.co.uk described assembly is so much further from human thinking than a high level language that it just takes a long time to learn to solve problems the assembly way.
I think that's why people use a mixture of Assembly and C, because the C makes it more feasible (or something)
 
Old 05-17-2017, 11:43 AM   #26
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Talking

Quote:
Originally Posted by hydrurga View Post
To put in my 2c, I consider scripting to be programming, it's just a certain subset of programming.

One definition on the interwebs states that programming is "The process of developing and implementing various sets of instructions to enable a computer to do a certain task."

So, programming is a very generic term, ranging from the use of assembly language, through low-level and high-level languages (compiled, interpreted and the many, sometimes exotic, mixtures of the two), to educational graphical systems such as Scratch.
From what I now understand I think technically it is so too, but I think maybe people who program for a living don't feel the same way
 
Old 05-17-2017, 11:46 AM   #27
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
If you want to learn programming it's best to learn the overall purpose of object-oriented programming. Practically every language nowadays is oo. Every component of the program is an object. Objects have properties, events and methods.

Objects can use one of three ways, or any combination, to accomplish their function: sequence, selection and/or iteration. Usually, for programming, you want to use an IDE, because the IDE lays out the libraries and their objects, and tells you which properties, events and/or methods each object does.

Libraries are collections of objects you can use so everyone doesn't have to write the same code over and over. I learned programming formally, and I just don't think it's possible to program well without at least some formal instruction.
I was aware of OO languages like C but not gotten into depth of what that means (sounds kinda obvious though), so thank you that's a good explanation, and it helped me understand better. I plan to use emacs for IDE and leave vim for remote administration.. Also programming for Nurses sounds cool..

Last edited by justmy2cents; 05-17-2017 at 11:48 AM.
 
Old 05-17-2017, 11:50 AM   #28
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
There have been several references here to the number of commands you need to know. I think this is an important point. Programming languages like C have very few commands, mostly flow of control stuff like "while" or "if". Everything else is your own creation. You write functions in this limited language set, and they become commands for the main program to use. It's more about creativity and logic than learning.

In shell scripts, every command that the system recognises is available to you. The script is simply a cord tying them together. When people talk about learning bash, what they are actually learning is bash plus unix utilities.
Thank you for further clarification of the topic!

Last edited by justmy2cents; 05-17-2017 at 11:57 AM.
 
Old 05-17-2017, 11:54 AM   #29
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
Even "Bash scripting" is, technically speaking, "programming." (It's just that the language sucks. )

Today, I think that most programmers routinely use scripting languages, because they are efficient. They resort to "C" only to do low-level stuff, which they access from the scripting language. Some programmers use Java, or Flash, both of which are compiled to an intermediate representation. (Python actually does the same thing, "on the fly.")

Some programming languages are non-procedural, such as Prolog. (If you're itching to solve Rubik's Cube, or a logic puzzle, or a Sudoku puzzle, and you don't know how to write a procedure to do that ... Prolog especially gprolog is your friend.)
Ill keep that in mind about Prolog, and I wasn't aware that java and python can be used for similar use cases so thanks for bringing that to my attention..
 
Old 05-17-2017, 12:06 PM   #30
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by r3sistance View Post
This is why I prefer the term "coding" over "scripting" or "programming" because they are confused terms with blurred lines between them.

One thing I would note that I forgot earlier is that BASH does error handling very different to most Scripting/Programming languages. Bash will often not terminate or die on failure whereas most programming and scripting languages will die on error if there is not specific error handling in place

Code:
# cat fail.sh
#!/bin/bash
echo "works" > /tmp/works.txt
echo "does not work" > /doesnotexist/doesnotwork.txt
echo "still executes"
rm -f /tmp/works.txt
# sh fail.sh
fail.sh: line 3: /doesnotexist/doesnotwork.txt: No such file or directory
still executes
Most languages would terminate or die on trying to write to "/doesnotexist/doesnotwork.txt" but BASH continues on to the next line, a piece of behavior to be aware of. Naturally if error handling is in place (you should try to handle your own errors), then the program would continue. Depending on the language, what stops is different, in a fully multi-threaded OOP language, then it maybe only the individual thread or function that fails.
I know RMS doesn't prefer the term coder but actually, so idk.. Yeah though you right I do need ECCs in place for my current script im working on.. Wouldn't Rust make dealing with failing threads easier (im somewhat interested in Rust)..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: New to Programming? Check out these Outstanding Open Source Programming Books LXer Syndicated Linux News 0 01-25-2017 09:33 AM
future of programming, programming jobs, programming languages? detr Programming 17 08-01-2016 03:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:18 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