1. Home
  2. Smartpedia
  3. Clever Code

What is Clever Code?

Smartpedia: Clever code is a synonym for a superficially clever way of developing software, which, however, is not recommended for professional software development.

Clever Code – seemingly smart software development

Clever Code sounds positive at first, doesn’t it? It sounds like a part of a software that solves a problem particularly elegantly. Or like an algorithm that masters a complicated task by magic. Of course, software should be cleverly programmed, but the term “Clever Code” means something else: it describes the attempt of programmers to master challenges extra cleverly. In an individual way, better and smarter than any other developer would have solved a problem. Unfortunately, programmers who try to programme Clever Code forget three central aspects of software development:

  • The main goal of software development is to create useful software with little effort.Âą
  • Software should be readable, changeable, extensible and maintainable by other software developers. In other words, the principles and practices of Clean Code should be used.
  • Technical debt makes it difficult for software to evolve.

Of course, it is possible to write lines of code that can be parsed 10% faster, and writing such lines of code might be clever in a positive sense of the word. However, if at the same time the effort to produce these lines of code increases, if it becomes more difficult for other software developers to read, understand and, if necessary, change this code, then this is anything but clever. Then it is counterproductive.

Clever Code is not Clean Code

“Programming is not like being in the CIA, you don’t get credit for being sneaky” is how Steve McConnell put it back in 2004 in his book “Code Complete”². And that’s exactly how it is. Software development is about

  • changeability,
  • correctness,
  • production efficiency and
  • continuous improvement.

This foundation of values is the basis for the development of Clean Code. And Clean Code is the opposite of Clever Code.

The Motivation for Clever Code

What is the motivation of programmers to want to develop code in a particularly clever way? Various motivations are conceivable, among them

  • the claim to want to be the best, and thus the attempt to implement a “special” solution.
  • a false understanding of good software development.
  • the attempt to make oneself indispensable.
  • lack of experience in software development.
  • an internal competition with colleagues.
  • because it can be fun.

Measures against Clever Code

There are several ways to take measures against the development of Clever Code:

  • Developing software in teams, e.g. in the form of pair programming or mob programming (before implementation).
  • Defining clear coding and documentation guidelines (also before implementation).
  • Conducting a software walkthrough or peer review (during implementation).
  • Carrying out refactorings for elimination (after implementation).

 

Clever Code - smart at first glance only

What does t2informatik do?

Was does t2informatik do? One click and you'll know it.

Impulse to discuss:

There is exactly one area where the development of Clever Code is desirable: Code Golf.

Notes (in German):

[1] Ziele der Softwareentwicklung
[2] Code Complete

Here you will find additional information from our Smartpedia section:

Smartpedia: What is SWEBOK?

What is SWEBOK?

Smartpedia: How does Code Golf work?

How does Code Golf work?