Principles of Modern Programming

No votes yet.
Please wait...

At first glance, it may seem that anyone involved in the IT community can write the code. But what about a quality code? Here, one can face some difficulties. Each of us has probably heard stories about the way how the if-else chains are created and about software that crashes just after changing one variable or using the wrong method, etc.

Sometimes it happens because web products are developed by programmers with insufficient experience (less than a year). And of course, it’ll be wrong to try to write the code that only works and that’s it.

The goal of any programmer is to create a program code that can be updated and improved in the future, even if another programmer will do it. It is extremely important to put into practice the basic principles in modern programming.

Principles of Modern Programming

Principles of Modern Programming

KISS

The well-known principle of simplicity (Keep It Simple, Stupid) is critically important for all projects of medium complexity. If you know how to make your code simpler, do it. At the same time, do not forget to do all the work, starting with small ones, smoothly moving on to complex tasks (so as not to make a lot of technical troubles for yourself).

When you start writing a code, keep it simple and user-friendly. Complex program code takes a lot of time to create, and there are much more bugs there than in a simple one.

DRY

Don’t Repeat Yourself. This principle is a fundamental factor when creating a simple but readable program code. When you write a code, try to avoid data and logic redundancy. If you realize that some piece of the code appears over and over again, this principle has been violated!

WET

The complete opposite of the DRY code is the WET code (Write Everything Twice / We Enjoy Typing) which says that software components can and should be duplicated. The best way to detect the WET code is to ask how we can change software behavior, how many functional parts we can change, and what this is going to lead to.

Open / Closed

Program code should be open for implementing new spheres but closed for editing whether you develop objects on Java or model symbiosis on Python. Such a principle is related to all types of projects but it is significant when releasing libraries and system structures that are designed for third-party users.

Principle of a Shared Responsibility

This principle means that each class and module in software must deal exclusively with one set of specific functions. All modules and classes are based only on this principle. Since the functionality is constantly expanding, they turn into modules and classes that can do anything but at the same time take many hundreds of lines of code.

If you do come across something like this, break up the classes into small constituent parts and modules.

Classification of “Interests”

The principle of interest sharing is the principle of single responsibility but in more abstract situations. In fact, software must be designed so that it contains a lot of non-overlapping encapsulations. And these encapsulations cannot function among themselves.

In other words, this principle makes it as easy for a quality assurance company to maintain software. And in the future, when you need to rewrite the program code, you can easily do this without fear for the integrity and safety of information and logic.

YAGNI

You aren’t gonna need it. This principle is based on the fact that a user doesn’t need to deal with particular functionality that he/she may need in the future. The programmer probably doesn’t need this functionality as well. And it will be a simple waste of time that will complicate program code.

Sometimes, inexperienced programmers try to make general abstract code in order not to deal with the WET code. Too appreciable abstraction lead to the situation when it will be impossible to maintain the code in the near future. It will be a wise decision to use the DRY principle only at times of extreme need.

So, What Makes a Programmer Professional of Their Craft?

The portrait of a good programmer is not as difficult as it might seem. A good programmer is the one who realizes that writing software code should ultimately benefit everyone who comes across that software in one way or another. Also, this term can include employees who are easy to work with; it’s pleasant to communicate and exchange professional experience with such people.

Leave A Comment