Skip to content
Advertisements

A Word of Advice for First Time Programmers

Since September, I’ve been learning C++ in my Computer Science class. To read more about C++, click here. It’s no cake walk, but it’s not an unattainable skill either. I could go on and on about the topics we covered – I will after Finals because hello free time – but this post just contains tips to get you through that rough beginning.

On self-teaching: I think this is a fine option if approached correctly. Find a decent programming textbook, a legitimate website, and an online course to follow.

I read Introduction to Programming with C++ (Third Edition).

I reference cplusplus.com

And I hear good things about edx.com which offers 100% free and self-paced courses.

Only use forums when absolutely necessary and only to find little tidbits that steer you in the right direction. Most code and/or advice, that I’ve seen out there, is going to fall under the following categories:

  • BAD code
  • Things that aren’t applicable at your level. (I’ll say more about this in a minute because it raises a big point)
  • Decent code that gives you a general idea of what you should be thinking (rare)

Try to stick with the book, guides that someone took time to create instead of a random forum post, and videos from good programmers on YouTube.

Back to that second bullet point.  I’ve often noticed a major difference between the self-taught programmer versus formally educated programmer is the self-taught programmer isn’t learning at the right order and pace.

In my CS class, we take things one step at a time. We learn an idea, apply it, learn another, apply it, and so forth. Sometimes those basic ideas are rarely used later on or you’ll eventually learn a better approach, but you shouldn’t try to use advanced ideas before you’re ready. That’s why I recommend following a textbook so the ideas are being approached in the right order. It helps to avoid getting really confused and writing over-complicated code. So that’s why referencing forums is especially dicey – you might feel tempted to grab someone’s code that is using concepts ahead of your learning. But if you’re inserting those concepts into a program without truly understanding how they work, well, that’s just asking for trouble.

On studying: There’s no glossing over concepts in programming. I’m certainly guilty of skimming through my readings in other classes, but doing that in programming will come back to haunt you. I usually need to read and watch everything several times.

On assignments: Especially as beginners, good programs aren’t written in one day. Start early, allowing plenty of time for bad things to happen. Even if you’re not ready to tackle the entire assignment, write what you can. You will run into compile, runtime, and worst of all, logic errors. You will get mentally burned out. You will need to take breaks. Even if that isn’t true for every assignment, prepare like it will be true for every assignment. Sometimes the programs that seem easy will challenge you in unexpected ways.

On learning good habits: Writing neat code is as important as writing code that works. No one likes reading a block of horribly indented text and that’s even more true if that block of text has all kinds of symbols. Find out if your IDE has features for proper indentation. In QT Creator, pressing ctrl + A, then ctrl + I indents everything correctly. Get into the habit of indenting the program yourself, then use the auto-format tools to see how good you are at free-handing it. Remember that no auto-format tool will fix everything for you, especially if you have things on the “wrong” line. For example: Braces should always be on their

{

own

}

line.

On handling broken programs: The debugger is your friend. I exclusively code in QT Creator, but the debugger should work similarly and easily across all IDEs. Set a break point at the start of your code and “step over” every line while paying attention to what’s happening with your variables. If you’re debugging a function, “step into” it to see what’s going wrong (or hopefully, right).

On libraries: Functions make your life easier so take advantage of them. Get familiar with the many libraries available for C++. You can find that here. For example, cmath. It contains trigonometric functions, exponential and logarithmic functions, rounding and remainder functions, power functions, comparison functions, and more. Other good ones to know are cstdlib, cstring, and ctime.

On asking for help: One of my greatest downfalls was not asking for help fast enough. I’d struggle with a program for days, sometimes meeting with my instructor the day an assignment was due. No one is going to hand you the answers, but someone can point you in the right direction. Most of the time, that’s all you’ll need to get the kinks out of a program. If your instructor is okay with it, discuss issues among your peers. It’s usually fine as long as you don’t share code.

C++ programming tutorials in the future! Happy programming!

Advertisements

2 Comments »

  1. Other sites for self-study include Microsoft Virtual Academy and Channel 9 but keep in mind their focus is Microsoft technologies.

    I would not dismiss forums. They are a valuable tool when used correctly. Maybe you will have better luck with one that is beginner friendly? Researching is a big part of being a programmer and sometimes that bad code can lead you to the solution (if you understand what it does and how it applies to your problem). The key word is “understand” otherwise, it would be what you said, “asking for trouble.”

    That said if you have an instructor, a TA, or peers, I would go there for help first and don’t be stubborn about asking for help.

    I strongly agree with having good coding habits. It helps to think of your code is the most authoritative documentation of what your program does. If you cannot understand your code, how can you tell someone what it does? A good IDE does help but it is only a tool. It can help you with indentations and style but other than templates, that is about it. Keep in mind that you might not be the person to maintain it throughout its lifecycle. The people who take it over after you will be thankful.

    It looks like your next step is data structures and algorithms. Have fun with those classes.

    Liked by 1 person

  2. Thank you for providing more online resources. I haven’t messed around with them much but I know there are several free and decent websites.

    I do think forums can be a valuable tool, after other more reliable resources of course. Stack exchange has decent resources and the forums are cplusplus are good. I also like Reddit. There are subreddits for computer science and programming/language-specific questions. From my experience, users don’t comment unless they understand the question so the advice is usually solid. I would definitely advise people to offer some piece of their code and the issue they’re having. No one wants to “do someone’s homework” for them.

    I’m really looking forward to my next classes! It’s exciting how much we’re learning each term. Data structures, algorithms, GUI programming, some concepts of software engineering, etc., are coming up. Fun stuff!

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: