Random Ramblings

Menu

Some Advice for Beginners

The list is built from my own experience since we are all newbies at something, right?

The list could be a lot longer but I have picked 7 important pieces of advice that recently have had some relevance for me while mentoring.

1. Have Fun!

Yes, that’s right. This is the first and most important piece of advice. Coding is supposed to be fun. If you are not having fun, maybe coding is not for you 🙂

2. Use Existing Guide Lines

You may be a beginner and you may be in over your head but the sooner you start using existing guide lines such as naming standards and best practices, the sooner your coding skills will take off. Your company may have existing coding standards (they should) and they are there for a reason. Following guide lines and standards will help you and your mentor better understand the code.

Also, your code will probably not pass code review without following existing standards and it is a real pain to fix it all later.

3. Your Code is not a Special Case

I am sorry I have to break this to you but your code is in no way ground breaking or requires special treatment. That means you do not get to use gotos liberally, use inheritance like the world has never seen before, or put all 3,000 lines of your program in the same file.

Everybody else can do without strange constructs and so can you.

4. Read the Error Messages

If the compiler refuses to compile your code, then by all means read the errors messages. They may be cryptic but you might as well get used to them because it won’t be the first time you see them.

Runtime errors can be hard to figure out but the next item on this list may help you with that.

5. Debug Everything

Debugging is really, really, really important. Someone once gave me the advice to always debug through your code. So this piece of advice applies to everybody, not just beginners.

Debugging will help your understand how your code is working. Whenever I write a piece of code I step through it with the debugger, even though it appears to be working. A good way of doing this is to debug through your unit tests.

So, learn how to debug in the programming environment that you are starting to learn. Did I mention that it is important?

6. The Error is Most Likely in Your Code

If your code fails (and it will) it is like 99.99 percent certain that you are the one who introduced a bug. The bug is not in the programming language or in the platform. It is in your code!

So it you think that .NET cannot save files larger that 50 lines or that C# is slow at simple math operations, then you are wrong.

The bug is in your code!

7. Stop Excusing

Everybody seems to make excuses for their code. There is no reason to. Your code has bugs and it could be designed better but I am yet to meet a programmer who writes perfect code. If your mentor ridicules your code, you need to find a better mentor (yes, we are all guilty of laughing at some poor guy’s code).