Principles of Design are critical for high quality software

Hastiness in programming: The plague of beginners

The tendency of new or untrained software developers is to be short sighted in writing code.

Whether it's simply writing a script to check a weather API or bootstapping a backend for an article website, the focus is often upon immediately reaching the goal for which the software written. I.E.: Respectively, getting the temperature to show in your console as quickly as possible, or getting a minimally viable article API working.

Often one is so impressed to even get the code working that they never consider they could have written it in a better way. And what does it mean to write code in a better way?

When it comes to writing high quality software (a concept I will define below), no matter what goals your software seeks to fulfill, there are specific patterns with which it is best characterized. At least, that's what people who have been industry for a long time like Robert Martin tell us. To write code in a better way means writing your code to meet more needs than simply fulfilling a specific feature request.

Writing Good Software

Software is never written in a vacuum. It is usually written in the context of other developers, changing APIs, changing business needs, new demands, bugs, downtime, and so on. Layered, well communicated, and well organized systems are the only kind that survive these challenges.

For this reason, good code is code that takes into account the needs that surround it. Good code is:

  1. Readable and understandable

    Most of our time is spent reading code, not writing it. Understanding business logic and what code does is only possible when the code is readable. We should seek to write our code in a way which makes it possible to be understood not only by ourselves, but also others.

  2. Easily changeable to meet changing needs

    Software should be flexible in the sense that when a certain part of your application needs to be adapted to a new feature or need, large sections of your codebase do not need to be rewritten. When so much effort is required to change code, technical progress and productivity grind to a halt.

  3. Communicates clearly the domain for which it is written

    Clearly communicating the domain is important for all code because it makes the software more readable and orients the software towards solving domain goals.

  4. Connects functionality with the data for which it exists.

    Code which connects functionality to data joins important domain logic together. A class which connects the actions that a specific entity can perform with the internal object makes far more clear the purpose of the entity than utility functions which manipulate the object from the outside. This is why OOP style programming is generally better suited for organized programming.

  5. Enjoyable to write and work in.

    When the mental effort of writing code becomes so high that it is no longer enjoyable to work in, the drive, commitment, and creativity of developers begins to fall. This situation is to be avoided at any cost. It is extremely important to make writing software enjoyable for developers.