32 Tips On How To Improve Programming Skills
32 Tips On How To Improve Programming Skills
databasestar.com/how-to-improve-programming-skills
10 de octubre de 2018
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!
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.
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
1/15
the most perfect way to improve, but it certainly helps. Running a debug session can also
be useful.
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.
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.
Being a reviewer of other pieces of code means you need to analyse it carefully and ask
yourself a few questions:
2/15
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.
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.
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.
3/15
(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!
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.
4/15
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.
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.
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.
5/15
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.
It’s also helpful to store this in a common location so other team members can see it.
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.
This is a big topic and is the subject of many books, but some of the main points are:
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.
6/15
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.
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.
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.
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.
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.
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.
7/15
So, when you sit down to think about what you need to develop, try to keep it simple.
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.
There are a lot of code editors out there, and they fall into one of three main types:
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.
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.
8/15
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.
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.
Sometimes complicated business rules or logic is captured in the code and nobody knows
how it works or why it’s done that way.
9/15
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.
“This function takes the input number, loops through an array, and returns an item it finds
with the matching number based on some rules”
“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.
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.
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.
10/15
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.
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.
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.
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.
11/15
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.
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
Javascript – document.write
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.
12/15
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.
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.
13/15
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.
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.
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:
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.
14/15
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.
Google.
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.
15/15