5 Tips on improving Programming Logic
A lot of colleagues, friends and strangers (that I meet in meetups, etc) have asked me to explain how can they improve their programming logic.
Though programming is mainly associated with the field of Computer Science, but writing good and optimized code is mainly an art. Like all art forms requires tremendous patience and rigorous practice, building gray cells for programming logic is not much different.
I present this post/article to you on how you could too improve your programming logic.
Tip 1: Learn the language ‘C’
You might be an expert .NET, Java or PHP developer, but I would recommend that you MUST learn ‘C. We all know why ‘C’ is the most powerful programming language, but I am not recommending learning ‘C’ to you because of its power in programming.
‘C’ offers you a structured style of programming. You have one file with the main() method and the execution begins from there and the execution flow proceeds as you have directed it to.
The main advantage in ‘C’ is that it allows you to play around with memory directly. This I believe is very important if you need to understand how data is passed from one memory block to another. The reason is that you start to visualize in your minds eye how data moves in your program.
The next step is to develop programs that will help you improve your logic.
Tip 2: Develop programs that test your mind skillsEver heard of the Fibonacci series?
Ever built a program that will allow the user to type his/her name and allow to bounce off that name on the screen from one corner to another like a ball?
Ever thought of creating a library for a Menu Bar system?
All these are examples of programs that you can develop to improve your mind and programming skills.
I remember the time I was at college and I would spends nights after nights to build my own library for screen interface for menu bars, windows, text fields, etc. In a UNIX box I would use the ncurses library and build it. I would then try and replicate the same in Windows using the conio.h file and some assembly code.
Try to develop as many programs as possible in ‘C’, this will help you improve your programming logic.
Following are some programs that I can help you with:
- Write a program (WAP) to find the max, min, average and total of numbers entered by the user
- WAP to accept a string from the user and find the number of vowels and the vowels that got repeated the most.
- WAP to accept an array of numbers and sort the same using Bubble Sort Algorithm.
- WAP to accept a string from the user and print all its permutations and combinations.
- WAP to accept to accept a number from the user and test if it is a Fibonacci number or not.
I can go on and on with such questions.
Tip 3: Locate code and try to understand why it was written that way
Use the internet or college library to locate code written by another developer. Try to understand why it was written that way and understand it completely. Once you have understood why it was written they way it is written, check to see if you could improve that logic.
The main objective of this exercise is to get your brain thinking.
Tip 4: Solve logic puzzlesCheck your local newspaper. One section of your newspaper will be filled with series of logic puzzles and riddles. Try solving them. Don’t get disheartened if you can’t solve them or take a long time to solve them. Remember that you are in the learning and improving stage. Things will be slow, but you will make progress.Your brain will be trained to think differently with every puzzle that you try to solve. This is because now you know a new method of solving. You could apply the same thinking pattern to your programs as well.
As a standard prescription, I would prescribe solving Suduku puzzles. Will help you improve your logic, concentration and skills of grouping and organizing.
Tip 5: Help other people build logic
Once you start feeling confident about yourself and your logic capabilities, you should immediately start helping people. Subscribe to a forum and start helping people there. The benefit of helping people on forums is that you get to learn new problems that people face. This immensely adds to your knowledge. Just imagine the power you would have once you start to learn problems faced by other people and how you or someone else resolved it.
I have seen friends following this advice but shying at the last moment. Why? Because they don’t want to be ridiculed in the forum. Don’t be scared of other people ridiculing you. Look at it as a learning experience. People who ridicule you would be the one’s with more experience… and learning from people who are experienced is no harm at all.
I hope this article was helpful to you.
As a continuation to this post, I am planning to post questions in ‘C’ with solutions. You can subscribe to my blog to receive updates as these posts go live.
Till then, happy logic building
Related Posts On Programming