top of page

How to become a better programmer? Practise, practise and practise…



coding

How does one become a good programmer? Clearly one has to learn how to program first (such as by joining one of our courses, say). But learning how to do things is only the first, albeit necessary, step. To go from being able to program to being able to program well requires more.

Here’s the short version of what is required: Practise, practise and practise. The more code you write, the better. “Flex your finger muscles” as I like to say to my students; “the keyboard is your gym”. Did I say you should practise loads?

On one level this is obvious. It is true for every skill we learn – the more we use it the better we get at it. And programming is no exception. However there is a bit more to ‘practising’ when it comes to coding.

Learning new commands (functions) and packages

Any programming language has a very large number of commands available for the programmer to use. No programmer, no matter how good and experienced, knows them all and knows how to use them all. And no course will teach you all or most of these commands – a course that tries to teach you how to use a large number of commands would be a very long, boring and tedious one! Instead, typically when a programmer is writing some code and they wish to do something specific, they will first look up whether there is a function that does this already. The first (and only) port of call is online these days. I periodically find out about new functions that I can then add to my toolbox as I look up how to do something I have never done before (or maybe something I had done in the past but forgotten about it).

In programming languages such as Python, one can also find packages written by other programmers that provide a set of functions specific to a certain topic that can be imported and used.

Learning new way of doing things

Commands are part of programming, but what matters more is the programming techniques used. A course for beginners will introduce students to the key programming techniques, but as a programmer becomes more confident and proficient they will be ready to use more advanced and complex techniques. As programmers become more experienced, they will start writing code that is more complex and they will start to realise that the techniques they are using are not allowing them to achieve what they want in an efficient manner (or possibly not at all). An online search on the many resources available on the internet will show up alternatives that the programmer can then adapt and learn how to use. Here’s an example (in Python). A beginner who needs to sort through a list of numbers to find the ones greater than, say 10, will possibly do as follows:

numbers = [3, 7, 1, 34, 14, 8]

numbers_greater_than_10 = []

for number in numbers:

if number > 10:

numbers_greater_than_10.append(number)

print(numbers_greater_than_10)

As they become more experienced, they might write this:

numbers = [3, 7, 1, 34, 14, 8]

print([number for number in numbers if number > 10])

The latter approach is not only shorter (programmers are lazy and generally prefer to write fewer lines of code whenever they can) but offers other advantages and more flexibility.

Learning how to find and fix errors and bugs

Errors and bugs are unavoidable when writing a program. The skill is not so much in avoiding them in the first place, but in finding them and fixing them quickly and efficiently. Courses introduce ways and means of looking for bugs, and debugging your code. But the only real way of learning this is to do it yourself. The more code you write the more bugs you will have and therefore the more experienced you will become at debugging.

How to get enough practice

Often, people have ideas of programs they might want to write, whether it’s games or solutions to problems they have encountered etc. But sometimes one can run out of ideas. There are a number of websites that can help with providing practising. Two of these are checkio.org and codewars.com. Both sites are similar (I currently prefer codewars) in that they offer challenges based on your level of experience which you can attempt to solve by writing code. The site will check the code you write and will tell you whether it works or not. Then it provides you with solutions that others have written to solve the same task. This is a very important process as it exposes a programmer to different functions and commands, different styles of coding etc… Although you should always remember that it doesn’t mean that because someone else wrote it then it is necessarily a good way of doing things. use you judgement on which coding style is ‘best’, or indeed which one you prefer.

As always, do not hesitate to get in touch with us for further advice. We're always happy to help. info@codetoday.co.uk

10 views

Python Coding for Young People

CT-Unlimited-FinalRAW-transparent.png

Codetoday Unlimited is for the curious teenager or preteen keen to learn proper Python coding. Stephen's courses start from the basics and carry on to intermediate and advanced levels.

Python Coding for Adults

The Python Coding Place is Stephen's platform full of courses and other resources for beginners and intermediate learners. The focus is on clarity and Stephen's unique communication style.

bottom of page