How to Improve Your Skills as a Programmer: 11 Steps

Table of contents:

How to Improve Your Skills as a Programmer: 11 Steps
How to Improve Your Skills as a Programmer: 11 Steps

Video: How to Improve Your Skills as a Programmer: 11 Steps

Video: How to Improve Your Skills as a Programmer: 11 Steps
Video: How to Calculate the Unemployment Rate 2024, April
Anonim

Programming is one of the most versatile abilities in today's work environment. Programming skills will benefit you and your company in a number of ways, whether you're building a company website or knowing how to fix "redirect" errors. However, complacency with your current abilities will not make you a great programmer. So, read this guide to learn how to develop your skills as a programmer.

Step

Improve Your Skills as a Programmer Step 1
Improve Your Skills as a Programmer Step 1

Step 1. Do a clear analysis of the problem

Improve Your Skills as a Programmer Step 2
Improve Your Skills as a Programmer Step 2

Step 2. Rethink how to solve the problem

Improve Your Skills as a Programmer Step 3
Improve Your Skills as a Programmer Step 3

Step 3. Gather all prerequisites

Take the time to rewrite the goals your program needs to achieve, and who your potential users of your program are. The clarity of the target and potential users of the program will save you time in the future.

Improve Your Skills as a Programmer Step 4
Improve Your Skills as a Programmer Step 4

Step 4. Write an in-depth implementation plan/model

  • For small projects to do on your own, you may simply create a simple formula or a basic flowchart/"flowchart".
  • For larger projects, we recommend that you break the program down into modules, and consider the following:

    • What things each module does;
    • How data is transferred between modules; and
    • How the data will be used in each module.
  • While the process of gathering prerequisites and planning a program isn't as much fun as working on a program in person, keep in mind that rooting for hours of "bugs" can be a lot more annoying. Take the time to properly design the flow and structure of your program from the start, and you may be able to find a much more efficient way to achieve your goals before you even write code!
Improve Your Skills as a Programmer Step 5
Improve Your Skills as a Programmer Step 5

Step 5. Comment your code freely

If you feel your code needs explanation, comment on kdoe. Each function should be given 1-2 lines of comments containing an explanation of the arguments and their results. Code comments should explain more about why the code was written, than what the code does. Remember to update the comments when you update the code!

Improve Your Skills as a Programmer Step 6
Improve Your Skills as a Programmer Step 6

Step 6. Use consistent variable naming conventions so that you can easily track each type of variable, as well as know the function of each variable

You do have to type a lot more than x = a + b * c, but the naming conventions will also make your code easier to error track and maintain. One popular variable naming convention is Hungarian notation -- in this convention, the variable name begins with the variable type, for example intCountLine for integer variables and strUserName for "string" variables. No matter what type of variable naming convention you use, make sure it's consistent and provides a descriptive name for the variable.

Improve Your Skills as a Programmer Step 7
Improve Your Skills as a Programmer Step 7

Step 7. Set your code

Use visual structures to indicate code structure. For example, make an indent in the code block that is in the middle of the condition code (if, else…) or loop (for, while…). Also, try using spaces between variable names and operators, such as addition, subtraction, division, and even equals (Myvariable = 2 + 2). Apart from making code look more elegant, code organization also makes it easier for you to see the flow of the program when you glance at the code.

Improve Your Skills as a Programmer Step 8
Improve Your Skills as a Programmer Step 8

Step 8. Test the entire program

Start by testing each module independently, with the inputs and values you would generally expect for that module. Then, try entering values that are actually still valid, but not very common to eliminate hidden errors. Program testing is an art in itself, but your ability to test programs will improve with practice. Test your program in the following cases:

  • Extreme: Zero values and values well above the maximum estimated values for positive numeric values, blank text for text variables, and nil/"null" values for each parameter.
  • Garbage value. Even if you trust that users of your program will not enter garbage values, don't forget to test the program's response to garbage values.
  • Invalid value. Use zero for the number to be divided, or a negative number if the program asks for a positive number (or if the square root is to be calculated). Non-number values in the "string" variable may be processed as numeric input.
Improve Your Skills as a Programmer Step 9
Improve Your Skills as a Programmer Step 9

Step 9. Practice diligently

Programming is not a static discipline. There's always something new you can learn, and more importantly, there's something that isn't new but is worth relearning.

Improve Your Skills as a Programmer Step 10
Improve Your Skills as a Programmer Step 10

Step 10. Be prepared to accept change

In a realistic work environment, needs are constantly changing. However, the more clearly you know the program's needs when you start programming, and the clearer the program implementation plan once you've started programming, the less likely it is that these changes are the result of poor planning or your understanding.

  • You can actively participate in improving the clarity of the programming process by presenting documentation of your program requirements or implementation plans long before you start programming. Your presentation will help you ensure that what you create is what was really asked for.
  • Set the project up as a time series with demos for each project block, and work on the project block by block. The fewer things you have to think about at one time, the more likely you are to think clearly.
Improve Your Skills as a Programmer Step 11
Improve Your Skills as a Programmer Step 11

Step 11. Start the program simple and apply complexity gradually

When you create a complex program, it is a good idea to create a simple construct of the program and make sure the construction works first. For example, when you want to create an on-screen shape that changes with the movement of the cursor, and changes shape with the speed of the cursor:

  • Start by displaying the box and making the box follow the cursor. Complete the mouse movement tracking code.
  • Next, make the box size related to mouse speed. Complete the speed tracking code and apply it to the resize.
  • Then, create the shape you want to use, and insert the three elements above.
  • This approach introduces you to writing modular code -- in modular code, each component is in its own block. Modular code writing is very useful if you want to reuse code (for example, when you want to use code to track mouse movements in a new project), and make it easier for you to fix code and eliminate errors.

Tips

  • Use an IDE/integrated development environment. A good IDE has a built-in code editor with color coding, code hints, and code complement features, so code editing will be faster as well as less misspelling. IDEs are usually equipped with a "debugger".
  • Separating/packaging reusable code from your application-specific code later makes the code aggregated into a large code library, full of useful functions, error-free, and ready for reuse. These libraries will help you write more powerful and more stable programs in less time.
  • Have a fellow programmer read your code. Your friend may know something that you didn't think of before. Don't have a professional programmer friend? Find online forums discussing your preferred programming language/operating system, and join the discussion.

    • If you go to an online forum, read and pay attention to the forum rules. If you ask nicely, many experts will be happy to help you.
    • Remember to be polite, because you are actually asking for help. Don't get frustrated if you don't understand all the replies at once, and don't expect forum members to read 10,000 lines of code. Ask a question that focuses on a single problem, and submit 5-10 lines of relevant code. That way, you're more likely to get a positive response.
    • Before you start sending questions, do a quick search. Your question may have been experienced, asked, and answered before.
  • Studying source code from other programmers is a good way to develop your skills. Read code from other programmers slowly, step by step. Know the flow of the program and what happens to program variables, and then try writing code that does the same thing (or even expands on that code). You'll learn faster about why things should be written a certain way, and you'll also get tips on writing effective code.
  • Your customers and bosses don't care how your program works. Instead, they care how well your program works. Remember that your clients are smart but busy people. They don't care what kind of data you use, but they will notice whether your program is speeding up or slowing down their work.
  • You can also learn a lot from tutorial sites.
  • Periodically back up the code to an external drive or other device so that you will have a copy of the code in case the computer crashes/turns off. Keep at least one backup in a safe place.
  • Keep the code neat. It's not a matter of aesthetics, but the neatness of the code will make the code easier to read. This step is very important if you want to make changes 6 months after you created the program. Read more about code indentation here.
  • Whenever you complete a sizable portion of the program, do something unrelated to programming, and watch what you've been working on with a fresh brain. Rethink program flow and rewrite programs more effectively and elegantly. Use less code whenever possible.
  • Find a code editor that provides code coloring. It is useful to separate comments, keywords, numbers, "strings", etc.
  • Change the program incrementally as you clear errors, then test corrections before continuing.
  • Use version control systems such as CVS and SVN to help you track code changes and errors.
  • Double-check spelling and syntax. Small mistakes can cause prolonged stress.
  • Make archival copies of your work. In addition to being a reference, you may also be able to reuse some of the code.
  • Use a "debugger", instead of writing statements in code to display variable output. "Debugger" will help you look at the code line by line, so you can spot what part of the code is going wrong.
  • Start small and doable, then build up your skills gradually.
  • Discuss with other programmers. Other people may be good sources of knowledge, especially if you're just starting out.
  • A good way to periodically save your work and have a remote copy is to use a version control system like git or mercurial and a free service like Github or Bitbucket

Warning

  • Copying other people's code is generally a bad habit, but taking small pieces of open source code can be a good way to learn. However, do not copy a program in its entirety and acknowledge that the program is yours. Do not copy code from other programs, unless you are allowed to copy those programs under license.
  • Save your work as you work, or you may lose your work when the computer is unresponsive. If you ignore this warning, you will be resuscitated loudly later!
  • You should be careful when using Hungarian notation (writing the variable type as a prefix) in step 4. Hungarian notation may cause inconsistencies during code editing, or when code is used in other languages/operating systems. Hungarian notation is commonly used in programming languages that don't require you to specify the type of the variable.

Recommended: