Topic: Best programming language for mostly-newbie to start with?

Hi fellow 'Bangers,

I know there are some programmery types out there amongst you, so I wanted to ask some advice regarding getting started in programming. Or really getting re-started, in a way. When I was a teenager — this was 20–25 years ago, mind! — I got quite good with Basic and wrote some fairly extensive and complex programs in it, mostly text adventure games modeled after the original "Crystal Cave" Adventure, as I was into that sort of stuff back then. Round about the time I finished high school, I thought I might want to take it further, and I took a Pascal class for one semester but gave it up after the semester was over as I found it quite frustration-inducing; in Basic I could write programs that worked and did stuff, but in Pascal all I could get was error messages and stuff not working. I then thought maybe I'd try the "serious" stuff and signed up for a C class (or it could have been a derivative like C#, I don't remember now) but I understood absolutely nothing and quit after three or four classes.

Bottom line, I gave up on anything programming related and got on with life. Now, some two decades later, I discovered Linux last year while studying for my A+ certification (I built my first desktop and needed to make it run, but couldn't afford a copy of Windows) and I'm finding my interest in programming reawakened. I've no ambition to create a new word processor or anything like that, but I would like to be able to do stuff like write custom panel applets or create GUI frontends for configuring settings, that sort of thing.

So what language would you recommend to someone like me to start with? I don't know if I should try C or one of its derivatives again, or one of the newer languages I see mentioned often like Python or Ruby, or something else (I've just recently started seeing references to a language called Lua, for example). Any advice regarding where to start as well as recommendations for good books or other resources would be very gratefully received.

Re: Best programming language for mostly-newbie to start with?

My history is similar to yours except maybe you saw the moon landing. I advise PHP. Avoid C and Java but do aspire toward Javascript, and (esp) Python.

Re: Best programming language for mostly-newbie to start with?

And there's Basic 256 which you can find in the repos.

Re: Best programming language for mostly-newbie to start with?

also freebasic (don't think it's in the repo's but it works well) I would recommend python though

I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Re: Best programming language for mostly-newbie to start with?

python simple but powerful, you already have it installed, and is used pretty extensively in opensource projects

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: Best programming language for mostly-newbie to start with?

You could probably play around with shell scripts (Bash) to make something useful and get a feeling for programming again, you can learn it in an afternoon. Ruby is also fun to play with, the interactive console is great for trying things out.

Here's how to get started with Ruby:

$ sudo aptitude install ruby irb
$ irb

Then type in:

"hello".reverse

..and see what happens. smile

Re: Best programming language for mostly-newbie to start with?

ElbertF wrote:

You could probably play around with shell scripts (Bash) to make something useful and get a feeling for programming again,

i think if i had started programming with bash i would have been put off for life, and thats coming from someone who started programming in c++

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: Best programming language for mostly-newbie to start with?

benj1 wrote:
ElbertF wrote:

You could probably play around with shell scripts (Bash) to make something useful and get a feeling for programming again,

i think if i had started programming with bash i would have been put off for life, and thats coming from someone who started programming in c++

Because bash is so much better then c++ or because it's so difficult that you would have given up on programming all together?

How can I learn about "making something useful"?  I have spent a ton of time learning the syntax and following tutorials but only because I'm fascinated by it.  Not because I have any idea what the hell I can do with the information.

Re: Best programming language for mostly-newbie to start with?

I think I am in similar position to Crunnluath. Actually never learned any language, but always wanted big_smile
Feel pulled towards python, but like skriblinmatt find the tutorials somehow 'unproductive and unsatisfying'. Maybe someone could give me a push in a good direction? And as 50 is approaching very fast, am I not too old to try new tricks?

Re: Best programming language for mostly-newbie to start with?

benj1 wrote:

i think if i had started programming with bash i would have been put off for life, and thats coming from someone who started programming in c++

I'm also curious - what is it about Bash you don't like?

I arrived from a different direction - the first "language" I learned was html ("hyper text markup language" so it is a language in theory), then css, then php. Php is an actual programming language and quite powerful, though really focussed on web design. I had fun with it though (let me show off my sudoku solver smile ). Coming to Linux and shell scripts, Bash looked quite ugly at first, but when you get used to it it's fun because it's close to your operating system. Any commands you can run in a terminal you can put in a script, so it's easy to do simple things and gradually build up. Debugging is easy too because you can try out bits of code in a terminal, so I'd go along with the recommendation to try Bash, unless it gives you bad habits which work against you on the other languages which I don't know...

Now I'm trying to get motivated up to try Python, but at the moment Bash seems to cover my needs. Can any Python users suggest some cool/fun/useful things you can do with Python that would be hard with Bash?

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Best programming language for mostly-newbie to start with?

I have found the transition from Bash to Python quite hard. You get into habits with Bash that probably won't transfer well  to Python.

However, both have their uses. If you want to create simple programs, maybe things with user input, then you could try Bash with zenity. It is fairly straightforward. What I love about Bash is that you can take any system command and pipe it's output into something else. It's fairly simple and quite powerful. You probably aren't going to be creating games in Bash, but simple system utilities or scripts to automate or combine processes. A good example of a Bash script that you use everyday is the Openbox autostart.sh script - it simply starts applications when Openbox starts, but you could extend it to run other tasks as well.

Now I am trying to get into GUI programming, specifically GTK2.0+. I am doing this in Python. There's a few good tutorials and some dreadful tutorials. I tend to throw myself at the problem that I need solving, rather than learn the underpinning basics first, so now I have a fairly good understanding of pyGTK, but not so much straight Python. I am going to buy a good Python book and start at the beginning some day!

For me I would go with a scripting language like Bash or Python because, unlike C, you don't have to compile. You can knock it up in any text editor and run the resultant file. You can also test Python commands in a terminal first.

Be aware that if you get into GTK, there is slightly different syntax in Python, C, Ruby, PHP etc...

Re: Best programming language for mostly-newbie to start with?

Crunnluath wrote:

Hi fellow 'Bangers,
<snip>
Bottom line, I gave up on anything programming related and got on with life. Now, some two decades later, I discovered Linux last year while studying for my A+ certification (I built my first desktop and needed to make it run, but couldn't afford a copy of Windows) and I'm finding my interest in programming reawakened. I've no ambition to create a new word processor or anything like that, but I would like to be able to do stuff like write custom panel applets or create GUI frontends for configuring settings, that sort of thing.

So what language would you recommend to someone like me to start with?
<snip>

Somewhat similar story (but older: moon landing, Fortran etc) and I asked an old school mate of my brother's and was recommended to go for Python (and PyQt). I can recommend Python too. I have had some fun as a Python newbie. I bought a couple of books before I found the one that really works for me: "Core Python Programming" by Wesley J. Chun.

It was meant as a brain teaser, spare time thing but once I got going with Python I found it pretty useful at work.

Good luck,

/Martin

Re: Best programming language for mostly-newbie to start with?

@ skriblinmatt and johnraff

I'm not against bash per se, I still use it and for some tasks it's the best tool for the job, but when you attempt to write anything bigger than 20 lines long you just start finding annoyances, eg do i need single brackets, double brackets, square brackets or double square brackets here?.
then there's the functions:

function foo ()

what do those brackets do?
or

if (something that may or may not require single brackets); then; bar; fi

will give you errors, not only because you haven't put spaces between the brackets and the test but also because there's a semicolon after the 'then' even though it doesn't require a backslash to indicate a statement over multiple lines which would be consistent with the rest of bash, but then thats the problem, lack of consistency, with any other language you aren't caught out by some obscure syntax rules, c++ is large, awkward and complex but it is at least consistent.

I'm not saying that c++ is the best language to learn for a newbie, ive spent hours trying to work out why a pointer wouldn't work only to realise it was something simple I hadn't understood, if I had spent hours trying to work something out and the problem was a crap and inconsistent language I would probably have walked away.

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: Best programming language for mostly-newbie to start with?

I would suggest writing a few Bash scripts to get a feel for what can be launched, from where, and how:
http://tldp.org/LDP/Bash-Beginners-Guid … index.html

Then maybe Python as it is straighforward and has a whole heap of online documentation:
http://wiki.python.org/moin/BeginnersGuide

Then for Guis and Applets etc, I would recommend Lua and Ruby for simplicity. I worked with nelsongs and andrefelipe on the Dreamlinux distro and they produced some awesome guis with Lua and Ruby.

I've recently gotten into Perl at work, and it is absolutely awesome, you can even write Guis with it, although IMHO it's main power is in searching for information and putting the findings to use. I use it for networking tasks

Everybody has their favourite language, you just need to use the one that achieves what you want quickly. For example, I won't write a complicated Perl script if a simple Bash script will do the job.

Re: Best programming language for mostly-newbie to start with?

benj1 wrote:

a crap and inconsistent language

I think you're being a little bit hard on bash here. smile Let's not say inconsistent so much as consistent with a very complicated set of rules, some of which are probably to ensure backward compatibility for scripts written in bygone days...

function foo ()

what do those brackets do?

They're optional. It's in the manual. smile I usually use

foo ()

because it's supposed to be more portable.

if (something that may or may not require single brackets); then; bar; fi

will give you errors, not only because you haven't put spaces between the brackets and the test but also because there's a semicolon after the 'then' even though it doesn't require a backslash to indicate a statement over multiple lines which would be consistent with the rest of bash

The bash manual says any number of newlines can be inserted between commands in a list. I'll be honest here: I'm not 100% clear how it's OK for the reserved word "then" to be followed by a newline. roll

OK, but for beginners who already need to learn the command line anyway, the fact they can just plug those commands into a script must be a plus. Anyway - does anyone learn a new language by reading the manual and writing programmes from scratch? Maybe some, but my way has always been to copy someone else's working code and gradually modify it to do what I want. Eventually you get the idea, and that's the time to start reading up the documentation...

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Best programming language for mostly-newbie to start with?

johnraff wrote:
benj1 wrote:

a crap and inconsistent language

I think you're being a little bit hard on bash here. smile Let's not say inconsistent so much as consistent with a very complicated set of rules, some of which are probably to ensure backward compatibility for scripts written in bygone days...

You probably hit the nail on the head here, along with being designed to be used primarily as an interactive shell.
I probably was a little harsh aswell, I just went on a little bit of a rant roll

The bash manual says any number of newlines can be inserted between commands in a list. I'll be honest here: I'm not 100% clear how it's OK for the reserved word "then" to be followed by a newline.

I don't have an issue with 'then' being followed by a newline, but when you concantate it onto one line it should require a semicolon instead.

OK, but for beginners who already need to learn the command line anyway, the fact they can just plug those commands into a script must be a plus. Anyway - does anyone learn a new language by reading the manual and writing programmes from scratch? Maybe some, but my way has always been to copy someone else's working code and gradually modify it to do what I want. Eventually you get the idea, and that's the time to start reading up the documentation...

I agree its useful as an extension to commandline usage, thats why I mentioned the < 20 line exception, it tends to be in larger scripts that you fall over yourself.
your second point would probably support my point of view more than yours, looking at some one elses code, you ay think you undertand how some thing works until you modify it and get a really helpful bash error message, whereas the manual should point out bashs 'limitations'.
The fact remains tho, when I use python (I moved on from c++) I very rarely (never?) trip over the language, just my problem solving skills, which in my opinion is the way it should be (not that my opinion, very much like my problem solving skills, is worth very much wink).

Re brackets
Yes they are optional (if you use the 'function' declaration), my issue is that it suggests function arguments, as with any other language, but you don't need them because arguments are accessed with $0, $1 etc so they're just syntactic sugar (that I instinctively want to put argument declarations in to).

Anyway I'm going to shut up now, I'm getting all ranty again mad

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: Best programming language for mostly-newbie to start with?

benj1 wrote:
johnraff wrote:

The bash manual says any number of newlines can be inserted between commands in a list. I'll be honest here: I'm not 100% clear how it's OK for the reserved word "then" to be followed by a newline.

I don't have an issue with 'then' being followed by a newline, but when you concantate it onto one line it should require a semicolon instead.

Agreed. I haven't found anywhere that explains why a newline is OK there but not a semicolon. The same applies to 'do commands; done' in a loop. 'do' can be followed by a newline but not a semicolon. (???)

The fact remains tho, when I use python (I moved on from c++) I very rarely (never?) trip over the language, just my problem solving skills, which in my opinion is the way it should be

Yeah I really need to get down to learning some python. Every time I find some new feature of bash ( bash 4 in Statler supports associative arrays big_smile ) it lets me put it off a bit more... roll

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Best programming language for mostly-newbie to start with?

johnraff wrote:

Yeah I really need to get down to learning some python. Every time I find some new feature of bash ( bash 4 in Statler supports associative arrays big_smile ) it lets me put it off a bit more... roll

go for it (especially if you only know bash), I didn't find it hard to pick up, just try writing your next project with this open in a browser tab.

- - - - - - - - Wiki Pages - - - - - - -
#! install guide           *autostart programs, modify the menu & keybindings
configuring Conky       *installing scripts

Re: Best programming language for mostly-newbie to start with?

benj1 wrote:
johnraff wrote:

Yeah I really need to get down to learning some python.

go for it (especially if you only know bash)

(and php)

try this

Thanks! That looks just the job smile

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."