Proper programming skills: How to solve problems like a pro?

Moumenisbest
4 min readJun 19, 2024
Photo by Roman Synkevych on Unsplash

Hello once again! it’s been a while I know but today I came back with a topic that I see very important and necessary for beginners as the skills stated by this article will help you solve programming issues you might run into but not just that, I’m going to show you how to do it the proper and efficient way, so, Let’s get started!Honestly (and obviously for some people), Programming is not just writing code, it’s a whole process that is almost always not straightforward. A process involving many steps and potential issues with no clear way of solving them. Luckily, we have tools that help us along the way but in order to get the most out of those tools we have to learn how to use them properly. This article will only focus on two main tools: Search engines and coding communities.

Honestly (and obviously for some people), Programming is not just writing code, it’s a whole process that is almost always not straightforward. A process involving many steps and potential issues with no clear way of solving them. Luckily, we have tools that help us along the way but in order to get the most out of those tools we have to learn how to use them properly. This article will only focus on two main tools: Search engines and coding communities.

First off, Let’s set up some conventions, This article classifies programming problems on three categories: Code issues, Logic issues and behavior issues, Code issues are when you get explicit error messages telling you that you did something wrong, Either from a compiler or from any sort of code runner tool, Logic issues are basically question about how to do a certain thing, For example, “How to use firebase with flutter?” and last but not least Behavior issues happen when your code runs without errors, but doesn’t do what it’s supposed to do.

Alright, Starting off with search engines and reading errors, Those methods work with code related issues (explicit errors), When you get an error: always look at it first, don’t think about doing anything else then focusing on the error, it’s the first clue to tell you what happened, Errors come in various formats but the most popular format an error would come in is :

Errortype: <error text>

When you read an error, Ask two questions, “what went wrong ?” and “how is it wrong?”, Now let’s try answering those questions from the errors, As an example let’s take the following error :

ValueError : func() takes exactly 1 parameter, 2 given

Here the language is telling you that the function ‘func()’ takes only 1 parameter but it was given two, So here the answer to “what went wrong?” is that the function was given two parameters, “how is it wrong?” is that the function only accepts one parameter.

If you couldn’t extract this information from the error then it’s okay, you have search engines to help you, First try to format the error to be search engine friendly, Most errors will include unnecessary keywords that might “confuse” the search engine so try to remove those and only keep error-related keywords.

Now let’s go for Coding communities and using debuggers, Those methods work with the other two types of issues, I am actually a Head Moderator in a discord coding community with over 50k members, I can assure you that most questions I see are either poorly-formatted, Don’t provide enough information or questions that can be easily answered by a google search or similar, Make sure to always make coding communities your last card, After googling and reading the errors and all of that.

In order to ask good questions, Try to put yourself in the place of the person reading your question, Would you answer questions that do not provide enough information? I do not think so, Similarly this applies to all sorts of bad questions, no one is going to bother answering them, So when you ask a question, Provide anything you think can help, Your code, Relevant errors, Expected behavior, Actual behavior, any needed context in order to prevent the xy problem, And use code blocks when posting your code, For that you can use something like the code-to-markdown extension.

Now if your program doesn’t error out but does something it doesn’t have to do, That’s where a debugger come in, A debugger is program that shows you how your code is behaving, so you can pin point the issue, Knowing how to use a debugger is a very helpful skill.

That was all you need to solve problems the proper and efficient way, see you next time!

--

--