Fog Creek Software
Discussion Board




learning to program

I apologize if this is an inappropriate question for this forum, but frankly I have asked it in other forums with little in the way of any useable advice so here goes.  I’m an NT admin, pretty much self -taught.  I have not had the benefit if being able to work with others that were real top notch in this area. Despite that I have managed to secure a fairly good living, but I’m not real satisfied with my current skill set.  I really believe that I need to get serious about learning to program.

Right now I’m confused about the first step. Other then writing batch files and copying some simple VB I don’t have the first clue where to start.  I thought that I could teach myself Windows script host, since it would help me in my job, but you really need to know VB script or Jscript to get anywhere with that. Can anyone recommend a resource that will give me a firm grasp of the fundamental concepts of programming?  I also thought I would start out learning Jscript since I can then use it to write Windows scripts, would this be a good “first step” for learning how to program?  All constructive advice would be appreciated. If you need more information let me know...thanks!

Rick DeMent
Monday, September 23, 2002


That "search" thingie in the left can be your friend.

http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=1751
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=1289
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=196
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=3280
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=6674

Less related, but interesting once you are on the road:
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=4411
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=4705

Misc:
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=10050

Leonardo Herrera
Monday, September 23, 2002

If you are going to learn JScript, I once wrote a tutorial on oo programming in actionscript (same-ish thing)... Might help, might not. A lot of programming (C++, Java, C# etc) is a fog until you get the basic oo concepts - that's what I found anyway. fwiw:
http://www.debreuil.com/docs

Other things are just to make hundreds of little test programs, preferably in a domain you are familiar with. Read a few good books. I don't think the language is that important, though a lot of one and a bit of another is a good thing.

Time mostly though : ).

Robin Debreuil
Monday, September 23, 2002

If you want to choose programming as your profession, I would strongly suggest reading and breathing, "The C Programming Language".

This may not look sexy but there's no shortcut if you really thinking about programming as a career. Your next step can probably be learning an Object Oriented language.

Hope that helps

Farid
Monday, September 23, 2002

Just to add something to Leonardo's 100s of implicit comments... it seems that there are many good ways of learning programming by yourself, and all of them have to do with identifying the "good books."  And none of these books are from QUE!

As for languages... that is the land of pointless flamewars and you just have to keep an open mind.  If you use Kernighan & Ritchie's book on C, I suggest you get Kernighan & Pike's "The Unix Programming Environment" for perspective too.  At least it worked great for me, since C/Unix is something like Java/JVM.

anon except for the cookie
Monday, September 23, 2002

Rick - if you're just getting your feet wet with programming, I'd recommend finding a book that explains the basic elements of programming, while taking you through some hands-on examples of real code, yet is readable enough that you don't get discouraged before you finish the book.  I personally would recommend John Smiley's "Learn to Program" books ( http://www.johnsmiley.com/books.htm ) or "The Book of Javascript" by Dave Thau.  After you work through those, you'll be much better equipped to tackle stuff like "The C Programming Language."

Tony Dismukes
Monday, September 23, 2002

Here's some interesting links about learning to program:

Why Johnny can't program
http://www.bricklin.com/wontprogram.htm

Teach Yourself Programming in Ten Years
http://www.norvig.com/21-days.html

They're a bit pessimistic but after reading them you'll be able to decide whether you really want to become a programmer.

Matthew Lock
Tuesday, September 24, 2002

Rick said:
"I really believe that I need to get serious about learning to program."

Matthew said:
"They're a bit pessimistic but after reading them you'll be able to decide whether you really want to become a programmer."

Rick, don't get too hung up on deciding whether you want to learn to program or not. It sounds like you're already serious about it, so go for it. Get some books and start programming. Read the links and follow their advice about what to do to get into programming. If you try it out and decide it's not for you, then that's fine. But make the decision AFTER you've tried it!

Also, it is absolutely true that the more you do, the better you get. When I go back to code I wrote years ago, I'm embarassed by it, but I recognise that if I hadn't gone through the earlier learning stages, I wouldn't be better now. The more you do, the better you get, especially if you're consciously trying to improve.

Adrian Gilby
Tuesday, September 24, 2002

I just found extremely unefficient just sit and study programming language out of context of particular project.

Perhaps this is because programming is about solving problems with right tools.

Pick an interesting project first, try to understand what do you need in order to accomplish, then choose a right tool (VB, perl, c++, whatever you think is right).

dk
Tuesday, September 24, 2002

I am biased, but I agree with the poster to get the K & R C Programming book, do all of the questions in the book, then pick up C++ primer by Lippman.  Once you have these two down, if you want to do Java, pick up the O'Reilly book Learning Java, if you want to do .NET get either the Programming C# or Programming VB.NET books.  The K & R book will give you a good introduction to the LOGIC in programming, C++ primer will give you a good introduction to OOP and virtual functions, which you will encounter in Java, C# and VB.NET.  I would forget putting too much time into JavaScript/VBScript, etc.  Learn the big languages first, then you can specialize later.  Also go to www.topcoder.com and visit the practice rooms, they are great for trying to solve problems in C++/C#/Java....

Tim
Tuesday, September 24, 2002

I have to chime in and agree with what a lot of others are saying -- whatever you pick, do the exercises/labs in the book, even if they seem pointless. Sooner or later you'll see why they're not pointless :).

I personally don't think it matters what you start with. I know all the compsci students will push the K&R C book (which they learned from), but probably any book will do as an introduction, even the otherwise-worthless "21 days"-type books. In fact, as much as I like the K&R book, it's not for someone that hasn't done any programming. Of all the good programmers I know, none of them started the same way, or in the same language, or from the same books, so IMO it doesn't matter where you start.

To second something dk mentioned -- pick a project and work until you learn how to do it. That's *always* how I learn a new language or a new system of some kind. Even on "day one" for me with my little Z80 computer, it was about wanting a more powerful calculator or playing a spaceship game.

One other thing I'd mention that I don't think has been brought up -- programming is a lot different now than it was when a lot of us started. Now it's all about which libraries you use and less about using the language stand-alone. A lot of the books on the shelves now focus as much or moreso on the libraries than the core languages -- which is why the K&R C book is still, 20 years later, so valuable -- but not as a first book.

Troy King
Tuesday, September 24, 2002

I have to agree with dk.

Set yourself a task - but something small and achieveable first. Get your high on completing stuff, then hacking around with it, adding stuff as you go.

Also don't get dishearted if your first attempt does not succeed. Try again, and don't be afraid of trying a new programming language if you first choice doesn't seem to do what you need it to do.

But most of all, don't throw away your paper and pen. Do a flowchart of the process your planning to code. Note down the likely classes and statements you'll likely to be using next to each stage on the chart. Plan your code, before you touch the keyboard, and your more likely to finish the task.

Oh - one last thing - add plenty of comments to your code, so that if you ever need to go back and revise your work, you can easily find your way around again.

Lawrence Attrill
Tuesday, September 24, 2002

Go and pick up something like DarkBasic, or BlitzBasic. They're really simple games programing languages. As I see it they have two advantages, firstly they're simple to use compared to something like C++ and much, much 'safer'. Secondly, it's a lot more fun being able to put together a simple game than a simple calander.

To be honest though, I don't think it matters much what language you start with; I am definetly of the opinion that learning ANY language will help you program with ALL other languages.

Mr Jack
Tuesday, September 24, 2002

Flame away, but when I was a neophyte with absolutely no knowledge of programming whatsoever, I found "C for Dummies" by Dan Gookin to be an excellent start. I don't think I'd be where I am today if I hadn't begun with that book.

Then I think about where I am today. But don't let that put you off.

Of course, you are already working in IT, so you probably won't need the amount of spoonfeeding and handholding that Gookin's book provides. But it will still make "The C Programming Language" seem easier.

And C is definitely the way to go. Not too hard, not too easy.

Above all, don't be afraid to go for it. If you put in the time and effort I'm sure you will succeed.

Fernanda Stickpot
Tuesday, September 24, 2002

Rick,

Programming is about solving problems, nothing more nothing less.

I think the best place to start is to look at what your problems are, then how you can use programming to help solve them.

You say about learning JScript/VBScript for automating tasks.  What type of tasks might you automate?

What problems do you think you might be able to better solve with a bit of code?

If you serious about taking programming as a career path, then I think the advice about going to the basics and learning it properly apply.

Ged Byrne
Tuesday, September 24, 2002

Thanks for all the wonderful suggestions.  Here are a few things I though of while reading the responses.

I want  to first establish a programming vocabulary.  For instances I have a Java script book that says, “…Java script is object based, meaning that Jscript can use objects.  However Objects are not class based meaning that no distinction is made between a class and an instance; instead they are just general objects.

OK so this passage is on page 9.  I have an intuitive understanding of what this means but I want to be thoroughly grounded in these concepts not just muddle through them contextually.  So I guess I’m looking for a book that explains some of these bedrock fundamentals.  As a former musician I realize the importance of learning scales and arpeggios in order to make music.  It seems to me that programming is not much different.

As for a specific project I want to write a script that will load a NTUser.DAT file into a registry hive, add a key and unload it, and I want to be able to identify a number of profiles in a directory that the script will perform this operation.  I realize that it will take longer to learn how to script this then it will take to just do it by hand, but once written this would be a very useful script for a large site.  I also want to write scripts for my website or at least understand enough to modify other scripts for my own nefarious purposes.

Again thanks for all the wonderful suggestions.

Rick DeMent
Tuesday, September 24, 2002

A follow-up to the suggestion I made yesterday - once you've worked your way through all the exercises in your first programming book, try "Bebop Bytes Back", by Brown & Maxfield.  It won't give you immediately usable programming skills, but it will give you a huge amount of understanding as to what's going on "under the hood" in programming, which will then make it easier to learn new stuff as you go along. 

Tony Dismukes
Tuesday, September 24, 2002

Sounds like you'll make a good programmer.  My advice is to skim lots of things for meaning, and let conflicing religions infect you if you're into that madness.

I like Tony's recommendation.  I remember Bebop Bytes Back being an incredible book, though I don't know what I'd think of it now.  Wish I had a copy, it's out of print.  (Is opensource the solution to everything?)

Lots of free stuff on the net.  One is sicp, which maybe you want to look at the 1st chapter of, where it tells you some fundamental ideas of programmnig.  Ideally you're building notations to express things naturally.  Of course, you don't have to be idealistic, but when little dirty scripts grow, you can take the time to generalize them.

Sammy
Tuesday, September 24, 2002

I'd like to recommend a book called _Code Complete: A Practical Handbook of Software Construction_ by Steve McConnell ... even though its examples are 3GLs like PASCAL or C, and even though it doesn't mention OO or the Web.

Christopher Wells
Tuesday, September 24, 2002

No votes for that all time leftfield favorite "The Little Lisper" then?

http://search.barnesandnoble.com/textbooks/booksearch/isbninquiry.asp?isbn=0023397632

Just me (Sir to you)
Tuesday, September 24, 2002

Rick,

I think you best bet is to start getting your hands dirty.

Personally I'd recommend VB, becaues it is easy to get started with and the web is chock full of examples.

I'd say go for VB rather than VBScript because you get the benefit of the IDE.  This will allow you to debug your code with features like stepping through and watch conditions.  These really can make life easier.

For system programming Java is not a good bet becaues it tries to be platform independant.  In order to access features like the registry you need to use extensions, and thats a pain.

With VB you have easy access to the system, and you can also use it to automate Microsoft Office. 

For the beginner, I hear good things about John Smiley's books:

http://www.amazon.co.uk/exec/obidos/ASIN/1902745000/ref=sr_aps_books_1_1/026-1440638-7169226

VB is easy to learn, and the IDE holds your hand.  However, for web apps you have to learn a different dialect - VBScript.  You also have to pay good money for it.

An alternative is Perl.  Perl is made for SysAdmins, and nothing is better for throwing things around.  It's great for processing data files in any format.  It may be designed for UNIX, but it does include a library for the win32 registry:

http://jenda.krynicky.cz/perl/Registry.pm.html

Heres a script for removing a registry entry in the Default ntuser.dat file:

http://www.myitforum.com/inc/upload/5095removeregntuser.txt

One of the key advantages with Perl is that it is free, and can be used for both modifying your registry and serving your web pages.  However, it is a rather steep learning curve.

Anyway, those are my recommendations.

Ged Byrne
Tuesday, September 24, 2002

A good link for learning Perl on windows:

http://www.wdvl.com/Authoring/Languages/Perl/Windows/toc.html

Ged Byrne
Tuesday, September 24, 2002

"get the K & R C Programming book, do all of the questions in the book" -- Tim

I agree with Tim and the others here, particularly if one wants to learn C. This is a short book, is a well written tutorial for beginners (despite the marvelous fact that it is also the official reference for the language).

That said, there's nothing wrong with learning Basic instead as a first language -- that's what it's there for. Or Pascal, another language designed with pedagological aims.

But here's the big thing:

You need a project.

You absolutely must have something that you want to program up. Doesn't matter if it's something that's allready been written -- you'll make it your own.

If you have something you are trying to accomplish, you will learn to program well much faster than if you are just reading books on theory of programming and doing exercises.

In a few years when you are comfortable with programming well and find it easy to put together small programs, you will start working on medium and larger sized programs and you will hit a brick wall where your code is too complex to understand. At that time, you can step back and look into Design Patterns and Refactoring, but neither of these make sense to get into until you are proficient in a language enough to put together a program on your own.

Sarain H.
Tuesday, September 24, 2002

Get a free brinkster.com account and start writing some ASP. You'll be able to start writing interesting, useful programs in a week, unlike if you start with straight C/C++/C#. There's lots of good info about learning ASP:

http://hotwired.lycos.com/webmonkey/programming/asp/
http://www.gotdotnet.com
http://www.4guysfromrolla.com
http://www.brinkster.com

pb
Tuesday, September 24, 2002

If you want to learn COMPUTER programming, learn to program in C (and absolutely master pointers).

If you go with C++ or Java or (especially) VB what you're learning is a level removed from computer programming (yes, yes, two levels for you assembly types) in almost all respects.

What you don't want to do is learn only the high-level librairies that are most commonly used by these languages, because then you're just learning what is, for all intents and purposes, an API.

What these OO junkies won't tell you is that because of grotesque, productivity-related, code-reusable concepts like data hiding and encapsulation and interfaces, you'll never get to see the inner-workings of your own code...you're simply using other people's classes and counting on them to do it right (and they often don't).

Go to the basics:  pointers, file and device I/O, dynamic memory allocation, proper use of buffers, stacks, queues, data structures, linked lists, binary trees and all that good stuff.

THAT is what being a programmer is all about.  When you've mastered the fundamental concepts like the rest of us computer scientists, then and only then should you forget about them and move to the higher level crap that will suck all the fun out of your life and make you forget why you got into this game in the first place.

Is it only Wednesday?

Dunno Wair
Wednesday, September 25, 2002

*  Recent Topics

*  Fog Creek Home