As programmers, we should be always looking to improve our skills and how we do our job.
In this article, I’ve shared a range of tips on how to improve programming skills, which I hope you can benefit from!
1 – Read Stack Overflow
A great resource for programmers is the website Stack Overflow. It contains a lot of information that programmers find useful. By far, the section that I use most is the question and answer section.
There is a large question and answer section on this site that allows users to ask all kinds of programming questions, from which version of a programming language to use, to how to fix and optimise a certain piece of code, to how to resolve very specific errors. There are some very smart and knowledgeable people on Stack Overflow, and I recommend visiting the site regularly.
Answers are voted on by the community and the most popular answer is shown first. It also allows tagging of questions, so if you’re only interested in ASP questions, you can restrict your search to just show those.
2 – Look At Existing Systems
Another tip for how to improve coding skills is to have a look at some existing systems. You can probably do this in your workplace if you have the access set up.
Getting to look at the code of other systems can be helpful in several ways:
- You can see how other people have coded in the past. Coding styles, modules, formatting, and approaches to certain problems are shown in the code.
- You can see which bugs have been fixed if the code has been commented at the top of the module
- You may notice bad practices being done in some of the code. If you’re aware of them, you can avoid them in your code.
- You can see how the system interfaces with other systems, which is good to know if you ever need to do the same thing.
As mentioned in the third point above, getting to look at the code of existing systems isn’t always a good thing. Sometimes us programmers fall into bad habits, whether it’s because we have a deadline, or we just didn’t know any better. Looking at other code isn’t the most perfect way to improve, but it certainly helps. Running a debug session can also be useful.
3 – Develop Small “Proof of Concepts”
A proof of concept is a small piece of code that is developed to perform one task. Its purpose is to prove a concept, to test if something is possible and if it works.
You might build a proof of concept to import data from a particular system. There’s no need to build a full application to see how this could be done. You can just build the part of the application that does the interface and data loading work, do some testing, and see what your results are.
This is helpful for more difficult concepts, the kind of things that make you ask “what if…” or “how about…”. Rather than messing with an entire application to see if something will work, sometimes it’s easier and faster in the long run to write a couple of modules to see if something is better or if it is possible.
4 – Get Your Code Peer Reviewed
A common practice in development teams is the peer review of the code. Essentially, when you finish writing some code, you get someone in your team to review it. This is done for several reasons:
- It gets another person (another “set of eyes”) to look at it, who often picks up things you didn’t see when writing the code
- It’s another level of testing to find any issues or to help with debugging.
- It can be used to get ideas on how to improve the code and make it run better
The peer review process is good as it helps to improve coding skills through getting it double-checked by team members.
5 – Peer Review Other People’s Code
On the other side of the above point, another tip on how to improve coding skills is to actually peer review other people’s code. You may actually be assigned to do this as part of your team, or it may be something you need to volunteer for.
Being a reviewer of other pieces of code means you need to analyse it carefully and ask yourself a few questions:
- Is it clear what this code is trying to do?
- Does it comply with the standards of the team and the organisation?
- Are there any bugs/typos/missing characters in the code?
- Is there a better or more efficient way of doing something?
Making you think about code that others have written can help improve your coding skills. You get to look at code that isn’t your own, and you can see how other people develop their code, which can give you ideas about your work.
I highly recommend reading Clean Code by Robert Martin (you can read my review here). This will improve the way you write code for the rest of your career.
6 – Improve Your Old Code
Learning to improve your coding skills isn’t always about your current code. Another way you can do this is to go back to code you have written in the past and look at ways to improve it.
- Are there more efficient ways of getting the same thing done?
- Has the version of the language changed, bringing in new features?
- Have you learnt better ways or methods of developing code?
- Have you worked out how to fix a bug that you had in the old code?
Going back to old code can help you come up with new ideas on how to make it better. If it’s good code already, you can have a look at how you wrote the code back then and use it as material for your next project.
7 – Read Textbooks
This tip might be more of an old-fashioned tip, but I think it’s still a good one.
Programming textbooks offer a great way of improving your programming skills. There’s no shortage of programming textbooks out there, from a variety of publishers. You don’t need to read the For Dummies textbooks if you don’t need to, as there are some other advanced textbooks on the market. I’ve created a list of 19 of the best database books here and a list of best books for programmers here.
When I was working on a project as an Oracle developer, a textbook I used was on performance tuning. While I had remembered a few things from university, this textbook highlighted a lot of other points that I didn’t consider, and I think it helped me build a better solution.
Also, with the increase in tablet and e-reader usage, there has never been a better time to get an eBook. You don’t need to go to a bookstore to buy a physical copy if you can download it from Amazon and read it electronically. However, the option of a physical book is still there, for those of you that prefer having a hard copy.
8 – Stay Up To Date on New Features
It’s a good idea to stay up to date on news in your industry, especially information on programming trends and releases. If you’re a programmer working on Java, you should try to keep up to date on new releases and libraries that are developed. Upcoming features (e.g. the recently released Oracle 18c) are shared in the community and can help to plan for future work.
Also, staying up to date with the news on programming can also let you know when some features will be deprecated in newer releases. If you have any code that uses these features, you can look at updating the code to use more efficient and current methods.
Getting to know what’s coming up and what isn’t going to be supported any more is a great way to improve your coding skills.
9 – Ask Questions
One of the best methods for how to improve programming skills is just to ask people.
Talk to people in your team, or in other teams, about any problems you might have with the work you’re doing. Ask questions, ask for advice, seek some guidance on how you can get a piece of code working.
Your team is there to help you and you’re all working towards a common goal, so it’s likely they will be able to support you. More experienced team members can be helpful as they have seen a lot of code and have a lot of ideas on how things can be done.
Don’t forget junior members as well. Junior programmers are fresh out of university and have learnt the latest good practices and techniques for getting things done. The information will be fresh in their mind!
10 – Explain Your Work To Others
The final tip I have for improving coding skills is to explain your code to others.
This isn’t something you can actively seek out and do. It’s more something you can do when the opportunity arises, such as when others ask about your code or advice on something they’re working on.
Having to explain some code you’ve written means that you need to be able to understand it. You can’t just “kind of” know how it works, you need to be able to understand it and explain it clearly to someone who doesn’t know what it’s doing.
Being able to answer any questions on the code you’ve written is also a benefit of learning your code. If others ask you questions, you should know the answers, and if not, then you can go and look for them, which will also improve your programming skills.
11 – Write Readable Code
One of the best things that new programmers can do is to write code that is readable.
The code that you write is no longer being used just for uni assignments or personal projects. It’s being used in company websites, enterprise systems and other programs. It’s important that the code is readable?
Why is that?
Other people will be reading it in the future. Other people will need to maintain it, so the easier it is to read, the easier it is to maintain.
Also, you might need to come back to the code at a later date – 6 months or 12 months in the future. You may have forgotten exactly what the code does, and making it readable will help you re-learn what it does.
How can you make your code readable?
- Use indentation. Each line should be indented to match the structure of the code.
- Use line breaks. Leave a space between functions and other key areas of the code.
- Don’t write entire functions on a single line. Break it up over several lines.
These tips and many more should follow your team’s coding standards. For example, if your team specifies that indentation should be done at 2 spaces, then follow that rule. It makes all the code consistent.
There are a lot of benefits of learning to code, and writing readable code will help you whether you’re designing websites, starting a business, or any other role as a developer.
12 – Plan Before Writing Your Code
One of the most ineffective things you can do is to start coding before planning.
I’ve done this before. Many times. I think I know what needs to be done, I start coding, and get to a point where I’m stuck and I need to stop and think.
Sure, you can go ahead and code for simple problems. But, many problems and tasks that we need to perform as software developers are not simple. They’re hard. So, thinking about what you’re trying to do and how to solve it first is a great way to get the right solution, and save time in the process.
Take some time before you start coding to plan what you’re going to do. This could be writing pseudo code or drawing a diagram. Whatever works for you and the problem that you’re trying to solve.
13 – Draw Out Complicated Ideas
This is related to the idea of planning before coding.
Often, as programmers, we need to solve complicated requirements and ideas. We need to get the software working, and do it in a way that is fast, maintainable, and gives the correct results. It can be hard to balance those points.
A good way to help you do this is to draw out your ideas.
Get a pen and paper. Start drawing. It doesn’t have to be neat. It can only be for your reference, or you may want to show other developers for feedback.
Often, the act of drawing something out will help you think about a problem in a different way, or make you realise things you didn’t see before.
I often draw out my solutions. I usually draw a rough ERD or object diagram before I start because we all know how hard it is to change the code if you need to change the entity relationship diagram.
If you prefer an electronic tool, I recommend Visio in my article on becoming a Business Analyst but have also used LucidChart recently.
It’s also helpful to store this in a common location so other team members can see it.
14 – Write Code That Is Manageable
Probably one of the most important habits for new programmers is to write code that is manageable.
We’ve all been under pressure to “get things done” and to meet deadlines with code. However, the better solution for the long-term for everyone involved is not to compromise on the manageability of code.
What does this mean? It means you should write code that is easy to maintain and manage in the future.
Other people will need to support this in the future and will need to go in and make changes to what you’ve written if bugs are found or new features are introduced. You might even need to go back to the code in 6 months, 12 months, or even longer, to make these changes yourself.
It’s easier for everyone if the code is maintainable. It’s easier for the developers to change, and the business gets the changes they need quicker and cheaper.
How do you write maintainable code?
This is a big topic and is the subject of many books, but some of the main points are:
- Use consistent naming conventions (I’ll cover this shortly)
- Follow the DRY principle – Don’t Repeat Yourself
- Use object-oriented programming where you can
- Ensure unit tests are written and pass
If you want to read more about writing good quality code, read Clean Code by Robert Martin and Code Complete by Steve McConnell. I’ve read and reviewed Clean Code recently, and am currently reading Code Complete.
15 – Think of Descriptive Names for Variables and Methods
I mentioned earlier that it’s a good idea to follow the team’s coding standards. Well, one of the best habits for new programmers is to stick with the naming conventions that the team follows.
Why is this important?
Well, the names you give to things are one of the hardest tasks a developer can do, but also one of the most beneficial if done right.
Which variable name looks easier to understand?
User theUser = new User();
User loggedInUser = new User();
The name that you give to your variables and methods will make your code easier to read, easier to maintain, and easier to develop with.
The book Clean Code has many points on naming things.
It highlighted to me that it’s easy to give something an undescriptive name, such as getTotal() on an object. But, it’s far better in the long-term to spend a few extra seconds to come up with a more descriptive name, so that other developers (including you) know exactly what something refers to (such as calling the method getTotalHoursWorkedForPeriod()).
Also, if there’s a standard that your team uses for naming variables and methods, you should follow it. It makes the code more consistent and easier to maintain.
16 – Don’t Over-Develop Features
It can be tempting, when developing a feature of a program, to make it clever. It might seem like a good idea to put in extra intelligence and logic into the code to make it smarter.
Often this is done for good reasons, such as error handling or to cater for flexibility by using database variables.
Other times, though, it’s done because the developer wants to try out new techniques, or add in features to handle “what if” scenarios that won’t happen.
There’s a fine line between making something maintainable, and overdeveloping something so it is too complicated for use.
This is something that comes with experience. However, you can get your solution and code reviewed by team members to make sure that it’s doing the right thing and that you’re not overdeveloping something.
So, when you sit down to think about what you need to develop, try to keep it simple.
17 – Be Smarter about Debugging
Software needs to be debugged. Not everything we write will work the first time.
To do this, you can do it the slow way, by making changes to your code and seeing the final output.
Or, you can do it the smart way, by using what you already have.
Many IDEs have in-built debuggers that have pretty good functionality. They let you step through the code, add breakpoints, add watch variables and all kinds of triggers.
If you’re developing something for the web, Firefox has a great debugging tool that you can use.
So, one of the best habits for new programmers is to use the debugging tools that you have to your advantage. It will improve your productivity and reduce errors.
18 – Use a Good Editor
Another tip for new programmers is to use a good code editor.
There are a lot of code editors out there, and they fall into one of three main types:
- Basic text editors and command line editors (vim, emacs)
- More advanced text editors (Notepad++, Sublime Text)
- Full IDEs (Visual Studio, Eclipse)
The choice of IDE is often a team decision so that the entire team can be working on the same tools and have the same experience.
There’s a long debate over which style of tool is better. Some developers prefer IDEs because the features they contain will save you time and ensure better quality code. Other prefer basic text editors as they are lightweight and force better practices.
Personally, I prefer using IDEs and use Notepad++ where I can’t.
The point is, if your team is using a tool which isn’t the best choice or isn’t helping them be more productive, it might be time to switch to a new tool.
Take a look at a list of software development tools here.
19 – Perform Unit Testing
Unit testing is an important part of development. It makes sure that the code module works as expected before passing it on to the testing team.
Someone in a team I worked on once said, “Development isn’t complete unless you’ve performed unit testing.” I agree with this. You can’t say you’ve completed developing something if you haven’t run the unit tests on it.
So, as part of your development, one of the best habits for new programmers to get into is performing unit testing. If it’s not something you’re doing at the moment, start doing it. If you’re only doing it sometimes, you should be doing it all of the time.
20 – Always Use Version Control
I can’t imagine programming without version control. It serves many purposes:
- Backs up your code
- Allows teams to work on different areas (or even the same area) of code
- Lets you mark releases and other points in time easily
Having a place to back up your code, other than your local environment, can be a lifesaver. If something happens to your computer, you at least have another copy of your code somewhere. It means you might lose hours of work, instead of days, weeks, or even the entire project.
For anyone who has lost work before, this is a real saver.
Working on a team means that multiple people need to work on the code at the same time. Version control systems allow you to do this and allow changes to be tracked and merged together. This improves the quality of the code. Imagine if every time someone wanted to change the code they needed to have exclusive access to it. Nothing would ever be completed!
Also, it lets you mark points in time easily with code. You can mark what your release versions are, when code is released to the test environment, and other points. This makes it easier for fixing bugs and rolling back changes, as you can go back to a point in time where you saved the code.
If you or your team isn’t using version control, start using it. Now.
It can be set up for application code as well as database code: read more at The Ultimate Guide to Database Version Control.
21 – Explain the Purpose of Complicated Algorithms
I’ve made a couple of points about designing code and making it more maintainable. Sometimes, though, there is some code that no matter how good you name the variables, it’s hard to understand.
Sometimes complicated business rules or logic is captured in the code and nobody knows how it works or why it’s done that way.
If you’re writing or working on any of this kind of logic, it can be a good habit to add comments to this code.
The comments would explain the purpose of the code, rather than what it does.
So, instead of having a comment that just explains what it does:
“This function takes the input number, loops through an array, and returns an item it finds with the matching number based on some rules”
Write a comment that explains the purpose of the function:
“This function works out the most appropriate tax rate for the provided user, based on the business rules provided by Finance. These rules are available here: www.internalsite.company.com/page”
Now, the comment actually explains why the function exists and what rules it is trying to implement.
22 – Assume the Worst of Other Developers
You should assume other people are the worst.
No, not in their personality or ability. People are pretty good, actually.
What I mean, is that you should assume that the code your writing will be worked on by other programmers with minimal experience.
It’s a good habit to get into as a new developer. Write your code as if someone who is new to the company or language can understand it.
Make your public functions and interfaces easy to use, make it hard for other developers to break the code if they call your functions from other code.
Make the code easy to understand by following the tips in this article. Helping your teammates and future developers is one of the best habits for new programmers.
23 – Test on Multiple Platforms
One of the most important things you can do to ensure ease of use of your software is to test it on multiple platforms.
This is probably more important for web-based programs that run in a browser, as there are many browsers out there, and they all behave differently.
When you do your development work, you should make sure that your code works on multiple browsers and environments.
But which ones?
The exact browsers and environments should be dictated by the project team because the more environments you have to test, the more it will cost and the longer it will take.
But, you shouldn’t just test on the latest version of Firefox because that’s what you all use. You should test on multiple browsers to see if your code works.
Parts of this can be easy. Online HTML validators can check that your code complies with standards. There are other online tools that can test what your software looks like and does in other browsers.
But nothing beats actually testing in a browser.
I’ve been at companies where entire departments up until 2014 were still running Internet Explorer version 6 (yes, V6) for years, because one of their core systems did not work on any other version of IE. This is a big problem for companies.
So, if you’re designing software from scratch, make sure it works on multiple browsers and follows standards.
24 – Ask Lots of Questions
A good habit for new programmers to get into is to ask lots of questions.
As someone new to the field and the industry, you have a lot to learn. Even if you did pretty well in your university course, there’s a lot you actually learn on the job.
So, don’t be afraid to ask lots of questions. Other developers have been there. They’ve been the new guy on the team. They know what it’s like.
They would most likely prefer to help you out with a problem or explain something to you than see poor quality code appear in the system.
I’ve said before that I don’t think there is such a thing as a stupid question – it’s much better to ask a stupid question than make a stupid mistake.
So, ask lots of questions. Ask other developers, ask project managers, ask other team members. It’s a great way to learn.
25 – Keep Reading and Learning
The final item on my list of best habits for new programmers is to always keep reading and keep learning.
The world of software development is one that changes constantly. New technologies come out, new languages are used, and new tools are made. It’s an industry that moves faster than many others.
If you stop learning, you’ll get stuck in a role and it will be harder to find a job in the future.
So, always be learning. Read books on software development. Take online courses (such as the ones I’ve created on Database Star Academy). Read online blogs. Go to conferences.
It’s good to keep learning in this industry. It will make you a better developer in the long-term.
26 – Use The Output Command
One of the best ways to work out where a problem is in your code is to use the built-in command that outputs text.
Many languages have this function, which takes a parameter and writes the output to a special window within the IDE. Some of these commands for various languages are:
- Java – system.out.println
- VB.Net – console.writeline
- PL/SQL – dbms_output.put_line
- Python – print
- PHP – print
This functionality is one of the first things we learn when learning a new programming language, and it can be used to display all kinds of information to help you find out what the issue is.
The most common method for these functions in debugging is by outputting variable values. This is good for seeing what a particular value is when the function is called. However, it’s not always the best way to find the cause of the problem.
Some other debugging tips for the output functionality for include:
- Writing out both the variable name and the value, such as “stringFirstName: Johnathan”, so you can see the variable name and the value.
- Markers in the code, so you can see where the code went. You could use the function name or an abbreviation with a number, such as “loadName 001” then “loadName 002” at a different point slightly later in the code. If you see the first but not the second, you know that the code did not follow that path.
- Timing the code. You can set up a timer variable to see how certain parts of the code perform, and also see where the errors are. If a piece of code is expected to run in 2 seconds, but you find it takes 10, then you can see where the problem is.
Learn how to enable this in SQL Developer in this article.
27 – Set Smart Breakpoints
Breakpoints are a fantastic feature. A breakpoint is a feature in an IDE that allows you to indicate a line of code that the execution should pause at when it reaches. I’ve seen this use quite commonly by software developers.
However, there are good and not so good ways of using the breakpoint.
Breakpoints should be used to return to a place in the code that is near where you are investigating. It’s used to save time with debugging – instead of stepping through many lines of code to get to where you need to be, you can go there instantly with a breakpoint.
Remember this when you set a breakpoint. Set it to as late as you can just before where you’re investigating. Don’t set it too early, as you’ll just waste time skipping through functions and code that you don’t need to look at. If you need to verify that certain paths in the code were taken, then use the output tip mentioned above – it’s heaps faster. And we should be doing everything we can to save time and be more efficient software developers.
28 – Use Watch Variables with Triggers
Watch variables is another one on the list of debugging tips which can help you debug faster. A watch variable is where you set a particular variable to be “watched”, which means its name and value are shown in a window within the IDE, so you can see what it’s set to at any point in time. This is great to see how values are changing and what variables are set to when your code breaks.
Be careful of the scope of variables. Most IDEs let you set the scope of the variable to watch. This can be a problem if you’ve got the same variable in a higher scope, which can confuse you if you’re expecting something else.
Also, you can sometimes set triggers with watch variables, which is a great piece of functionality. This means that instead of just watching a variable, you can set a trigger on it, so that when the variable meets a certain condition, the code stops. This is a massive time saver for code with loops.
For example, let’s say you think your code is failing because a certain variable is set to an empty string which breaks further down the line. You can set the trigger so that the code stops if this variable is empty. When it is empty, it stops the moment that it happens, so you can see why. You can then set a breakpoint for further investigation.
Also, you can set them inside loops. Let’s say you think your code is failing because your loop iteration number is too high. You set a watch value on this (loopCounter >= 999, for example), so the code stops. You can step through the code to see if this is the issue.
These first three debugging tips all involve using the IDE, which is one of the best tools you can use as a software developer.
29 – Watch Out for Extra Characters
A seemingly small problem, but can cause a lot of headaches, is when values look like they are OK but actually include extra characters. If you’re outputting variables or watching them then it might look OK to the naked eye. But in reality, they have other characters inside them which are causing problems. This could be:
- Extra spaces, on the end of values or on the start (this is a very common one I’ve found)
- Non-printable characters, such as newlines
- Punctuation (commas, full stops, quotes)
- Other syntax which is not needed, such as HTML tags in your variables
These little things can cause all kinds of problems if not done correctly. Keep an eye out for them when you’re debugging.
30 – Be Careful of Data Types
Sometimes I’ve found that while values look OK when debugging, it’s the data type that causes issues. This isn’t immediately obvious, as I’m usually focused on the values and where the code is at.
However, it’s important to check the type of data as well. Sometimes, functions expect floats but are passed integers. Sometimes a string is expected but a number is passed. Sometimes the conversion is supposed to happen, but it doesn’t.
You can check the types of the variables using a few methods, depending on your IDE:
- Hover over the variable name, which often shows the name, type and value.
- Check the watched variables window, sometimes this shows the type
- Output the variable type in the output window, using the method above.
31 – Try Outrageous Inputs When Debugging
Another way to check that something is working as expected is to try to purposely break it. In many cases, you can set the input values or change existing ones for functions that you’re debugging.
One thing I try to do is set the input values to something totally outrageous and unexpected. This isn’t just make up funny words, but I mean give it some values it’s not expecting:
- Very long input fields – if it’s normally 50 characters, try 200
- Empty input fields
- Extra large files, if you’re working with file inputs
- Extra large or small numbers
It might not be valid for your scenario or your program, but using this technique can help you find out if something strange is happening.
32 – If All Else Fails, Use Google
If you’ve tried the debugging tips in this article, done your own debugging, and still can’t find the issue, I’ve got one more tip.
Many times I’ve been unable to find the solution to a problem, and I’ve gone to search for it on Google and found the answer. Sometimes the answer is shown easily and at the top of the search results, sometimes it takes some digging through forum posts and code samples.
Try to search for the issue you’re having, using words that others are likely to use and are specific. A search term such as “java file import error” may not be as effective as “java file import causing GUI crash”, as the second phrase is more specific to the issue you’re having.
A lot of sites specialise in finding and solving people’s questions on code, and one of the best ones out there is StackOverflow. I’ve used this many times to help me fix problems. It’s a fantastic site.
If it doesn’t give me the answer I need, it often gives me ideas on what the cause could be and other debugging tips.