EDITING BOARD
RO
EN
×
▼ BROWSE ISSUES ▼
Issue 44

Chaos, memes and software design patterns

Ariel Pontes
Python Developer @3 Pillar Global
PROGRAMMING

Your code is not DRY/SOLID/readable/maintainable. Your API is not "RESTful". You're not respecting the "tell don't ask" principle. Your code is not well documented. "Inline comments are code-smell". This code is not efficient. "Premature optimization is the root of all evil". You don't need a library for this feature, you should avoid "technology lock-in". "Don't reinvent the wheel". In a few decades of software development we have seen the rise and fall of countless design principles/philosophies/patterns. Some of them seem to contradict each other at times and debates around these topics are often heated and reveal a certain level of stubbornness and quasi-tribalism on all sides. Can we find technical arguments to settle them?

In this article I attempt to provide an overview of the patterns of argumentation that often emerge from such discussions and examine why it's so hard to find decisive answers.

Typical arguments

Appeal to authority

Caught in an impasse, it is common to appeal to authority - Renowned developer John Doe endorses this framework/library/principle/etc, it must be good! This is not a decisive argument, but it does have a degree of legitimacy. An experienced developer is probably trained at judging at least the more objective qualities of a technology or approach.

Appeal to community

Another variant of the appeal to authority is the appeal to community, similar to appeal to the masses, but with the difference of course that its scope is restricted to the developer community and not the population overall. This is an improvement over the other argument because, even if a new trend is imperfect, everybody knows how much better it is to work using technologies with a strong community behind it. But presuming that the popularity of a trend is always indicative of its superiority is unrealistic.

Denial of subjectivity

Engineers are afraid of subjectivity, and this occasionally makes us prone to fall victim to the false-consensus effect. The truth is that software engineering is in fact a highly social activity. Programming in high level languages is, after all, a means of communicating not only with computers but with other programmers. It should be no surprise, therefore, that concepts like "readability", which are ultimately tied to human intuition and that may change from individual to individual, often play a decisive role in determining whether a pattern is embraced or not by the industry, OOP and MVC being quite illustrative examples. Unfortunately, though much is debated in this area, very little research is actually done on the suitability of certain design patterns to universal aspects of human cognition, let alone publicized.

But we're ashamed to acknowledge that. So what do we do? We live in denial. We avoid terms like "personality", and "intuition" and prefer pseudo-objective terms like "readability" and "maintainability". We even start believing that statements of the sort "X is more readable than Y" say something objective about the nature of reality. That is not to say that consensus is never real. Anyone in their right mind would agree that understanding a complex web service written in a single file with millions of lines is, to say the least, a serious intellectual challenge even to the most experienced developer. But it's important to keep in mind that even the most intuitive truths for a person may sometimes sound like nonsense to another.

The science of uncertainty

Ok, so these arguments aren't decisive, but sure there must be better ones. Science can always tell us what's the best thing to do, right? Well, not always.

Memetics

No, I'm not talking about internet memes. Memetics is a field of knowledge concerned with how ideas spread and adapt in response to the forces of natural selection. Humans are a social species who has evolved to learn by observation and copy the behavior of others. This has allowed us to accumulate knowledge to an extent that no other species has ever dreamed of, but it also made us vulnerable to cultural parasites: traditions that serve no rational purpose but that are nonetheless copied from generation to generation, some times to the expense of the host.

"Examples of memes are tunes, ideas, catch-phrases, clothes fashions, ways of making pots or of building arches. Just as genes propagate themselves in the gene pool by leaping from body to body via sperms or eggs, so memes propagate themselves in the meme pool by leaping from brain to brain via a process which, in the broad sense, can be called imitation." ― Richard Dawkins, The Selfish Gene

My point is that coding trends are just another example of a meme. When Darwinism is brought up, some may think of "survival of the fittest" and be tempted to conclude that memetics confirms that the most popular trends are in fact the best. This is incorrect for a few reasons:

Being "fit" means "being the best at replicating", and not "being the best at helping its host achieve their goals". Sometimes these coincide, sometimes not. No one species is superior to another in an absolute sense. Being the best means being the most adapted to a particular environment, and environments are constantly changing. In the ecology of living organisms, these changes happen over the course of hundreds or thousands of years. In the ecology of ideas, it may happen in years or even days. Random external events may have a decisive influence on what variant of a meme becomes dominant, regardless of its ability to help its host achieve their goals. Which brings us to the next topic.

Chaos theory

"The fluttering of a butterfly's wing in Rio de Janeiro, amplified by atmospheric currents, could cause a tornado in Texas two weeks later." - Edward Lorenz

In very complex systems, outcomes are highly sensitive to initial conditions. This is true both for weather and biology. Humans often pride themselves for being the most evolved animals on earth, but we would never exist if a huge meteor hadn't hit the earth and killed all dinosaurs, allowing small mammals to come out of their hiding nests and thrive in a radically new environment. If small events can make it practically unfeasible to predict which animal species will go extinct and which will thrive, the same must be true for software development memes.

One of the greatest examples of a tool becoming dominant for all the wrong reasons can be found in the web development industry, with the popularity of PHP. The language is nowadays one of the most widely hated ones according to this Hacker News poll and yet it is still the most widely adopted and fastest-growing technology based on production usage (81.7% according to w3techs). It makes perfect sense, however, when you consider the low entry barrier for new developers, that it was the first language made specifically for serving web-pages, that it's open-source, that it got to ride the dot-com bubble, etc.

In the context of weather and ecology, the science of chaos tries to move on from trying to establish chains of causality in order to predict future states of a system and instead focuses on finding statistical patterns in large sets of data and replicating them with relatively simple mathematical models. In software development, however, it's hard to imagine something analogous being done.

An experimental engineering

Engineering in general is not exactly a science, it rather relies on well established scientific knowledge in order to solve specific problems. The body of knowledge that sustains software engineering, however, is much less stable than the one that sustains civil engineering for example. The available materials, tools, and the scientific knowledge of human-scale mechanics change very slowly when compared to the fast-paced world of IT. This fertile soil for new ideas ends up creating an overly complex and unpredictable meme pool of ever-changing programming paradigms and design patterns. As engineers, however, we're not prepared to make sense of this mess, so we must learn how to think as experimental scientists, and that requires self-skepticism.

"Irrefutability is not a virtue of a theory, but a vice. Every genuine test of a theory is an attempt to falsify it." - Karl Popper

Conclusion

By asking more questions than answering them, I don't expect to provide a recipe for winning any argument or always making the best technical decision. What I do hope is that, by shedding light on the topic, I contribute to more constructive debates in which the parties are more aware of the limitations of their discourse and the subjectivity of their experience. Debates that don't degenerate into ego battles in the male dominated world of software development and that result in decisions that aren't always arrogantly assumed to be the best. With this in mind, we should feel encouraged to be critical about design fads while at the same time not being ashamed of embracing them experimentally or for the sake of community convention. Finally, if none of the above, I hope I at least have provided a thought-provoking overview of a few interesting topics that are usually not covered in the software development community.

"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." ― Stephen Hawking

Bibliography

Conference

Sponsors

  • comply advantage
  • ntt data
  • 3PillarGlobal
  • Betfair
  • Telenav
  • Accenture
  • Siemens
  • Bosch
  • FlowTraders
  • MHP
  • Connatix
  • UIPatj
  • MetroSystems
  • Globant
  • Colors in projects