The Mistakes I Made As a Beginner Programmer

The Mistakes I Made As a Beginner Programmer

If you are a beginner programmer, this article is not meant to make you feel bad about the mistakes that you might be making, but rather to teach you to spot signs of them, teach you how to spot them, and remind you to avoid them. Update: This article is now part of my book “The Professional Programmer”.

Not Taking Breaks

You are a human and your brain needs breaks.

Not Understanding that Code Problems Will Cause Data Problems

Even the smallest bugs in a program’s code will result in an unpredictable state for the data it manages.

Having the Wrong Attitude About Errors

Errors are a good thing. They mean you are making progress.

Obsessing About Best Practices

The term “best practices” implies that no further research is needed

Not Questioning Existing Code

As a beginner, you should just assume that any undocumented code that you do not understand is a candidate for being bad. Question it.

Underestimating the Importance of Code Quality

If you can only focus on one aspect of the code that you write, it should be its readability

Over-Using Shared State

Every variable we define represents a shared state. It holds data that can be changed by all elements in the same scope as that variable.

Picking the First Solution

While the first solution might be tempting, the good solutions are usually discovered once you start questioning all the solutions that you find

Planning for the Unknown

Always write the minimum amount of code that you need today for the solution that you are implementing.

Planning Too Much Before Writing Code

Planning before jumping into writing code is a good thing, but even good things can hurt you when you do too much of them

Having the Wrong Attitude Towards Code Reviews

Look at every code review as a learning opportunity

Writing Code Without Planning

Writing quality programs is a process with a flow

Obsessing About Performance

If you cannot measure the suspected performance problem with the code, do not attempt to optimize it

Not Picking the Right Tool for the Job

Tools are continually improving and you need to get comfortable learning about them and using them.

Making Existing Code Worse

Duplicating code

Not Using Encapsulation

Not using encapsulation often leads to harder-to-maintain systems

Writing Comments About the Obvious Things

Structure your comments to answer the question of WHY this code is being written rather than “what is this code doing”

Not Using Source Control

Commit often and commit early

Reinventing the wheel

Unless you actually need a wheel that is not used in its typical design, do not reinvent it. Just use the damn wheel.

Not Writing Tests

If you are not writing tests in code, you are most likely testing your program some other way, manually

Not Using the Right Data Structures

Using lists (arrays) instead of maps (objects) to manage records

Assuming That If Things are Working Then Things are Right

If you do not write a test case to document your decision, future maintainers of your function will have no clue if your ignoring of negative numbers was intentional or buggy

Not Targeting the End-user Experience

The easiest way to add a feature to an application is to look at it from the point of view of the user, not how it fits in the current User Interface.

Not Quitting

When it comes to writing programs, the right mentality is fail early and fail often.

Not Googling

Google It First

Source

Similar products

Get in