If you are new at programming, here is some sane advice for you.
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.
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.
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.
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 last time you see them.
Runtime errors can be hard to figure out but the next item on this list may help you with that.
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?
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!
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).
That’s it. I hope it will make your journey into coding a tad easier.