Learning Programming

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
Impaler
Creative Contributor
Posts: 1060
Joined: Sun Jun 29, 2003 12:40 am
Location: Tucson, Arizona USA

Learning Programming

#1 Post by Impaler »

I have desided to start teaching myself Programming and would apresiate some advise about how to go about doing this.

My first task is to get a rough idea of the course of study as I am virtualy at square 1 total ignorace right now. I am ofcorse interested in a course of study that would make me skilled enough for professionial game programming. So far I have this as my plan.

Idiots introduction to C
Full guide to C
Introduction to C++
Advanced C++

I know people are highly atached to their programing languages so please dont turn this into a debat on the merits of one language vs another. I am just interested in course of study you feel gives a good flexible basic understanding which can be expanded in the future and ultimatly reach a proffecional level.
Fear is the Mind Killer - Frank Herbert -Dune

Moriarty
Dyson Forest
Posts: 205
Joined: Thu Aug 14, 2003 4:50 pm
Location: United Kingdom of Great Britain and Northern Ireland

#2 Post by Moriarty »

Well it seems that C/++ is your language of choice. That's the first part of learning a language done.

IMHO there are 2 more stages.

1st stage:
Learn about the 'control statements' and boolean logic. These are used in all languages, so you only really need to know them once.
e.g.

#an if statement in PHP or Perl

Code: Select all

if($a != 1){
  #do stuff
} else {
  #do other stuff
}
the same if statement in Python

Code: Select all

if a != 1:
    #do stuff
else
    #do other stuff


The != means 'not equal'. These sorts of things are generally the same for all languages.
For this part of learning about a language i'd advise:
http://www.intap.net/~drw/cpp/ - Unfortunatly u can't use it to learn C++ all the way, because it's not complete. But it does have all the control structues in it, and it does strike me as being good for beginners.
That tutorial also has good explanations of the different types of languages.

Once you've got those figured out you can learn about the 'intricacies' of the language. This is where all languages differ from each other. Generally Higher languages are supposed to be easier to learn than the lower ones.
For this you can either read books/tutorials, or reverse engineer some code (the latter being aplicable only when you understand the 'structures' of code.


Hope this helps. ;)

Tyreth
FreeOrion Lead Emeritus
Posts: 885
Joined: Thu Jun 26, 2003 6:23 am
Location: Australia

#3 Post by Tyreth »

The way I learn best is to find a tutorial on a language, then using what I've learned try and make something. When I have troubles and get stuck, that's an indication that it's time to use more tutorials to learn more to complete the task.

Btw, it's not always necessary to learn C before you learn C++, though it may be useful because then you'll be aware of the differences.

tsev
Space Kraken
Posts: 167
Joined: Thu Jun 26, 2003 2:17 pm
Location: Pittsburgh, PA

#4 Post by tsev »

Might I suggest the book "C++ for Dummies"? Its got a good thorough intro to the language, and even explains some of its more obscure concepts in an easy-to-read manner. I'm not usually an advocate of "dummies" books, but this one is really good.
FreeOrion Programmer

leiavoia
Space Kraken
Posts: 167
Joined: Sun Jul 20, 2003 6:22 pm

#5 Post by leiavoia »

tsev, i have to completely disagree with you. C++ For Dummies i have read parts of. It is awefull (Perl for Dummies on the other hand was pretty good). It assumes you already know C, does not do a good job of explaining things by example, and the examples are very cyptic (i hate one letter variable names for all but the most trivial uses)

I would recommend O'Reilly's Practical C++ Programming. Then after getting very comfortable, get Stroustrup's C++ Programing Language (the guy who invented C++ - it's very deep).

O'Reilly's in particular starts from square one and works sequencially through C++. It does not assume you know C already, and in my opinion, learning C is a form of punishment, so good ridence. It won't talk to you like a dummy and assumes you are semi-intelligent. It runs the full learning spectrum but goes quick, so pay attention.

i would recommend getting into classes right away. the sooner you understand OOP, the better off you'll be.

as already mentioned, you need not know C to learn C++. In fact, it may be a waste of time if you don't intend to code low level C, since C++ has a lot of higher level fun toys. learning C might set you back in your learning if you don't have the explicit use for it.

my other advice is get involved in a project (like this one), dissect other people's code, and get feedback on your own from other people.

tsev
Space Kraken
Posts: 167
Joined: Thu Jun 26, 2003 2:17 pm
Location: Pittsburgh, PA

#6 Post by tsev »

leiavoia wrote:tsev, i have to completely disagree with you. C++ For Dummies i have read parts of. It is awefull (Perl for Dummies on the other hand was pretty good). It assumes you already know C, does not do a good job of explaining things by example, and the examples are very cyptic (i hate one letter variable names for all but the most trivial uses)
Well I've only looked at C++ for dummies after knowing C & C++ and it just seemed to me that beginners would be able to understand it...I could be misguided, though. However, I think it does provide one of the best explanations of how to use pointers that I've seen. I have lots of books on the language, and the 'for dummies' one is the only one that remotely caters towards beginners.

I really wish I even remember how I learned C++...but all I know is that the material I had to work from stunk, and the internet wasn't as useful then as it is now. I'm sure it isn't hard to find some online references and tutorials....I've learned countless other languages that way.

I do agree with you, though...don't bother with C. Its not necessary and if you have a grasp on C++ then C-code is easy enough to read.
FreeOrion Programmer

jbarcz1
Creative Contributor
Posts: 226
Joined: Thu Jun 26, 2003 4:33 pm
Location: Baltimore, MD

#7 Post by jbarcz1 »

If you've never done any programming before, I'd recommend learning C first, then moving on to C++ (actually, you might find it easier to learn a higher-level language like BASIC or Perl to learn the very basics. C can be a tough language for beginners because of all its low-level nuances).

C is a procedural language, and while most code these days is object oriented (and rightly so), I'm of the opinion that the basics of programming (flow control, understanding program logic, translating algorithms into code) are best learned using procedural concepts before moving onto the object oriented concepts that C++ will introduce you to.

Object oriented programming is a much better way to design software, but procedural concepts are, IMO, easier to learn than OO concepts if you've never written any code before. This is how my school's CS program does it, and my experience from taking and tutoring their intro classes is that it works pretty well.
Empire Team Lead

tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#8 Post by tzlaine »

Josh (that's jbarcz1) brings up a good point. Another reason to learn a procedural language before an OO one is that OO languages were designed to be a solution to certain perceived problems in procedural languages. Without direct experience in procedural programming, it's hard to understand why the hell you'd want to write "all that extra code" in an OO language. However, since C++ is nearly a perfect superset of C, you can safely do away with learning C by itself, if it makes it easier for you to buy fewer books, perform fewer steps in your learning regimen, etc. In fact Stoustrup (the inventor of C++) says that a major use for C++ is as "a better C".

But this is actually secondary to a bigger issue. Learning "how to program" is disctinct from learning a certain programming language. To say that you need to know at least one language to understand how to write programs is questionably true, but to say that knowing any number of programming languages means that you know how to write programs is unquestionably false.

You need to know a language to write programs, just as you need to be able to read and write to get a job as a reporter. But just as your literacy obviously won't impress too many job interviewers at newspapers, just knowing the syntax of a language without knowing how to employ it is equally useless.

My recommendation to you is to go to your nearest university, and get 2 or 3 books that are used to teach intro Computer Science courses, and read the books, as well as do the exercises. Many universities also have extensive web pages for the classes they offer, sometimes including class notes on the web. This is especially true of CS departments. Looking through actual lectures that are used to teach people this stuff should be invaluable. Probably the best and least-known such resource is MIT. They are in the process of putting their entire courseload in all of their classes on the web for people all over the world to use. It's called MIT Open Courseware (http://ocw.mit.edu/index.html).

Impaler
Creative Contributor
Posts: 1060
Joined: Sun Jun 29, 2003 12:40 am
Location: Tucson, Arizona USA

#9 Post by Impaler »

Thanks for the Advice guys, I have started buying some reading material. I will start fidaling around with them and see what starts clicking, if the C++ clicks right away then I will start going in that Direction, if not then I will look too C and maybe Visual Basic (whats the consensus on that?)

Please continue making sugjestions and I will keep asking questions.
Fear is the Mind Killer - Frank Herbert -Dune

Yoghurt
Programmer
Posts: 376
Joined: Sat Jun 28, 2003 8:17 pm
Location: Heidelberg, Germany

#10 Post by Yoghurt »

Impaler wrote:Thanks for the Advice guys, I have started buying some reading material. I will start fidaling around with them and see what starts clicking, if the C++ clicks right away then I will start going in that Direction, if not then I will look too C and maybe Visual Basic (whats the consensus on that?)

Please continue making sugjestions and I will keep asking questions.
I wouldn't recommend (Visual) Basic, neither as a programming language nor as an introduction to C++. If you want to make your first programming steps, Visual Basic might do it, but I fear knowing VB doesn't help you much in learning C++. Pointers and other common things you'll need in other programming languages are AFAIK absent in VB.

I would of course recommend Python to get started ;), although "the Whitespace-Thing" (whitespace is significant) is one construct you will not find in any other "popular" language. But Python also hasn't pointers and it passes everything as references, which is also uncommon.

(You will learn what pointers and references are, right now it's not so important)

Moriarty
Dyson Forest
Posts: 205
Joined: Thu Aug 14, 2003 4:50 pm
Location: United Kingdom of Great Britain and Northern Ireland

#11 Post by Moriarty »

I believe Visual Basic (VB) is a OO programming language like C++.
Another OO language that's quite popular is Delphi.

The language you choose to learn depends on what you want to do. The langauges so far selected by yourself are best for writing applications with.

Whereas if you wanted to make dynamicly scripted web-pages you'd choose something like PHP (php.net) /ASP

Or for mini-online gamelike things Java... Java can also make applications (it's supposed to be very similar to c/++ (and yes it's OO)).

I'm sure that for writing applications there are as many languages as there are for creating different types of web-pages... But web-dev is my area. I'm sure the FOo programmers can make comments on different languages to use for different applications.

tsev
Space Kraken
Posts: 167
Joined: Thu Jun 26, 2003 2:17 pm
Location: Pittsburgh, PA

#12 Post by tsev »

If you're going to focus on game programming, I'd say stick with C++. If you want something a little more useful in the non-gaming world, then you might be better of learning Java or <shudder> C#. If you want to get into back-end web development, I'd say learn some PHP & Javascript, or VB & VBScript. I'm afraid that C++ is going to be phased out of the business world.

Of course, once you know 'how to program', its not a big deal to migrate from one language to another, as they all have basically the same elements, just different syntax.
FreeOrion Programmer

Post Reply