Learning How to Program: A Guide. Part VII

The Purposes of Higher Education

(Be sure to check out part 1, part 2, part 3, part 4, part 5, and part 6 of this series if you haven't already).

Lots of people who want to learn about programming, or anything else, for that matter, enroll at a college. As I stated previously, I don't think that's the best idea right at the beginning for programmer -- not when you are trying to determine whether or not programming is for you. But what about when you've passed the first couple of stages, and have confidence that you can be a good programmer? Should you go to college then? And if so, how do you pick out a good college to attend?

These are tricky questions, and it's going to take more than one article to answer them. In this article I'm going to lay out my Grand Unified Theory of Higher Education, and afterwards I'll explain how this relates to programming education and your decision to go to college.

Higher education, by which I mean any educational experience intended for people who have graduated high school, has historically served three purposes: academics, training, and gatekeeping.

  • Academics encompasses what was traditionally viewed as a "college education," the propagation of culture from one generation to the next, the liberal arts, the sciences and literature, the hallmark skills of the educated person, such as critical reading and clear writing.
  • Training is preparation to enter a particular profession, learning the mental or physical skills expected by industry.
  • Gatekeeping occurs when there is a hard requirement for a particular credential in a particular career. For example, a teaching certificate is required to teach in most K-12 classrooms.

The legal profession is a good example of how these purposes interact. If you desire to become a lawyer, the first step (after graduating high school) is to earn a bachelor's degree. You can effectively choose any bachelor's degree and major you want for this stage of your pre-professional journey; hence, your undergraduate degree can be focused entirely on academics. Once you complete your bachelor's degree, you will enroll in a law school, where you will receive training in the specific skills required to practice law. After you earn your law degree, before you can practice law you must pass your state's bar examination, which serves the gatekeeping function.

I believe the major underlying source of so much trouble in higher education is that we've muddled these purposes together. We've put all of the purposes under one roof, so to speak, and declared college education mandatory no what the career field. This results in colleges that try to do it all--academics, training, and gatekeeping--which means they don't serve any purpose as well as they should, and students who attend for one purpose are often in trouble when they encounter requirements from another purpose.

More on that later. For now, let's ask: how does all of this relate to our main topic, learning how to program?

When programming courses first arrived on campuses, they were part of what was then a new degree major called computer science. You may be surprised to learn that computer science is really about the science. That is, it serves the academic purpose, rather than the training purpose. Design guidelines for computer science curricula are handed down from the Association of Computing Machinery (ACM) and the Computer Society division of the IEEE. You can see their work at www.acm.org/education/curricula-recommendations. If you skim the contents of the computer science guidelines, you'll see how they've divided up the field, and what they consider "core" parts of any program and what could be left as an elective.

There you see the conflict between academics and training. Consider the knowledge area they currently call AL/BasicComputability (this style of naming looking like somebody was over-thinking the problem, but nevermind). Among the topics is "the halting problem," which states that a Turing machine (a theoretical simple computing device) cannot be designed to tell if another Turing machine will ever halt (as opposed to running indefinitely) when given a particular input. This statement has far-reaching implications in the area of theoretical computer science, understanding what computation can and cannot do. You wouldn't want to enter a graduate program in computer science without knowing what the halting problem was all about. However, in the practical world of programming, its use is close to zero. You can be a great programmer and go your whole life without hearing about the halting problem and be no worse because of it.

In contrast, look at one of the new topic areas, PF/SecureProgramming. One of the topics is avoiding array overflows. This is always a good idea, but it is emphasized here because array overflows can be manipulated by hackers to produce program actions unanticipated by the original programmer. That's good, practical advice, solid training for the developing programmer. But it's too narrow and too practical to fit in with the academic, "science" part of computer science.

Unfortunately, these attempts to serve all purposes in one place means no one is getting exactly what they want from college. Once you accept this, though, you can decide if college is right for you, and if so, which college is right for you, based on the degree to which you favor one purpose over the others. That's what I'll discuss next.

Tags: 

Share this

Learning How to Program: A Guide. Part VI

Problem Solving

(Be sure to check out part 1, part 2, part 3, part 4, and part 5 of this series if you haven't already).

The next step in learning to be a programmer is learning to solve problems with programs. This step is absolutely critical, and is really the foundation of what a good programmer does, but it's sadly under-taught. Before you tackle this step, though, make sure you are finished with the first step, which is learning the basic syntax of whatever language you have chosen.

In the previous step, you are really learning how to read a program. To test your abilities in this area, examine programs that use just those parts of the language that you learned about, and make sure you can follow them without reading any accompanying descriptions. In other words, try to execute the programs manually, using pencil and scratch paper if necessary. It's okay if you sometimes have to check your reference on a particular point of syntax or semantics -- maybe you haven't memorized everything yet, but the point is that you should be able to read through a program and comprehend it without too much difficulty. Once you have reached this stage, when you can declare with confidence that you know how to read basic programs in your chosen language, you are ready to learn how to actually write them.

But wait, I hear some of you saying, wasn't I writing programs in the previous step? That's what you told me to do, and that's what I did! In the previous stage, though, you're really just modifying existing programs, expanding or altering them slightly. The goal is to be able to write programs from scratch. I like to compare this to cooking. I am not a good cook, but that's not to say that I haven't sometimes put tasty food on the table. I can do this because I can follow a recipe -- if it's not too tricky -- and I can make small modifications to the recipe if the grocery store was missing a particular ingredient, or I need to make food less spicy for my daughter, or something like that. In contrast to my meager abilities, I had an uncle who was a great cook. Uncle Jim was the sort of guy who could just poke around in your refrigerator and pantry and whip something up that would meet your tastes.

Ultimately, that's what you need to be able to do as a programmer. Someone tells you what the program should do -- the specifications or requirements -- and then it's up to you to figure out how to write a program to do that. That's problem solving.

I just wrote a whole book on the subject. It uses C++ for the example code, so if you know basic C++, or are willing to learn (if you are already learning a similar language like Java, it won't be hard at all), that's where I would recommend you head next. The book's not expensive, but if you want to go ahead and get started, let me give you some ideas.

Do you remember previously how I talked about learning a language step-by-step, so that with each program you write during this learning phase, you are only wrestling with one new idea? One of the best techniques for solving a complicated problem is to divide or reduce the problem in some way so that you are only dealing with one issue at a time. If you aren't sure how to write a program that meets all the given specifications, just change the specifications. This is only temporary, of course, and eventually you'll have to solve the problem as written, in the meantime you can make progress, build a foundation for solving the entire problem, and possibly discover more about the problem and its ultimate solution.

The most important thing about this phase, the problem-solving phase of your development as a programmer, is that it cannot be skipped. Students can gain a lot of confidence with program modification, messing-around, experimentation, whatever you want to call it, and while it's an important first step, no amount of that can make you a programmer. I see a lot of fledgling programmers who are in such a hurry to get to the "good stuff," more advanced programming with impressive output, that they press forward without realizing that they've passed over trying to master the crucial skill that determines whether or not they're really going to enjoy programming. They learn a lot about programming without ever really doing any. Don't be this person!

Tags: 

Share this

Learning How to Program: A Guide. Part V

Let's Do It, Already.

(Be sure to check out part 1, part 2, part 3, and part 4 of this series if you haven't already).

You've definitely decided to give programming a try, and you've picked out your introductory language. So now what?

You need to install whatever development tools you're going to use. You can get started with just a text editor and a command-line compiler, and you might even know someone who tells you that "real" programmers don't need all that fancy syntax highlighting and debugging and what else. Don't listen to that person. A nice editor with syntax highlighting (text is different colors depending on its meaning within the programming language) and completion (sort of like the suggestions in a Google search box, it lets you choose from options based on what you've already typed) is very helpful even in the early stages of programming to keep the syntax straight. And a debugger is useful for much more than simply finding and removing bugs in code. It's a great tool for understanding what's going on in the code line-by-line. If there is a section of code that you copied into your editor but don't fully understand how it works, there's nothing better than stepping through the code with the debugger, checking the values of the variables as they change. Get to know your debugger early and use it often.

The first program you want to write, though, is going to be the "hello world" program or something equivalent. You just want to make sure that you know how to use the compiler (or interpreter) to actually build and execute a program.

From there, follow along in whatever book or online guide you have. By "follow along" I mean never simply read -- always do. Write programs every step of the way to confirm your understanding of what you have read. Always take it one simple step at a time. By that I mean never introduce more than one "new" thing at a time in your programs. Also, experiment is much as possible at each step before moving on to the next.

Let me give you an example. Suppose you started with a "hello world" program. In C++ the line of code that did all the work would look something like this:

cout << "Hello World!\n";

In Java:

System.out.println("Hello World!");

Python:

print "Hello World!"

Regardless, once that first program works, try playing around with it to do other things. Give yourself specific goals and see if you can achieve them. Can you display "Hello" and "World" on separate lines, for example? What about displaying unusual characters? What if, for example, you wanted a double quotation mark to be displayed?

Then see what comes next in your resource and incorporate that into your tiny program. For example, what often comes next is an explanation of numerical expressions. So try modifying your program to compute and display the number of seconds in one year.

Let's say the next topic after that is variables. Try storing the number of years in a variable called years and then computing (and displaying) the number of seconds in that many years. Think of some other simple computation tasks like that and write simple programs to perform them.

If the next topic is user input, modify your previous programs to accept user input. Read years from the user instead of making it a fixed value, and so on.

One of the suggestions I make repeatedly in my book is that when you're stuck on a problem, you should break it down so that you are only working on one issue at a time. But you can use this concept in the other direction as well. By learning each part of the programming language separately, it's much easier than trying to put lots of new ideas together in one go.

Furthermore, by asking yourself questions, "how can I do X?", and then trying to answer them, you'll learn about the features of the language in a systematic way. You'll make mistakes, but they will be easier to correct because you'll know where to look for them, and you'll learn from them.

Remember, the goal at this stage is to determine whether programming is right for you, and that means whether or not you are enjoying it. When you sit down at your computer to push forward in your learning, how are you feeling? Excited? Curious? If it already feels like punching a clock, that's a bad sign. You should get a nice jolt of satisfaction when one of your programs work. It shouldn't just feel like relief.

Tags: 

Share this

Learning How to Program: A Guide. Part IV

What language should I start with?

(Be sure to check out part 1, part 2, and part 3 of this series if you haven't already).

Here's another question I hear a lot: "If I'm just starting out in programming, what language should I be learning?"

You'll hear a lot of different answers to this question, many passionately defended. Every programmer has a favorite way to program, preferences among programming languages, and ideas about how best to learn this complicated subject. Having taught introductory programming using a variety of languages, though, I've arrived at what I think is truly the only right answer to the question.

Which is: it doesn't much matter.

I know that this answer will send many programmers and professors howling. For that matter, it will displease many authors of computer books. It seems like every year there is a course or book offering a new way to learn introductory programming, and no one wants to think that their innovations aren't making a real difference, but unfortunately I think that's the case. Let's take a little history lesson. A long time ago, when I was a lad with little more than a Vic-20 and a dream, you were supposed to learn programming with the BASIC language. In fact, it had been invented expressly as a "teaching" language, because it was thought that "real" programming languages of the time, like ALGOL and its derivatives, were just too darn complicated and scary for the novice. In the same era there was another language called LOGO, not so well remembered now, that was a rudimentary graphics language in which you moved an imaginary "turtle" around the screen, leaving a visible trail, using commands like FORWARD 30 and LEFT 90. That language was designed to introduce schoolchildren to programming.

Not long after that the world was introduced to Pascal. This language was another ALGOL derivative, but like BASIC and LOGO it was designed as a "teaching" language, just one that included most of the features of what was then called a "modern" programming language. For a while, Pascal was the dominant language used in introductory programming courses.

Then "object-oriented" programming came along. If you don't really know what that term means yet, that's okay, just know that Pascal was not object-oriented, but object-oriented programming seemed to be the way all programming was going, and it was thought that object-oriented programming would be easier for novices to understand. So then the object-oriented language C++ became popular in introductory courses. But C++, although straightforward enough at the beginner level, has some complications at the intermediate and advanced levels. Teachers started looking for a replacement, something that was "simple," or at least "simpler," while still being "modern." Now introductory programming courses were being offered in Java, Smalltalk, and a little later, Python, and a lot of other languages besides.

The point of this discursion is to show that throughout the brief history of computer programming, teachers have tried different introductory languages, believing that they had figured out a way to make programming easier. In the end, though, learning to program remains a difficult task, and the overall success rate appears to be unchanged. What makes the learning process easy or difficult is not the language, but rather the approach and the resources. If you take a course, for example, a good teacher makes a world of difference, but also how the course is structured, how much is asked of the student, how big a step in learning is required from one programming assignment to the next.

But how, then, do you choose which language to start with? Here are a couple of suggested approaches.

You could go down to a bookstore (yes, they still exist!) with a nice selection of introductory programming books and look for a book that you like. The key here is to look for the book you like, not so much the language you like. If the writer's style draws you in, and you can easily follow the text, you're more likely to stick with it. Of course, you want to make sure that whatever programming area you are choosing is something that you can get started on relatively easily. For example, if a book is teaching Web server programming, you'll have to set up a Web server, plug-in the files needed for the programming language to execute, link the server up to some development tools, and so on, so maybe you'd rather start with something easier to set up.

Another approach is to think about the kind of programming you want to do eventually, and then select a language that will start you in that direction. Again, though, I would avoid any situation that has a complicated setup procedure -- not because I think it's necessarily beyond the abilities of a beginner, but because it's a large hurdle that can slow initial progress to a crawl, and because the goal is to find out as quickly as possible how much you actually enjoy programming. Believe me, there are lots of people who really enjoy programming who don't enjoy setting up servers and installing development tools.

So here are some particular languages to consider.

I'm going to start with C++. Among other things, C++ is used in systems programming and in the creation of heavyweight games -- by that I mean the kind of games you would play on a console or PC and pay more than $20 for. Also, as a bonus, C++ is the language used in my book. Am I really going to recommend a language on that basis? To quote Phineas: "Yes. Yes I am." If you get into programming and find that you truly enjoy it, the next, most crucial step is learning to solve problems, and I honestly believe my book is a great way to do so, or wouldn't have written it. Anyway, if you want to learn C and C++ and don't want to shell out any cash yet, a good place to start is cprogramming.com. The site contains lots of good basic information about setting up a compiler, language syntax, and so on. There's also a section on C++ books for beginners. Another great resource is cplusplus.com. There's a forum there specifically for new programmers.

If you are interested in web application programming, from small websites up to large-scale enterprise web services, you might look at Java, a C++-derived language. As a bonus, Android applications are typically written in Java, if phone app development is an interest. There are lots of good Java resources freely available on the Internet. You might as well start here: docs.oracle.com/javase/tutorial/index.html. You have several choices when it comes to free Java development environments. Personally I like Eclipse, but believe me, opinions vary. My main advice, and this goes for every language, not just Java, is to remember that the goal is to get in there and start programming. At this stage, don't spend a lot of time worrying about whether or not you're getting the "best" development environment. If you can install it on your computer and figure out how to get it to work, that's good enough. Put a check in that box and move on.

If you think Windows business application programming might be your bag, you might look into Microsoft's C#, yet another C++-derived language. Knowledge of this language will also prepare you for developing on a Windows Phone. There are almost no owners of Windows Phones, which makes learning how to develop for them kind of pointless, but that breeds a lovable underdog mentality, sort of like Chicago Cubs fans. Seriously, though, if you'd like to start with C#, you'll want to start with the official Microsoft pages, such as: msdn.microsoft.com/en-us/vstudio/hh341490.aspx (if my history with Microsoft's site is any guide, expect this link to go dead in mere minutes). From there you can grab Visual Studio Express, the free version of their development suite (which is a good C++ environment, as well).

Guess what? Pascal still exists and is still a reasonable place to start. I haven't tried this development environment, but I hear good things about Free Pascal (www.freepascal.org).

There is also Python, an interpreted language that uses a variety of programming paradigms (if that expression doesn't mean anything to you yet, don't worry, it will). The language is primarily used for scripting, both on websites and elsewhere. Some undergraduate computer science programs have switched to Python as the introductory language, claiming, of course, that students are learning more, or learning easier. I don't buy it, but it's a good place to start as any. Check out wiki.python.org/moin/BeginnersGuide.

Another scripting language is PHP, although unlike Python, PHP is explicitly a web language, with code embedded in HTML pages. As such, I don't know that it's a great place to start if you're just trying to figure out how to program or whether you like programming, unless web programming is specifically what you want to do. If so, head over to php.net/manual/en/getting-started.php.

Okay, I'm going to stop here. There are lots of other languages to choose from, but I think you're best off picking one from the list above. Once you learn the basics of programming, you should explore other languages, and that includes the funky ones like Prolog or Haskell. But trying to figure out if you like programming with an oddball language like Prolog is like trying to decide how good a seafood restaurant is by ordering something off the "landlubber" menu.

Tags: 

Share this

Learning How to Program: A Guide. Part III

What's the best way to get started?

(Be sure to check out part 1 and part 2 of this series if you haven't already).

Okay, you think you may be a good candidate for programming, and now you want to know where to start.

Your first thought might be to enroll in a class somewhere. That's logical enough; courses teach things and you want to learn. But it is probably not the right choice.

The first problem is the cost. College courses vary widely in price, but none are exactly what I would call cheap. At this stage you are primarily trying to discover your inner programmer -- or discover whether or not an inner programmer dwells within you. If it turns out the answer to that question is "no," there's no shame in that, but you would like to get that answer as inexpensively as possible.

The second problem is that choosing a good school is a difficult and time-consuming process. You might have to go through this process eventually, and I'll discuss some tips about this later, but it's a lot of effort when you just want to get your feet wet.

The third problem is that it may take several courses before you find out for sure whether or not you really enjoy programming. Depending on your prior educational experience, and where you enroll, you might not be allowed to start with a programming course, or even a computer science or information systems course at all. And depending on how the first programming course is structured, it may not be a good yardstick to measure yourself against. Lots of undergraduate computer science curriculum start with an "easy" course that gently introduces programming concepts, requiring mostly mechanical operations from the students' brains with very little demands on their problem-solving ability. Ultimately, though, problem-solving ability is what programming is all about, which is why it's the subject of my book. So what happens is that the student sails through the first course with ease, because it's really a using-the-software course, like an Excel course, and doesn't discover the kind of thinking programming ultimately requires until a later course. By that time, the student has made a substantial investment of time and money, and is reluctant to stop even if things go poorly. This situation isn't good for anybody.

Or you could run into the reverse situation, a course that's very hard for you, but is it the material or the instructor that's not clicking for you?

I want to be clear about what I am saying here. Enrolling in a course or program, whether at a college or some independent training outfit, is an excellent idea for programmers. It's just not how I would recommend you find out if you are a programmer. (I feel the same way about any field. I wouldn't suggest enrolling in law school, for example, without doing everything possible to find out if you enjoy the law first).

Instead, I would suggest trying to learn the basics of programming on your own. Wait, I hear some of you saying: "That's crazy. Programming is tough. I need someone to show me the way." You probably will need some help, but not as much as you think, and you can get the help you need without resorting to a formal class.

So, to sum up, the best way to get started is to scoop up some resources (like books or compilers, that kind of thing) and start playing around with code. Before we get down to specifics, though, we need to answer another question: what programming language should you start with? And that's another article.

Tags: 

Share this

Pages

Subscribe to Front page feed