Learning programming -- best way(s)?

Joined
Sep 10, 2005
Messages
764
Hey guys, I'm currently a senior in AP Comp Sci at my high school. I've taken an introductory course in Visual BASIC and C++ also. Well, something I'm noticing is that no one is learning anything in any of my classes. My classmates kind of cruise through the year typing up programs the teacher puts on the board, because none of them can write programs themselves. Part of it is the teacher doesn't know how to program. Also, it just seems like learning from the textbook is tedious and not very rewarding.

For those of you who think you can program well, how did you learn? Did you take concepts and play around with them by creating programs, or modifying existing programs? Did you memorize textbook definitions of terms(what I'm having to do for my class)? I'm sure part of it is spending time with the language, but I don't have that much time being in 6 periods of AP classes and some extracurricular activities. I need to learn to efficiently spend my time learning to program. I plan to major in either Computer Science at the University of Maryland College Park or Computer Engineering at University of Maryland Baltimore County. At either school/major I will need to know how to program. What should I do to succeed?
 
The best way to learn in any subject is to go above and beyond what is taught in the classroom. Regardless of how good a teacher/professor is, there is only so much time that they have to cover the material with you.

So to learn to program, you must program. There are many places to look for ideas on problems to solve. Doing a search for ACM problem set archives will yield a bunch of excercises. Crank through a few and feel free to post here is you get stuck on any.

--KK
 
Over the past 4 years I have built up a pretty substantial library of books about programming/algorithms/computer science theory/languages books. I had learned C as my first language, and moved onto C++, so I have many books about C++, but a lot of general books such as computer algorithms and Unix network programming which I read outside of class. Plus, once you get accustomed to a few languages, you can pretty much pick up new languages very fast. So my years of C/C++ experience translated to really fast pickup of Java, Perl, C#, PHP, Python, and so on.

Much of what I learn in college just serves as a basis, they can't possibly teach you everything about a language, and that's not what my major really sets out to do (computer science), as it's more about theory and concepts.

I also sometimes read source code, but most of the time I write stuff up from scratch. Currently I'm working on an IRC network client (technically for a grade, but only because I'm trying to learn more about networks programming on my own, since it's my independent project).

I didn't start at machine language level like mikeblas, the only assembly I've touched is x86 and MIPS, which I did enjoy thoroughly (MIPS that is).
 
I started out like mikeblas, but also heavily in Basic back in the day when you turned on your computer and it booted to a basic prompt and that was it (Pets, Vic's, Apples, etc.). There was no Electronics Boutique to go to, and while there was some software available the selection was limited. Because of this, we ended learning to program just to get the machine to do anything fun or useful. We also used to enter programs by hand that were listed in books and magazines; then we would figure how they worked and change them to do new things. It was always fun learning a new sorting algorithm or some cool logic trick, seeing how something I wrote 300 lines to do someone had condensed down to 30 lines.

I think these days there is so much free available software that there is almost no need for most people to even think about programming. My advice would be both to study source code to see how others approach a task, but also to try and create your own application to do something you're interested in. For example, once I needed my mp3 library re-tagged. There are a million freeware apps that will do that, but you can also learn a lot about files system commands, looping and input / output by writing your own (just be sure to work on a copy of important files!)

[edit]
Think what you will of Microsoft, but the reality is their software is on more desktops than anyone else. As such a good working knowledge of VB or VBA can be a useful tool in the business world. We even have AutoCAD and Solidworks coding in VB at our shop.
 
OP, if you really want to teach yourself before entering college, mikeblas's advice is very good. Learning assembly or machine language would help you enormously once you get to high level languages, as you will know precisely what is going on behind the code. Plus, those little machine language boards sound like a lot of fun...I'm probably gonna have to buy one now. Thanks a lot.
biggrin.gif


That being said, the CS program at whatever college you choose IS designed to give you all the tools you need. HS classes tend to be "copy this code down from your book" deals, and the college courses will actually teach you to do these things on your own. Though it would be a very good thing, you really don't need to walk in the door with a knowledge of coding just to survive. The more you know the better, though.
 
agent420 said:
Think what you will of Microsoft, but the reality is their software is on more desktops than anyone else. As such a good working knowledge of VB or VBA can be a useful tool in the business world. We even have AutoCAD and Solidworks coding in VB at our shop.

VB and VB.net are probably two of the most widely used languages used today, since they can be used to develop and prototype applications very quickly. Scripting languages like Perl, Ruby, Python, and Tcl are becoming more and more popular as well since they can be used to program up short and small applications (and even large ones) fast as well.
 
I learnt to program with vb6. Then I went onto another course which thought Pascal an Assembler. I much preferred working with vb, seeing more results from less code is a big plus for me. However I do feel pascal and assembler have helped me somewhat, especially programming a calculator.

My current learning technique is to read a book, then another one (when I say read, I mean work though it and make sure you FULLY UNDERSAND the concept before moving on. To take this further and to really learn to program speak to people and find out if they need/want software. Work on the principle that if they don't like the software they don’t pay for it. You may not make much money but it will be more than most internships. It will also get you to write good software, fast (if it’s wrong, it can get very time consuming. So you learn to get it right first time). Also gets away from being a perfectionist and putting in features that nobody will ever see or notice. There you are an efficient programmer!
 
I have worked my way down from the highlevel languages instead of the other way around, apparently unlike most people here. There's something about the immediate rewards a highlevel language gives you that's inspiring when learning programming. I started with basic[1], moved to qbasic, and got the basic feeling for variables/functions/arguments/control structures there. I've later done python, PHP, ASP, ASP.net, java, C, C# and C++, in something like that order. If I were to recommend something, it would be starting with a language where it's easy to get results. The same basic thinking applies to most languages anyway, and it's much easier to stay motivated with an "easy" one. Knowing assembler is good [2], but it's not where I would start. While I agree that understanding what's actually happening is a good thing, a decent knowledge of programming concepts is more useful when learning new languages.

If I had to recommend anything, it would not be Win32 & C++ [3]. I don't like VB, partly because it encourages you to ignore the things the IDE does for you, but I'd say it's the better choice of the two. If you want to try something else, there's a number of alternatives.

I'm personally fond of PHP. It's not an exciting language, but it's fairly free from strange catches [4] and has some eminently practical features.
Python is also good. It can be very immediate, since you can type commands or programs into the interpreter and get results there and then.[5] It is a good choice for getting into object-oriented thinking since it's made with it in mind yet you don't have to. There's also support for some GUI libraries if you want to make graphical programs, and modules for most other things as well.

C# and java are very similar, and just a bit heavier [6]. Very useful, though. Unlike python and PHP, who merely support OO features, C# / Java requires your code to be at least minimally OO. This and other things mean that there's more you have to know before you can write a working program, but they reward you for it by being orderly and structured.

I would suggest that you pick one of the four above languages and dive into it until you're familiar with the basic programming concepts. When you are, there are fewer things you have to learn at the same time when you learn another language (like C++ for Win32) later. As for which language, it depends on what you would like to do.

If I had to give you a clear recommendation: Get java and an IDE [7], and get familiar with first the language, then the GUI concepts. You might find this useful.

[1] ABC80-basic, on a computer several years older than me. (Got it for christmas from my grandfather, who rescued a few when they were retired from his school.)
[2] For reasons unknow, I've mostly played with Alpha assembler
[3] It's so ugly. :(
[4] While C++ sometimes feels more like a collection of strange catches that are powerful in the right hands.
[5] This is something that's lacking in most current languages when compared to the old basic-in-rom computers. Being able to turn on a computer and beign typing code (with sound and graphics support built in) immediately made programming much more accessible.
[6] A guy in my class still shouts "public static void main!" whenever he's frustrated with anything programming-related. Of course, it might say more about him than java.
[7] Netbeans or Eclipse. Both are free, good, IDEs, I'm in the minority that prefers Netbeans.
 
Thanks for the info guys. I guess what I find kind of discouraging, especially in Java, is the huge amount of syntax I have to know in order to write a program. Sure I can borrow programming code from other programs(which I always do), but compared to like VB, it seems overwhelming. My first language was VB, and while I only spent about 4 weeks studying it during last summer, I felt like I learned more in those 4 weeks than a whole semester in my Java class. I was able to create simple programs(simple to you guys, not to me at the time) that did things like counted change in quarters, dimes, nickels, and pennies. When I completed something like that, although not exactly useful to me at the time, I felt a bit of satisfaction at accomplishing it. I guess that's largely what I love about programming, and aside from my love of computers, is why I wish to study it.

I suppose the language I need to spend the most time with is Java, even though I find it challenging. The reason being is I know for a fact that is what I'll be studying in college at the University of Maryland. For now, I'm going to stick to the more fundamental concepts of Java; when I get to about chapter 6 of 12 in my Java book, things start to get very fuzzy for me, meaning that is where I cease to understand what it happening in the programming code. Perhaps I should clarify; sure I know what is happening, but I certainly can't reproduce the code on my own.
 
One of the nagging problems I have with Java (out of a list...I'm not a big Java fan ;) ) is that sometimes the code you write seems very long when it only does something basic, like maybe getting user input from the command line. In some ways I find the language not incredibly expressive because you do sometimes have to write more code as compared to other languages.

Of course, if you want to write really short code which will confuse everyone (even yourself), look at Perl. But you can write really short programs in it.

For a web development course, I was given the choice of writing an XML parser either using Java + Apache Xerces or using Perl. I wrote an XML parser in Perl that was all of 5 lines (with XMLParser or something) . The professor of that class then forbade the use of Perl for the XML parser project and gave everyone the choice of using C++ and Java with Xerces only, and those programs clocked in at much longer length. :p

Anyway, keep working at it. Once you get used to one or two languages, it's really easy to pick up new ones if their syntax are nearly the same.

I think the biggest shift in my CS career was learning how to use functional languages, since the syntax is so much different. But we'll leave that for another day. :)
 
I personally started with VB6 then moved to SQL. I then picked up VB.NET and JAVA followed by PHP. This year I learned C# and ASP.NET. I have to say with doing C# and ASP.NET the VB.NET really helped me. It depends what you want to program. If you want to program low level then there are better options than VB.NET or C#.
 
jesusfr3ak4evr said:
I plan to major in either Computer Science at the University of Maryland College Park or Computer Engineering at University of Maryland Baltimore County. At either school/major I will need to know how to program. What should I do to succeed?

Simply having passed the AP exam will put you about where you need to be to start college - I'd be suprised if you're expected to know much more than what a variable is and the difference between true & false. If your really concerned about what's goign to be covered, go to the school's websites and check professor's pages to see if they have a syllabus for the first few classes.

The only way to learn programming is to do it. Find something you want to code and do it. With 6 periods of AP, you're probably in some math/science class - try automating some of that stuff (in fact, you're likely to take a class at some point in your CS carreer (mine was called "Numerical Methods") where you learn the algorithims to solve first-year calculus problems).

There's no secret to learning to program - no sequence of things that guarantee success. It's just a matter of finding the tools you have available and actually using them for something. For some people, that was BASIC and microcomputer assembly (or LOGO :cool: ), for some it could be PHP/MySQL, Javascript/VBScript or hacking shell/Perl scripts. It doesn't really matter what you're using as long as you're seeing the bigger picture and not mentally equating programming with the capabilities & limitations of your specific tools.



With all that said, you should start using Python ;)


For a web development course, I was given the choice of writing an XML parser either using Java + Apache Xerces or using Perl. I wrote an XML parser in Perl that was all of 5 lines (with XMLParser or something) . The professor of that class then forbade the use of Perl for the XML parser project and gave everyone the choice of using C++ and Java with Xerces only, and those programs clocked in at much longer length.
You understand that this wouldn't have been a problem if you'd actually written a parser instead of importing a library, right?
 
Back
Top