General discussion


What's the best way to learn programming??

By ObiWayneKenobi ·
Hey all, I have some quick questions I'm hoping I can get advice on. I primarily deal with support and networking, but I want to start learning how to program. The problem is that I have absolutely no background in it. I've never taken any programming courses (was not required for my degree) and the only exposure I've had is very little VB.NET for an ASP.NET application.

I want to learn VB.NET and possibly C# (can't decide which) but I don't know where to start short of waiting until I can take some courses at a community college. I've bought several books on VB.NET but I have a very hard time sitting down and reading them because I feel the silly little examples they use to teach doesn't demonstrate anything useful; I prefer to learn by having a case study and working to build that up, not doing a bunch of independent examples that I feel don't teach me anything.

Maybe I'm going about it the wrong way? I'm just confused by the prospect of it all and have a difficult time comprehending what I do, probably because I have had no classes on theory and logic.

So, is there any way that I could get myself into the right mindset and try to learn this.. I want to make myself as diverse as possible, plus the little programming I have done is enjoyable, I just don't know enough to do anything useful yet. Are there any good books that teach in the way I described (i.e. includes a case study of some kind that allows you to learn by developing a 'real world' type application and/or has one as the final chapter to let you use what you've learned already), or is this a lost cause and I should try and take some courses?

Many, many thanks in advance!

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Ways of learning

by gralfus In reply to What's the best way to le ...

Different people can have starkly different ways of learning that are most effective for them. When I wanted to learn VB, I got a variety of books and tried their examples. Some worked, others didn't. If I got to a point that wouldn't work, the book usually didn't have any way to direct me about what I was doing wrong (occasionally the book was wrong).

I found that by studying other people's programs at work, I was able to learn quite a bit. I also took intro classes to gain a foundation of the "right" way to approach VB programming. It is very complicated for the person who has never programmed before, but once the pieces start to make sense, you can put the tools together to serve your designs.

Perl was another language that I taught myself, mostly by reading the O'Reilly books on Perl, and by doing very short programs that demonstrate a variety of commands. I kept a binder filled with these short programs so I could reference them. I also commented heavily within the programs so I wouldn't forget what the code was supposed to do.

So all in all, I'd recommend some intro classes and then puruse for books that others found useful. I still have a VB for Dummies book on my shelf, because it has simple information that other more advanced books assumed I already knew.

Collapse -

Learn programming basics

by stress junkie In reply to What's the best way to le ...

There are certain principles that can be applied to any kind of programming. You aren't likely to learn these from any particular language reference book. These are the kinds of things that are most likely to be learned in a classroom. General software design principles include things like:

well known data structures
well known algorithms
database design principles
avoiding spaghetti code
using flow charts
top down programming
bottom up programming
organizing huge amounts of data
and a bunch of other good programming practices.

My college curriculum was focused on software design so I learned programming techniques before I had developed too many bad habits. I believe that learning programming techniques is like many other skills. If you start on your own you may develop bad habits that will evenutally hinder you in the future. On the other hand if you start by learning good techniques they will appear burdensome at first but in the long run you will be better off.

So check your local college. See if they have classes with names like 'Data Structures and Algorithms' or the like, and give them a try. Once you learn these techniques you can pick up any programming language by using a language reference.

Collapse -

I'll go with that

by Tony Hopkinson In reply to Learn programming basics

I went from self taught, to a structured course in Pascal. Unlearnt more than a few things. Good programming practices I learnt like everyone else, either by shooting myself in the foot, or on occasion through another developer's poor attitude to firearms safety.

If you want to learn programming, look for course / books called learning programming with <language>, not learning programming in <language>.
Personally if you want to learn programming theory, you should learn Pascal or C, Pascal enforces a much better discipline in technique than C. VB.NET & C# are at a much higher level, they do more things for you, without you having to know how they work. If you learn at that level, you'll struggle to figure out why your code doesn't work because you where never taught how it does.
C# for instance does include pointers, but it's most powerful features are implemented with them.
All depends whether you want a quick start as a drag an drop programmer, or you want to learn the basics and then use drag and drop tools to program.

Collapse -

fundamental techniques

by apotheon In reply to Learn programming basics

You're right, that good programming practice is fundamental and not something you learn as part of a language. A programming language and good programming practice are separate skills, but they're skills one must learn essentially in parallel: learning each depends on learning the other to some degree. I disagree that you need classes to learn good practice, though. There are a number of quite excellent books out there that can help you learn good fundamental programming techniques.

Some classics of the field, seminal works of programming practice, exist and for the most part have little or nothing to do with your choice of language. Among those probably most applicable to learning the fundamentals are The Pragmatic Programmmer, Advanded Programming in the Unix Environment, The Mythical Man-Month, and The Art of Unix Programming. Two of those are more geared toward unices than other environments, but the principles they address are universal and valuable. The Art of Unix Programming is available for free online at and is more than worth the cover price to have a copy of your own. I'm told Design Patterns is excellent as well, though I can't swear to the sources from which I recall having heard this. I plan to pick up a copy, eventually, and find out for myself.

Disclaimer: I have not read all of the books I recommended, but people whose judgment I trust have read those I have not.

Collapse -

Wrong languages to start with.

by Tony Hopkinson In reply to What's the best way to le ...

You're unlike to find many good books on programming theory for VB.NET or C#. You need to learn that in a 'lower level' language.
Choose C or Pascal.
Brian W Kernighan, by himself and with co-authors has produced some very good books on programming as a discipline in both the above languages. Once you've got the basics.
Applying them to the languages you want to market yourself with and any other will just a matter of translating.
As far as examples go you are right you need a project.
Anything from something as mundane as maintaining your cd collection, to writing a board game.

You'll find lots of snippets and examples on the net to do bits of your project (or nearly). Understand how they work apply them to 'your' problem.

All programming is, is taking a 'complex' task and breaking it into simpler steps. The size of the step, the way they are arranged and stated depends on the langauge.
Theories and techniques are ways people have successfully done it in the past.

Collapse -

other good languages

by apotheon In reply to Wrong languages to start ...

Other good languages for learning to program include Lisp, SmallTalk, ObjectiveC, and Perl.

Perl is good because it has a very low bar to entry and encourages regular use by being very accessible, providing a very shallow learning curve. A shallow learning curve is important, of course, because it doesn't discourage the user, and Perl is a good programming language for ease of learning where something like C# isn't because Perl doesn't depend on drag-and-drop development to make the learning curve shallow (nor is it a mess of nasty the way VisualBasic is). Despite being shallow, though, the learning curve goes on forever. There's always more to learn.

SmallTalk is good because it's essentially the canonical object oriented language. If you want a relatively entry-level language to learn, but want it to be object oriented, SmallTalk might be for you. The downside to SmallTalk, of course, is that nobody uses it for real world applications. This isn't because there's anything wrong with SmallTalk: quite the contrary, SmallTalk would be excellent for many things. It just didn't get the hype that things like Java have gotten, so it has largely fallen by the wayside.

Objective C is a good language to learn for a number of reasons. For one thing, it's one of the best implementations of object oriented programming available. It essentially grafted SmallTalk-style object oriented programming onto the C language. The more common OOP language based on C is, of course, C++, but C++ is a messy kludge with some very schizophrenic issues. It's still a darn sight better than Java in many ways, though. In any case, Objective C also benefits from being a direct extension of C, rather than a reworking of C like C++ and C# are, so that even though it is not nearly as widely used as C++ it still teaches you a language (namely, the C programming language) that is fundamental to everything. The kernels to Linux, Windows, and MacOS X are all written in C, and it's hard to beat skill with C with the added benefit of a good schooling in object oriented programming. Additionally, pretty much all application programming for MacOS X is done with Objective C (using the Cocoa IDE). There's also a Linux implementation (called GNUstep) of the Objective C environment on which MacOS X is (in large part) based as well. This, along with Perl, is one of my favorite languages.

The Lisp family of languages is exceedingly good for learning programming because it is based on very elegant, well-structured design. In this manner, it is somewhat similar to Pascal, though there aren't too many people who would call Pascal "elegant". Lisp has more focus on the elegance, and Pascal on the structure, I suppose: both are quite valuable. Learning how to program in Pascal teaches you how to structure your programming, and learning how to program in Lisp teaches you how programming should look when it's done well. It's very difficult to get the point across without just telling you that you have to experience the difference for yourself, I guess.

There are people who swear by Python as a good starting language, but I disagree. It teaches structure better than Perl, I suppose (since Perl is the Swiss Army chainsaw of languages: you can do anything and everything with it, including patching your kernel in five lines of code, or lopping off your own leg with one misstep). Perl allows you to use or not use structure as you wish, and thus places the burden of learning good programming structure on other sources (like a good book about programming practice). Python teaches structure, but it teaches the structure of Python specifically, which for my tastes at least is worse than learning no structure at all. If you want a starting language that teaches structure, go with Pascal instead.

PHP offers one of the lowest barriers to entry to the language, and one of the shallowest learning curves, of any language worth learning. I say "worth learning" because something like JavaScript or VBscript is not really worth learning: what you need to know about either in any given circumstance you can figure out while you're doing it, if you have programming skills in general, and you can safely forget it the next day. PHP is nearly that simple, but much more powerful, and as such is a lot more suitable for use as a first language than something like JavaScript. I wouldn't recommend it as a first language, though, because it is essentially guaranteed to teach you bad habits that you'll later have to unlearn. Take it from someone that has made the mistake of learning more PHP than anything else: unless PHP is pretty much all you'll use, ever, you should definitely learn something else first. It's quick and easy, but these are not always the best characteristics for a language to have.

Keep in mind that I'm not exactly a guru with any of these languages. I don't consider myself a programmer at this time: I just have programming skills. I know quite a bit about the theoretical benefits and detriments of various languages, though, as I do about a lot of other things, because I've spent more time learning the principles and capabilities of technologies than I have about the specific implementations of these technologies. This is the way of life for a dedicated consultant.

Collapse -

No arguments

by Tony Hopkinson In reply to other good languages

Lisp and Objective C I haven't used. My language of choice is Pascal/ObjectPascal because I like the imposed structures. C I use because it's hard to move more than 2 inches in any direction in IT without bumping into it, but I'm glad I learnt pascal first it cuts out a whole swathe of bad habits particularly obfuscation.
PHP, I've been picking up as I go along and it certainly is preferable to Javascript or VBScript. Writing your code on cooked spaghetti with a magic marker in boxing gloves is better that either of them.
Even after 31 years since I started learning programming I wouldn't consider myself a guru, because I still am. As far I'm concerned you've grasped the principles a lot better than those who are happy to describe themselves as such. Once bumped into a guy who described himself as an ADO Expert, laughed my t1ts off.

Collapse -

good read

by apotheon In reply to No arguments

That was an amusing post, Tony. Heh. Thanks for the spaghetti analogy and the funny anecdote about the ADO expert.

Collapse -

I can laugh about it now

by Tony Hopkinson In reply to good read

he pipped me to the post for a nice contract as a client/server developer. His expertise in ADO was cited as the reason. Like employing a journalist because he's good with a pencil sharpener.

Collapse -

Thank you

by brentalansmith In reply to other good languages

Apotheon, I just wanted to take the time to thank you (and register at techrepublic for that matter), for posting this.

I found it extremely helpful and well thought out.


Related Discussions

Related Forums