Want to learn programming properly

Associate
Joined
5 Jul 2012
Posts
279
Just wondering if anyone could point me in the right direction about this.

I've done abit of programming before, bit of html with limited javascript for a simple website and some python (although I didn't really like it) and then I tied a bit of c# but I found it difficult to work around the visual forms coding so my code was pretty fragemnted.

I'm thinking on trying c++ , I had like an intro class on it over the summer at an engineering / computer science experience day and seemed to understand most of it, although I know a bit about arrays I don't really know how to use them.

Would C++ be a good language and has anyone got any good tutorials / series for it or any other suggestions?
 
Associate
Joined
6 Sep 2005
Posts
459
Location
West Sussex
C++ would be absolutely fine as a starting language. If you have done programming before then the book "Accelerated C++" would be an ideal companion otherwise try "Deitel: C++ How to Program". From here it can be an easy transition to both Java and C# as the syntax is very similar to that of C++.

If you are struggling with fragmented code as you mentioned you may want to look into object oriented analysis and design (Larman book perhaps) as the many design/code patterns will help you structure your code more efficiently. Forget procedural languages completely, and I don't recommend learning Python concurrently with the C-esque languages mentioned earlier.
 
Soldato
Joined
19 Jun 2009
Posts
3,871
It depends if your learning to program just to write simple programs, or wish to build some actual applications.

If your writing basic console applications just to learn fundamentals then maybe start with C++. However if your building real windows apps I would avoid C++ as a beginners language. The reason being to program C++ in windows you'll get involved in Microsoft Foundation Classes, and ATL this is far to much for a beginner. If your building actual apps that can do something your far better starting with C# or Java.

C++ is a language that's evolved over 40years and contains contradictions, it's not a pure OO language as it contains C functionality with OO bolted on, think of C++ as the English language that contains Latin, German etc! Java and C# are from a clean sheet but there fundamentals are based on C++.

If you are going to learn C++ this set of videos is excellent. This is the first of the lectures, there is I think 9 videos in total and you need to google the rest.

These videos start real real simple, but they get into pointers, memory management and OO eventually.

http://www.youtube.com/watch?v=CzWZYwOvrcE&list=PLB6053C17AB31C6CF&index=2&feature=plpp_video
 
Last edited:
Associate
Joined
18 Dec 2010
Posts
715
It is probably easier to learn Java or C# first then just retrofit back to C++ with its idiosyncracies as needed (don't get me wrong, C++ is very much a foundation of current software development, but it also feels a lot like a bunch of square pegs in round holes to learn and use - especially if you get sucked into frameworks like MFC or COM/CORBA for example).

The languages bare similar enough resemblances in use that what you learn in one will have some translation over to the other languages in the 'family', but start off with memory being managed for you so you can focus on the other stuff rather than chasing your tail, and that will likely be more productive, just beware of any vendor (MS or Sun/Oracle) trying to pigeon-hole you into 'their' way of doing things as being the 'right(eous)' way.

Python I can't take any more seriously (as a long term pursuit or benefit) than any other web/CGI language, in terms of a skill that is as readily transferrable as the other languages, but seems OK as a bit on the side.

You say you've tried a bit of C# and done an intro in C++, that's good, but to really cement things and get the ball rolling (properly), you need to put it into practice and build familiarity, even if it's creating noddy or trivial solutions to satisfy your curiousity or fulfil menial tasks for you. It's not enough to do a short session/course in them to then have any expectations or decisions made.
 
Last edited:
Associate
Joined
25 Dec 2005
Posts
58
Location
Nottingham
In my humble opinion (and not just because I’m a C# developer) i would start with C#.NET. You can get to grips with the basics of OO programing, and the basics of programming in general i.e. reference and value types, structs and objects, inheritance and polymorphism without having to worry about things like garbage collection and pointers (bloody pointers).

Then you can move onto C++... it all depends really on what sort of thing you want to create.
 
Caporegime
Joined
18 Oct 2002
Posts
32,618
It is much easier to learn java or C# from a solid C++ background than the inverse (you will likely end up with hideous memory leaves and get yourself hurt badly).

For that Reason i would start the standard way with some classic C, then C++ but quickly start looking at languages like python, Haskell etc. to see what differences these bring, and then learn java or C# if need be.

Java and c# tends to deeply divide people and software companies, so I wouldn't recommend learning only 1 and would focus on getting a solid C++ core.
We have interviewed many candidates who started learning in C# or Java - invariably they have been hopeless at using C++, which is our mainstay language (with some Python and Matlab)



However, more important than what language you use is developing a keen understanding of data structures, algorithms, complexity, CPU + mem architecture, compiler design etc. You should be able to quickly learn new and different languages, picking the best one for the job at hand. A language is just a tool, use the best tool for the job. knowing a particular language is one of the smallest parts of being a developer.
 
Last edited:
Associate
OP
Joined
5 Jul 2012
Posts
279
Thanks guys, I was thinking about maybe working towards making an onscreen calculator with gui as something to sort of focus on as I learning, nothing too complex just like ms calc with a few extra functions.

Maybe start with C and just program it into a command line app and then move onto C++ and add a gui with Visual C++?
 
Associate
Joined
29 Aug 2012
Posts
174
Maybe start with C and just program it into a command line app and then move onto C++ and add a gui with Visual C++?


That might be a fun way to do it. There are a few algorithms and techniques you will have to learn to do even a simple calculator (reverse polish notation and recursion come to mind -- even though you could do it without recursion, it's worth doing it the recursive way first as it's incredibly intuitive -- as many recursive solutions are). While you're implementing it you're learning C, and that will be directly transferable to C++.

Edit:
Another thing that a lot of programs use heavily is date/time manipulation. Yes, these days there are libraries that do it for you, but that's no fun (not when learning anyway). Some suggestions

* Write a function to determine if a year is a leap year
* Write a program to calculate the difference (in days) between two input dates
* Write a function to calculate the date of Easter for a given year
* Write a function to determine if a given date is valid

Some of these are not as easy as they seem... (especially the second).

Edit #2:

Once you've written the above functions (and I know they seem boring, but they probably are challenging and that == fun) maybe you could write an implementation of this:

http://unixhelp.ed.ac.uk/CGI/man-cgi?cal
 
Last edited:
Caporegime
Joined
18 Oct 2002
Posts
32,618
Thanks guys, I was thinking about maybe working towards making an onscreen calculator with gui as something to sort of focus on as I learning, nothing too complex just like ms calc with a few extra functions.

Maybe start with C and just program it into a command line app and then move onto C++ and add a gui with Visual C++?

I would leave anything GUI related until a little later, GUIs are highly dependent on languages , OS libraries etc. The basis of making a GUI function is also very easy (e.g. making menus, drop down boxes, buttons, check-boxes, tabs are all easy to do - making a good UI is an art).


I would just work your way through basic algorithms. E.g., once you have the basics or arrays and loops see if you can understand about sorting and code various sorting algorithms and compare speeds. Make sure you rally understand the algorithmic complexity of the algorithms and run times.
MIT have an excellent set of youtube videos that I highly recommend:
http://www.youtube.com/watch?v=JPyuH4qXLZ0

This kind of stuff, although math heavy, is critical to being a good developer.

Certainly not important when you are first learning but is the kind of thing you will find very important.

Similar things to try your hand at is search, recursions, playing with different custom made data structures (double linked lists, homemade vector containers) and especially tree structures. E.g.,learn how to make a binary tree out of a set of numbers and learn how to search the tree quickly and why these structures are so important.

Then if you learn higher languages you will have a very solid understanding of how all the magic happens, which is critical. If programming becomes more like gluing together magic black boxes then you will be extremely limited in scope and ability.

Really try to understand the core, the languages and fluff on top like GUIs are relatively easy and quick to learn from a solid foundation.
 
Caporegime
Joined
18 Oct 2002
Posts
32,618
That might be a fun way to do it. There are a few algorithms and techniques you will have to learn to do even a simple calculator (reverse polish notation and recursion come to mind -- even though you could do it without recursion, it's worth doing it the recursive way first as it's incredibly intuitive -- as many recursive solutions are). While you're implementing it you're learning C, and that will be directly transferable to C++.

Edit:
Another thing that a lot of programs use heavily is date/time manipulation. Yes, these days there are libraries that do it for you, but that's no fun (not when learning anyway). Some suggestions

* Write a function to determine if a year is a leap year
* Write a program to calculate the difference (in days) between two input dates
* Write a function to calculate the date of Easter for a given year
* Write a function to determine if a given date is valid

Some of these are not as easy as they seem... (especially the second).

Edit #2:

Once you've written the above functions (and I know they seem boring, but they probably are challenging and that == fun) maybe you could write an implementation of this:

http://unixhelp.ed.ac.uk/CGI/man-cgi?cal

Good suggestions.

The calculation of Easter was actually one of the first applications of an algorithm
 
Associate
Joined
29 Aug 2012
Posts
174
The calculation of Easter was actually one of the first applications of an algorithm

There you go; I learned something new :D

Edit: I had to write the Easter calculation function in my first year of study. I have no idea how I managed it without the internet (this was 1994 and although the 'net was around I didn't have access to it... I guess I must have used things called books in those buildings called libraries hehehe)
 
Last edited:
Soldato
Joined
18 Oct 2003
Posts
3,667
To be honest I would go first for Java as will hold your hand through learning object orientation. I personally did C (some) -> C++ (lots) -> Java (lots) and can honestly say other than the basics doing things in C could teach you methodology that is bad practice in C++.

I guess the same reason could be given for learning C++ before Java, but they are a lot lot closer than C is to either. Java will give more job opportunities too, but ofc if you are good then you will quickly be able to jump from language to language.

Oh and as a side note I see above someone mentioned C++ isn't a pure OO language, whilst correct, nor is Java...
 
Back
Top Bottom