DEV Community


Posted on


Next time you say "complex code", come back here...

What is complex code?

It is just two words complex code, no rocket science involved. Or, Am I overthinking it?
It is easy to understand code complexity and programming complexity. There are studies and theory about computational complexity.
But it is all different.

Why is it easy to picture complex code as bloated software like these hello world examples? One step more and it will transition to pure art - increase the complexity of a simple instruction to a maximum power level which completely vanishing original idea.

Here is another example of complex code, which is in fact, well made satire.

It is not only about a piece of code, but you can take it all way up (or down) to language level like brainfuck does.

What about real-world examples? Current project?

Have you ever put a label on somebody's else works thinking that the code is very complex? Could it be that these feelings radiated over yourself, night after the last deadline? Like, something feels fishy about that iteration over a multidimensional list of lists. Or, maybe, during a source code review of a popular library everyone uses but finding it hell confusing...

Does it affect us?

Have you ever blamed complex code for a missed estimate? Was there a feeling like "please not me" because you knew the code? What is your emotion when you hear "legacy application"? Do you smile and eager to start a new project?

So why there is no clear definition of a thing which makes us feel uneasy?
Is it because this thing is complex?

Let me know your thoughts and especially feelings.
Share your story, your perception, your view, your examples.

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.