How To Think Like a Programmer
Mohamed Hassan
Posted on March 10, 2020
It is my first blog ever so, you are going to get easy on me, are not you? :)
This is a beginner-friendly explanation on how to deal with problem solving and fixing bugs as you go on your journey as a programmer.
let's get right down to it
our subheadings
1-try to understand the problem first
2-think in terms of booleans
3-enjoy the process
4-try pseudo code
5-strive to put everything in its simplest terms
6-Never give up
1-Try to understand the problem first
Why did the code break? This is might be the first question that comes to mind. well, buddy, there are types of errors syntax errors, and they are simple and easy because obviously, it depends on the syntax. The other ones are "logical error" and you want to stop and analyze your thought process. remember when you actually coding you are not debugging the code you are debugging your brain
I am going to leave you with one of Einstein's best quotes
I Would Spend 55 Minutes Defining the Problem and then Five Minutes Solving It
2-Think in terms of booleans
There are no shortcuts when it comes to coding if you want to code a program that does XYZ you have to tell the program through code how to do XYZ. Computers are really stupid, you have to explain everything to them to get the job done.
so, think of everything like this "true or false", "on or off", "black or white", "if-else" nothing is gray when it comes to coding.
If it starts to rain, I will open the unparallel.
If the user does not fill out the name input, I will display a message "name required".
Two very different examples, but HEY!! the concept is there.
A wife asks her programmer husband to go to the grocery store. She tells him to get a gallon of milk, and, if they have eggs, to get a dozen.
When he got back, he had 12 gallons of milk. When she asked why he said
They had eggs.
that might sound funny, but it demonstrates the way we think as programmers
3-Enjoy the process of coding
I am going put it this way as plain, simple, explicit as ever coding is hard
and you are going to deal with a lot of problems and that is ok. All you want to do about it is not stressing out, but enjoying the process of making and creating stuff. if you are not going through problems then you are not actually coding
be comfortable with being uncomfortable.
4-Try pseudo code
If you are going through a tough time coding, you can try this. if you are not familiar with it pseudo code is basically writing steps on paper as plain English to solve a certain problem. It works well if your planning database schemes.
5-strive to put everything in its simplest terms
Define every variable. It is really easy to make things complicated when coding.
you may want to look at some programming acronyms concepts:)
KISS: keep it simple stupid do not make something complex just to make it complex
DRY: do not repeat yourself one line can do itYAGNI: you are not going to need it you should implement what you actually need
6-Never give up
Sounds cliché? yeah, but quite true. constantly, test your thought process. No answer yet? google it No answer yet? reach out to a fellow developer
Conclusion
Just do it. As you go, you will find yourself getting familiar with the error messages.that is it. excuse my awful writing skills.
HAPPY CODING :)
Posted on March 10, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.