LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Advice on learning to program (https://www.linuxquestions.org/questions/programming-9/advice-on-learning-to-program-503443/)

pengu 11-20-2006 10:44 PM

Advice on learning to program
 
I am trying to teach myself to program, any advice?

I have started with C++, and have bought a book on it, "C++ From the Ground up" by Herbert Schildt.

I was wondering, however, if there were any good online (and free?) programming "lessons".

My school does not offer any programming classes, and learning out of the same book can be tiring.

So, what is the best way to teach myself to program.

Galaxy_Stranger 11-21-2006 12:59 AM

To be perfectly honest - I think the best way to learn is by working on creative projects. If you're into gaming, you can mod DooM for free. One of its Windows source ports supports ACS scripting, which is based on C - the syntax is *slightly* different, but it's pretty much the same. It's even compiled, which is kinda odd for scripting languages. They've got several tutorials and examples to get you started. After a bit of playing around with this game and seeing what it can do, you'll get into the mindset of programming and you'll be more receptive to the concepts in the books you read.

I got a book by D.S. Malik on C++ published by Thompson, which is the book we were required to use for class. If you're willing to spend the time on it, a book like that is just as good as anything else. Thing is - you're going to have questions. At that point you can go to http://www.dreamincode.net or just google C++ forums.

operator10001 11-21-2006 02:05 AM

try using pascal and python for practice.

pengu 11-21-2006 10:50 AM

thx for that dreamincode link, looks really good!

introuble 11-21-2006 11:10 AM

Also.. at least when it comes to C/C++.. I think it's best to avoid mr Herbert Schildt's books.

theNbomr 11-21-2006 11:33 AM

I think it is essential to use real-world problems as part of your learning motivation. Next time you encounter a task which you think a program should be able to handle to simplify your world, especially if it is a 'grunt' task requiring lots of repetitiveness, start writing some code to do the job. Don't quit, just because you already got the job done using your manual effort; use the manual mode of work as somewhat of a model for the way your program should work. Most of all, *complete the program*, even if it take you 3 days to write it and 5 minutes to solve the problem manually. By starting with simple things, you will give yourself an acheivable goal, and by using real-world problems, you give yourself a tangible measure of success and completeness. It will probably amaze you at how many things are learned in the first very simple programs, which is why you need to start with simple things. Pick a language which is well suited to the types of problems you want to solve. Being productive quickly prevents loss of interest. Be prepared to spend a significant amount of time before becoming productive in any sense.

At some point, you will start to think of your problems more in terms of the algorithms and idioms you employ, and a lot less about the syntax, grammar, and mechanics of the language you use. At that point, you might want to consider adopting another language that addresses other classes of problems or removes some limitations imposed by your original choice. Try to avoid languages and API's which are tightly coupled to a particular architecture. Coding for Windows tends to involve a lot of that, and doesn't promote a general-purpose knowledge. It is a good idea to get comfortable with the commandline, and all of the tools which live there. You will find a lot of answers in forums and other web places that use shell-speak, and very few that give answers in terms of lesser-used IDE's and closed 'environments'.

Seek out forums, newsgroups, and as many online resources as possible. Read them in your spare time, instead of playing games. Buy &/or borrow books, lots of them. When I research a programming or other computer related subject, I almost never find a single book that just answers everything. Usually, I find that it takes 4 or more books to answer 80% of my questions. Don't forget that the tutorial-style book you start out with will be outgrown and you will eventually need more reference oriented books. There will be a big overlap period where you need both. Get in the habit of scanning all of the books on your language of interest every time you go to a library or bookstore.

Good luck.

--- rod.

petersum 11-21-2006 04:15 PM

I can give you the paints, brushes and canvas but I can't make you a modern Picasso!

Start with something easy such as Python to see if you have the "feel" of programming.

Programming can be very a fulfilling experience, or extremely boring - especially learning C and C++.
Many people start by learning webpage scripting (XHTML), moving on to CGI scripting in perl. This way, you can see immediate results. If you really have the right temperament, you'll then progress towards learning C and so on.

Some people may argue that scripting isn't real programming, but its a step in the right direction.

tuxdev 11-21-2006 04:40 PM

The best way to "grok" programming is to do it. Try to solve an interesting problem, or try to contribute to projects you like. Smaller projects are better for contribution, because there is probably some work you can do with a minimum of working knowledge about the project.

fcdev 11-21-2006 04:45 PM

I always tell people that the absolutely most important thing to learn about, with programming, even when getting started, is Boolean Algebra. That's all that business with 0's and 1's. If you don't understand this, it's difficult to control program flow, and it makes graphics handling very difficult. Sure you can get by without it, but Boolean Algebra is the key to proper understanding of programming. After all, it's the basic building blocks of digital electronics.

Galaxy_Stranger 11-21-2006 07:27 PM

Well, binary is part and parcel of programming, but I certainly don't think it's essential to start with. Especially when starting out with no experience, you're asking the brain to change the way it thinks.

Obviously, the best thing to do is to take a class, but he's stuck trying to teach himself. In that event, I agree with theNbomr in that you should find practical application. That's why I like game scripting - you get immediate results with something you're interested in. Even just getting used to making function calls gets your mind working in the right direction.

fatsheep 11-21-2006 07:51 PM

If you're looking for a good practical language to start off with I'd recommend bash (same language you use at the command line on most systems). I started with C++ and while I did enjoy programming in it, C++ just wasn't practical for the kind of stuff I wanted to do like moving files around, archiving them, creating logs, etc... - practical everyday stuff that you would like to automate. That's the main reason I like programming - automating tedious tasks.

tuxdev 11-21-2006 10:52 PM

One of the best ways to learn specifically C++ is to try and build a library of some sort. Writing a library makes you familiar with the enviroment, and to do it right requires that learn many language features. I'm currently trying to rewrite a wrapper library around SDL using OOP concepts I've learned since the first time around.

pengu 01-18-2007 12:22 AM

thx for all the suggestions

Do people recommend learning one language at a time, or should I just dive into all of them?

at the moment i'm reading a c++ book, a c book, a beginners javascript book, and java tuturials online.

I now have a good "feel" for programming, and am looking to really go further.


I really want to learn the languages that will be useful in an enterprise environment. I plan on going into programming when I leave (high) school. The problem is, as in my op, my high school does not offer programming courses.

From what I here, job experience is almost more important than collage experience with programming, am i right?

I was speaking to a guy who manages/hires programmers for his company, he says that he often prefers to hire people who have NOT been to collage- as the collage programming is a completely different thing. He also says that almost everthing they do now is in C# and .net

I want to learn java because I have heard it is a very common enterprise language, and it is also cross platform.

Do you think I should just focus on C first, then C++, then others?

or just go for them all at the same time.

Galaxy_Stranger 01-18-2007 12:27 AM

One at a time.

Choose one.

Buy a book for students.

Read it cover-to-cover.

culin 01-18-2007 11:33 PM

Well, it all depends on your interest, if u love programming,.. what i can suggest is to start with "C"-Yeshvanth Kanitkar is a very good book..... u just love C programming even if u don have interest in C it is such a good book... and Herbert Schildt is also a good book to start with.. but i suggest C++ by Venugopal... and it if u have time to spare u can learn a scripting lang.. may be pearl or bash...and in my opinion... don mess the things.. u start with C and get a firm grip atleast till structures,pointers, funcitons and file handling .. then u can learn any language u name.....:)


All times are GMT -5. The time now is 11:25 AM.