PDA

View Full Version : Programming - Where to start?


ex_matelot
17th Dec 2011, 13:03
I'd like to start learning programming. My current knowledge is zero. My aims are to self teach with a view to possibly take a course and obtain a qual later on in order to add another string to my bow.
I have a "Python programming for the absolute beginner" book which I have been given. i'm also tinkering with Linux but have never got beyond having it as a "novelty different OS" on a spare laptop.

Realistically, what is the best approach for me to learning something relevant, I don't want to end up barking up the wrong tree and learn something virtually obsolete. C+, C++, Java etc mean little to me at the moment apart from I know "it's going on in the background".
Advice appreciated, Thanks.

green granite
17th Dec 2011, 13:45
Other than reading books which is quite useful, the only real way to learn is to set yourself projects, starting with a simple one such as finding the square root of an number and then getting longer and more complicated.

ex_matelot
17th Dec 2011, 14:14
yes, I figured that approach would be best but - to use an analogy... If say Arabic was THE language to learn - do I go about learning French first or jump straight in? Crap analogy and wrong I know but - where to start in terms of programming language? What to aim for?
I realise I have to learn the fundamentals of all - the grammar as it were but - is it realistic for a 35 year old to self learn a programming language and possibly be able to expand on it and even...make some money from it?

What sort of timescale is it, on average, to learn or undergo something like this and come out at the other end knowing something "useful"?

Very vague and subjective I know, my apologies.

green granite
17th Dec 2011, 14:26
It really depends what you want to program, but my suggestion would be learn BASIC first then go onto C when you feel confident, but then I stopped programming 20 years ago apart from the occasional PIC.

No doubt someone else will have more up to date ideas.

Spurlash2
17th Dec 2011, 14:37
You might like to give Small Basic (http://www.microsoft.com/download/en/details.aspx?id=22961)a go.

A simplified programming language and environment to help teach programming to beginners.

PS Make sure you download the 'Introducing Small Basic', as well.

Mike-Bracknell
17th Dec 2011, 14:51
I wouldn't choose Basic and then go to C. It's like learning Esperanto and then expecting it to help you learn Swahili.

Go straight to C for a decent computing language that's not obsolete, you can then adapt the proper programming constructs from there to other languages.

Buy this book: http://www.amazon.co.uk/C-Programming-Language-2nd/dp/0131103628

(RIP Dennis)

dazdaz1
17th Dec 2011, 15:08
Years ago I worked with COBOL the code is a lot easier to follow than 'basic' poking this and poking that and a lot better (my opinion) than PASCAL were 'functions' always got me lost. The COBOL language I was familiar with was COBOL INS 73 Yes, very long in the tooth.

I presume COBAL has been updated (is it still used?) it was mainly used in the banking sector/company goods stock level updates. Used to read and update large file records. Back in the early eighties I believe the cost for the 'compiler' written code to machine language, cost hundreds of pounds.

Which ever programming language you decide on check out 'top down design' and be aware (as basic) too many 'go to' is very naughty and makes following the code most trying.

Daz

mixture
17th Dec 2011, 15:10
I'd like to start learning programming.

Unless I've missed it, there's one important question everyone here seems to have missed asking ex_matelot.

For what ?


What is your ultimate end goal ? Programming as in writing software for computers ? Programming as in web development ? Something else ?

Writing for embedded systems or for computers/servers ?

If in doubt... go C/C++.... always easier to start low and work your way to higher level scripting languages than the other way around.

However it's pointless, for example, learning C++, if all you want to really do is code dynamic websites properly.

If it's software for computers, then forget BASIC ... that's of limited use. Get your teeth into C/C++ and it will serve you well, as it's high-level enough to be comprehensible, whilst low-level enough to offer powerful features and be fast.

If web coding look at scripting languages such as Perl or PHP. I would suggest staying away from newer languages such as Ruby etc. as they are less mature and a bit fluffy.

Whichever language you choose, try to pick one that's Object Orientated (e.g. pick C++ over C) That will teach you to be disciplined in your programming and not just throw together spaghetti code.

Finally, whichever language you choose, make sure you learn correctly the first time round. Don't start with bad habits as they are hard to shake off... there's so much nasty spaghetti code out there. So stay away from, for example, those learn X in 7 / 21 whatever days books !

Saab Dastard
17th Dec 2011, 15:32
Distinguish between learning programming and learning a programming language.

The latter is a specific way of implementing a solution identified in the former.

The three steps (extremely simplified) are:

1) understand the problem
2) construct a solution (and map it out in a "pseudo code")
3) implement the solution in your chosen programming language - if necessary, learning it!

SD

ex_matelot
17th Dec 2011, 15:36
Mixture,

Good question! ...

I don't know actually. If I were to take a wild leap I'd say - something that could make me useful to an employer. Or even something to be proud of being able to do.
I'm just looking for something else to "hobbyise" with the distant hope that it may come in handy one day. Adding more strings to my bow is the best I can come up with. 35 yr old, was 14 yrs RN. Have a full time job, PPl but no hope of caa class 1....Just want to broaden my horizons and keep my mind active.

BOAC
17th Dec 2011, 17:38
Hello World? Well, everyone seems to................

I would firmly endorse Saab's steps 1 and 2. After those you may choose not to try 3:)

All a 'computer programme' does is apply logic steps via a series of 1's and 0' to achieve a result. I would suggest you get to grips with Logic Flow Charts as a first step. There are thousands of links to learning these. Here is one. Follow GG's advice with a chosen simple 'programme' and then try a more complex one with a few 'Yes'/'No'/'If' loops etc.

Flowcharting (http://www.nos.org/htm/basic2.htm)

ex_matelot
17th Dec 2011, 18:33
I will take this advice, thankyou all..

mixture
17th Dec 2011, 19:09
ex_matelot,

Given what you've said, I would strongly suggest C/C++.

Reason being that the open source community gives you a suitable starting "employer" to put your coding knowledge to work (e.g. contributing towards the code behind Firefox, Ubuntu or whatever you have a fondness for). Because of the nature of opensource, it's a more friendly and less demanding atmosphere than taking your first job in the commercial coding sector.

Then as your experience and confidence grows, you can start looking at going for commercial jobs with real word employers.

Plus the other reasons for C/C++ I've given in my previous post (e.g. better to start in a low-ish level coding language as it's always easier to migrate to easier higher level languages than the other way around ).

bnt
17th Dec 2011, 20:27
I agree with learning C++ if you want to get a good handle on programming. My only warning would be that debugging programs can be hairy - error message tend to tell you the last thing that failed, but that's not always where the problem starts. A good website to help you is cplusplus.com - The C++ Resources Network (http://www.cplusplus.com/)

If you're going to do any GUI programming I'd also recommend looking at GTK (http://www.gtk.org/) later - a cross-platform toolkit for developing GUI applications. This is what is used to develop the GNOME system on Linux, for example, as well as many Windows applications. There's a GUI builder called Glade.

under_exposed
18th Dec 2011, 10:05
Get a copy of The C Programming Language by Brian W. Kernighan, Dennis M. Ritchie. It will give you the basics of programming.
If you are still interested after that c# allows you to quickly develop applications.
Your biggest problem will be thinking up what you what you want to write.
If you want to do it professionally you will face an uphill struggle. Those companies who have not shipped their development to India will want people with experience. Most commercial applications will be connected to a database so SQL would be worth learning.
I learnt basic at collage, got a summer job doing compiled basic for a few weeks and then they lent me the above book to learn C. After polytechnic I joined them as a C programmer. A few job changes and I covered Visual basic, C#, T/SQL, PL/SQL, java (almost the same as C), various "it writes the code for you" systems (normally to replace them with proper programming languages to get a usable system).
I have been programming for nearly 25 years and absolutely love it. I look forward to going to work!

#include <stdio.h>

int main()
{
printf("Good Luck");
return(0);
}

ex_matelot
18th Dec 2011, 10:19
Thanks everyone.

Starting from scratch: Should i start on Python with the book I already have or should I start on C?

I figure the python option will at least give me a grounding in the "grammar" of programming.

under_exposed
18th Dec 2011, 10:30
There is probably a reason why they wrote python in C, but of course I am biased.
You may find this (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html) usefull in deciding.

Gertrude the Wombat
18th Dec 2011, 11:27
There is of course a difference between "programming", being what you need to be able to play around doing interesting things for yourself, which you probably can learn from books and web sites, and "software engineering", which is what you need to get a job, which you can't. What's needed for that, after you've got the degree or whatever, is on-the-job training from somebody competent, and, of course, in time honoured fashion, you can't get the job until you've had the on-the-job training.

Having said which, there are an awful lot of people out there earning a living from programming who don't have the remotest clue what they're doing. Ah well, whilst clearing up the messes they leave behind isn't always fun it is always profitable.

bnt
18th Dec 2011, 12:04
There is probably a reason why they wrote python in C, but of course I am biased.
You may find this (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html) usefull in deciding.
One note about the stats on that site: the reason for the fast rise of Objective C in the rankings is that that's the language used for iPhone & iPad Apps, in conjunction with Apple's COCOA API (application programming interface). I've never used it, but since it is based on C, I probably could. You could say it competes with C++ in providing object-oriented programming to C.

mixture
18th Dec 2011, 12:12
ex matelot,

I figure the python option will at least give me a grounding in the "grammar" of programming.

Up to you really as to how much time you want to put into it.

Being a high-level language, and therefore providing a great deal of abstraction over what's actually going on behind the scenes, a scripting language such as Python will certainly enable you to hit the ground running and make swift progress in your learning.

C/C++ are lower level. They abstract the hardware level somewhat, but leave a lot of the rest of the power in developers hands. As others have pointed out, high-level languages such as Python, PHP and Perl are all written in C.

The other important thing to bear in mind is that if you start off in a high-level language, you're going to find it tough going to wrap your head around lower level concepts at a later date, because you would have got used to the way high-level languages babysit you and hold your hands.

Then again, learning C/C++ is tough going at first. So you may run the risk of being alienated and running away from programming altogether if you're not prepared to persevere. So it may be potentially wiser to go for a higher-level language depending on your character.

But in the end, it's up to you. I guess the fact you've already got a Python book may be somewhat of a deciding factor !

Gertrude the Wombat
18th Dec 2011, 12:35
Whichever language you choose, try to pick one that's Object Orientated (e.g. pick C++ over C) That will teach you to be disciplined in your programming and not just throw together spaghetti code.
Not true. You can choose to be disciplined in any language, and, as has been demonstrated again and again and again over the decades, "you can write FORTRAN in any language".

Mac the Knife
18th Dec 2011, 13:12
Simple concepts first, string variables, integer variables, floating-point variables, initialising and assigning.
Naming conventions
Documenting code
Working with numeric variables, addition, subtraction, multiplication.
String variables, assigning, parsing, extracting.
Simple and complex arrays - constructing, initialising, working with, voiding.
Constructs - loops and exits, conditional exits,
Subroutines
etc etc.

Start by writing a very simple program;
assign a string variable and get input (What is your name) and print result
Now make it more selective, reject non-alphanumeric characters with a meaningful error message.
Make it more selective, reject integers in the string with errormessage
Now force it to lowercase
Now capitalise the initial letter
Now set up arrays of common boys and girls first names and compare the input to these - if found, say "Hi John, that is a boys name, I'm guessing that you are a boy?" Y/N
Set up the Y/N question - accept either Y or y or N or n
Get birthday, reject garbage, reject ages >100 or <5 (say) - date manipulation and parsing.
and so on and and on
Deallocate all variables when you're done

Writing a simple (actually not so simple) input module like this will teach you all about the basic constructs of programming which are pretty much the same whatever language you use and how to sanitize and validate input.
One of the dialects of BASIC is the easiest way to start (though you could use Smalltalk or Prolog or Pascal or Python (my favourite) or anything (I wouldn't start with C/C++).

It'll take you a couple of weeks before you have an elegant, minimal, fast, well-written, procedural, well-commented and fully debugged little module.

THAT (not trying to produce a Web-page) is the way to start.

:ok:

Mac

mixture
18th Dec 2011, 15:59
Not true. You can choose to be disciplined in any language, and, as has been demonstrated again and again and again over the decades, "you can write FORTRAN in any language".

Maybe... but it is hard to argue against the many benefits of a true object orientated language.

Mac the Knife
18th Dec 2011, 16:32
"Not true. You can choose to be disciplined in any language, and, as has been demonstrated again and again and again over the decades, "you can write FORTRAN in any language".

Going to agree with Gertrude there.

Try the exercise of writing an input module that I suggested above - you can, indeed you should be able to do this in a completely modular ("object orientated") fashion.

Some of us were writing Oo code long before it became a buzzword.

:ok: Mac

PS: Wrote a lot in DBase III language in the old days - a lovely and infinitely flexible dialect.

ex_matelot
18th Dec 2011, 16:48
Thanks everyone.
A few years ago I asked someone on here (can't remember who) how to create 1000 files numbered sequentially. They posted a script they had made specifically for my requirements.
That is my goal, I think- to be able to do something like that.

Gertrude the Wombat
18th Dec 2011, 17:09
it is hard to argue against the many benefits of a true object orientated language
Agreed, for the right task - programming languages are like aeroplanes, you choose the right one to suit the current mission.

I personally would prefer not to hire any programmer to write any language if they have never done any assembler. I don't expect them to be current at writing the stuff, just a few weeks at university twenty years ago is fine, the point is that people who don't know how a computer works can't always understand why given two similar looking lines of code in a moderm high level language one of them runs a million times slower than the other one.

But then I personally would prefer not to hire any programmer without some sort of typing qualification. The ones who can type properly are much more likely to write decent documentation and comments than the ones who have to look at the keyboard and/or only use a few fingers.

I generally fail to get people to take me seriously on these two points :{:{:{

Mac the Knife
18th Dec 2011, 17:52
"A few years ago I asked someone on here (can't remember who) how to create 1000 files numbered sequentially. They posted a script they had made specifically for my requirements. That is my goal, I think- to be able to do something like that"

I wrote your script. I could do it because I learned how to program (painfully) by writing a fairly complicated Sinclair BASIC application (complete with assembler for horizontal scrolling of a section of the screen) to interface in quasi real-time with a laser-doppler flowmeter using a DA/AD converter.

This was a highly modular program (I will confess to a single GOTO) in which the main loop really did nothing but call modules (as it should) with a lot of module reuse.

OO hadn't been invented yet and when I started I knew very little, but writing an OO type program just seemed "right" and elegant.

I could write your script (though I was rusty!) in DOS batch language (which is a very simple programming language) because I'd learned the basic principles of program flow and control (and validation!) years ago (and also had learned some of the tricks/peculiarities that every programming language has).

You learn to program by programming, just as you learn to fly by flying....

Here's the script.....

http://www.pprune.org/computer-internet-issues-troubleshooting/407976-need-help-creating-file-system.html
right at the end for the final version

:ok: Mac

PS: Looking at this now is horrible as I can see several ways of making it neater and cleaner but it was a quick and dirty solution to the problem...

Mr Optimistic
18th Dec 2011, 18:38
ex-matelot, maybe go to a computer IT agency and see what the job adverts are looking for ? I started with Fortran 66 (kind of a pre-Airbus type of thing compared to modern autocode generators). Once common blocks were banished all the fun left it.

Gomrath
18th Dec 2011, 20:39
Take it for what it is worth but I would suggest that you take a look at Microsoft Visual Studio Express as a Development environment (it is free from Microsoft) and start to play around with C#. It actually comes with Visual Basic, C++ and Web Developer all bundled in.
It is generally a little easier than C and C++ and the IDE helps to guide you along the way.

You can start off with simple applications and then move to the "GUI" WIndows based applications.

Visual Studio 2010 Express ISO Images | Microsoft Visual Studio (http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express-iso)

Gertrude the Wombat
18th Dec 2011, 23:00
Once common blocks were banished all the fun left it.
Like I said, you can write FORTRAN in any language. Here's a common block in C:

struct common
{
int i;
char c;
etc ... etc ...
};

then declare a variable of this type, define it in one module and extern it in the others.

cdtaylor_nats
19th Dec 2011, 08:05
I would start by deciding which languages you can get free compilers for.

The best way to learn coding is to read code, then try writing some.

One of the simplest languages to learn is Pascal.

Gomrath
20th Dec 2011, 19:44
I would start by deciding which languages you can get free compilers for.

Erm... did I not already mentions Microsoft Visual Studio Express -complete with VB, C++, C# and Web Express


One of the simplest languages to learn is Pascal.

and also one that is unlikely to get him into any employment any time soon...

Mr Optimistic
20th Dec 2011, 22:07
Information Technology Programmer Programmers job search - PlanetRecruit (http://www.planetrecruit.com/search.cgi?ls=long&so=&keywords=Programmers&location=&radius=1600&contract_all=1&cat=23&ro=603&l=&e=year&a=31&searchButton=Search+jobs&wt.mc_id=NLC_PR_201211_prog1)

A A Gruntpuddock
21st Dec 2011, 02:47
The question is really 'what sort of programs do you want to write?'. If you have no interest in an application you will struggle to program it.

I once chatted to a professional programmer (my dream job at that time) and was amazed that he was trying to get out of the field. It turned out he was spending all his time programming electronic scales and found it soul destroying!

As an amateur programmer most of my programs were started because I wanted to get a computer to do something specific. I have written programs in Fortran, Basic, NXT-G NXC and Excel keystroke macros because they were what I had available at the time. Once you have written something in one language, it is easier to understand (and pick up) other languages.

If you you have a specific interest then search the 'net to see what language others are using in that field. For instance, if you are interested in robots then look at the LEGO NXT programming languages and so on.

If you you have a specific interest then search the 'net to see what language others are using in that field.

Looking at programs which do the sort of things you want can be very helpful because you already know what you need to do and can see how others have organised it.

Have you checked local colleges? Many offer part time or distance learning foundation courses in programming without getting too involved in a specific language.

green granite
21st Dec 2011, 07:34
There is of course the argument that if you really want to understand programming you should start by learning to program in assembler

rh200
21st Dec 2011, 08:33
If you want to do amatuer type work BASIC, lots of stuff around on the web to help out, though mainly windows.

If you want real performance, then C, lots of good stuff to learn from the web and good compilers on Linux.

Good all purpose general stuff seems to be Python, again lots of stuff on the web and good support in Linux.

I don't use Python myself, I'm half stuck in C/perl/(gdl/IDL) land and not good at either one of them. But in general I use C for all my performance type programs and perl for utilities. If starting now, knowing what I do, I would skip Perl and go straight to Python.

green granite
21st Dec 2011, 09:00
If you want real performance, then C,

If you want real performance you use Machine code for the absolute fastest or Assembler as second fastest executing code :E

Mr Optimistic
21st Dec 2011, 10:28
Assembler is for sissies, you want to try booting a 24 bit machine using just front-panel switches: ah how we came to love mylar tape or whatever it was. Good old Ferranti.

Cacophonix
21st Dec 2011, 10:40
I was always a real fan of LISP. Clearly a rather specialist language (AI etc). but very elegant if used properly in parsing text etc.

Weirdest and yet strangely effective business programming language I have used was RPG II (indicator hell). The later variants III and IV were also very effective for throwing together a business application and benefited from the fact that they part of the AS400 (i-Series) which demonstrated an advanced architecture and database (still does).

Anybody remember the old BBC micro and built in 6502 assembler. Wrote many a lab interface between the BBC and a variety of more modern machines because of the easy use of the assembler and the accessible UART. The ubiquitous Zilog 80 chip and assembler was also very good for interfacing with all sortS of kit.

Aah happy daze!

Whatever programming that gets done these days is done in C# or C++.

Agree with Gertrude about the OO paradigm.

Caco

rh200
21st Dec 2011, 22:30
If you want real performance you use Machine code for the absolute fastest or Assembler as second fastest executing code

If you could make up a multi-threaded correlator and send it to me then I would be forever in your debt:p

Mac the Knife
22nd Dec 2011, 05:00
Start here - Computer Programming Fundamentals: Basic Concepts of All Programming Computer Languages | Suite101.com (http://peter-jorgensen.suite101.com/computer-programming-fundamentals-a62400)

Download QBasic from http://www.petesqbsite.com/sections/introduction/qbasic11.zip

Read the Intro - http://www.petesqbsite.com/sections/introduction/intro.shtml - and go on from there. Write programs and learn the basics

Sheesh - you guys want to make it so complicated!

Mac

Assembler my foot!

Mr Optimistic
22nd Dec 2011, 11:10
Sheesh - you guys want to make it so complicated!

If I was useful do you think I would be sitting here posting in this forum ?

Assembler my foot!

Ah, a new one, see

http://www.pprune.org/jet-blast/472152-traditional-sayings.html

Gomrath
22nd Dec 2011, 21:41
For that reason, I'd recommend using MS Windows, with whatever version of MS Visual Studio (VS) you can get hold of. That will give you options of using C/C++/VB/C-Sharp etc. More importantly, in the non-free versions, you get the best integrated editing/debugging/integrated help system on the market.
Already suggested :ugh: The Express Editions are perfect for him. Why go spending a significant amount of money on the full blown suite of Visual Studio which for him as a newbie really gives him nothing extra that he would need to put that first toe in the water... He is hardly going to have a MSDN license is he..

Get Visual Studio (the free version is rather limited)
No it is not. It is perfect for his first foray into programming.

MG23
23rd Dec 2011, 03:07
If you want real performance you use Machine code for the absolute fastest or Assembler as second fastest executing code :E

These days a compiler is likely to produce better code than an average assembler programmer unless you can use special instructions that the compiler won't generate (e.g. AES-NI). Otherwise there are so many different special cases for instruction scheduling that the compiler is more likely to get it right than a programmer who hasn't invested the time to learn about them.

More on topic, I'd agree with the others who've suggested downloading the free versions of Visual Studio; I haven't used them in a few years, but the older versions did just about everything that I needed to on Windows. For more arcane languages, Linux probably has a free compiler.

Right now Java and C# seem to be the big languages for PC development, with C++ declining. All three are fairly similar, but C++ is far more verbose and slower to compile... the upside is better performance when the program is running, but PCs are so fast these days that often you won't even notice.

osmosis
23rd Dec 2011, 05:09
In another life I found some SIGS, special interest groups, in various areas of computing in the 1990's. They were a little hard to find and were almost underground but they were thriving if you could find them. Interestingly, their members were nearly all mature age folk who had found where they wanted to be with their interests. From these groups, you will find a path. Further, short courses at technical colleges may be of interest, was for me.

bnt
8th Jan 2012, 09:23
Just to bring this up - there's new service designed to get people programming step-by-step, starting from scratch. They say they'll send a weekly email with lessons, tips etc. Code Year (http://codeyear.com/)

jcbmack
1st Aug 2012, 23:51
If you want to employ OOP go with java:ok: