“A programming language is a formal language, which comprises a set of instructions used to produce various kinds of output. Programming languages are used to create programs that implement specific algorithms.” ~~~ Wikipedia
Why am I sharing the definition of the programming language with you?
Because I want you to know that the ‘sole purpose of any programming language is to generate output – not just any output but one that fits the requirement specification of its target user. And to become that programmer, you need to understand the core constructs of a programming language first.
Some of the healthy programming concepts are mentioned below:
- Store data into the code using variables and objects. Think about Facebook storing millions of user data to show you the text, images, videos, etc.
- This will allow us to create arrays and collections so that we can place a list of similar types of items together.
- Use APIs to connect with the external data safely and securely.
- Instead of typing logic manually use logical and comparison statements to differentiate and make decisions, this will decrease the size of the code and increase efficiency.
- Use Comment wherever possible so that we can specify what we are asking the machine to do in a human understandable language.
There exist two type of programmer: One who writes code so simple that there are obviously no deficiencies and the second who make it so complicated that there are no obvious deficiencies.
Both of them are in the race to rule the world, but the first method is a far more difficult path to become a bigger and better idiot-proof programmer. If you haven’t already decided your type yet, I’d advise you to do it now!
Here is a sure shot way to becoming the programmer who writes the code that computer, as well as a human, can understand:
- Use more declarative documented comments in conjunction with single/multi-line comments to make the code more understandable by the human.
- User properly structured indentation taking special care of where the code starts and where it ends.
- Proper naming conventions will make your life much easier. Use single responsibility principle for naming class, use camel case for naming variables, and avoid magic numbers.
- Good code is well-tested. The test serves as an executable specification of the code and examples of its real use.
- Good code does think in a straightforward and obvious way.
- Good code is developed in a small, easy to read units of computation. These units are reused throughout the code.
- Instead of reinventing the wheel, try to use standard libraries and extensions wherever appropriate and available.