DEV Community

Cover image for Don't be protective of your code
Vinicius Brasil
Vinicius Brasil

Posted on • Originally published at world.hey.com

Don't be protective of your code

You spent hours and hours writing code. You are ready to submit your changes for code review. *Notification bell rings*. Changes were requested, code suggestions, potential bugs, and clean code issues. You get pissed.

Let's imagine another situation. Your feature gets merged to production. Weeks later you get a message from operations saying something is not working. You get defensive and assume they must be using it wrong.

That is the result of being protective of your code. Even though I love coding, I'm confident the value I deliver is not code. The end of my work is not the code itself, but the product I'm building. However, it doesn't mean my code doesn't need to be clean and easy to read, as those are to make the product extensible in the future. Software engineers that are protective of their code, don't understand that programming is a tool. It's for sure crucial, but not the final work. True problem-solvers use their technical skills as a tool.

Seasoned engineers know code is merely the paintbrush for good art. Being protective of your code slows you down in the following ways:

  • You get offended when taking feedback
  • Makes you blind to potential bugs
  • Prevents you from learning from other developers
  • Causes you to think code reviews are personal
  • Closes yourself to criticism and advice

This is the second installment of short reads about common career problems engineers face. If that sounds interesting, I invite you to read "The fear of merging".

Latest comments (8)

Collapse
 
kennedyihe profile image
Kennedy Ihewuokwu

So far with about 11 years of writing code. I think I can actually tell a person's personality just by reading their code. LOL

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ • Edited

For me, code has always been closer to art than engineering. Writing it is a personal thing, and it's natural to become somewhat attached to it.

Yes, it delivers functional value - but there is also a poetry of logic in there... your intricate thought processes rendered in code.

Viewing it as purely utilitarian would be a horrible way to approach it... I don't understand how or why you'd want to work like that.

I think this is why some developers become annoyed in code reviews. I don't think it is really protectiveness - just a frustration coming from a totally different way of seeing code, that others don't share.

I know I'm not alone in this mindset, but maybe it's not so common?

I've been writing code for 39 years.

Collapse
 
frankfont profile image
Frank Font

Yes Jon, code is a form of poetry when in the hands of an artist. And growing as a software developer happens best when we apply the same processes there that we can apply to make our lives better in general.

twigflo.com/app/mission/6297e71b59...

Collapse
 
adriens profile image
adriens

Writing code is like mathematics, this is a highly personal creative approach to solve problems. It's very linked to your personality, I definitely agree with you.

Collapse
 
miketalbot profile image
Mike Talbot ⭐

I totally agree with this, you can make a machine that tells the time or you can make the most beautifully crafted time piece as art. Elegance in the architecture of software is the thing I'd always defend, I can live with people telling me to add semicolons or don't put {} around string attributes in React, even live with them wanting me to rename my functions - but don't mess with the grand plan ;)

I read this following years ago and still love it:

Every programmer occasionally, when nobody’s home, turns off the lights, pours a glass of scotch, puts on some light German electronica, and opens up a file on their computer. It’s a different file for every programmer. Sometimes they wrote it, sometimes they found it and knew they had to save it. They read over the lines, and weep at their beauty, then the tears turn bitter as they remember the rest of the files and the inevitable collapse of all that is good and true in the world.

This file is Good Code. It has sensible and consistent names for functions and variables. It’s concise. It doesn’t do anything obviously stupid. It has never had to live in the wild, or answer to a sales team. It does exactly one, mundane, specific thing, and it does it well. It was written by a single person, and never touched by another. It reads like poetry written by someone over thirty.

Every programmer starts out writing some perfect little snowflake like this. Then they’re told on Friday they need to have six hundred snowflakes written by Tuesday, so they cheat a bit here and there and maybe copy a few snowflakes and try to stick them together or they have to ask a coworker to work on one who melts it and then all the programmers’ snowflakes get dumped together in some inscrutable shape and somebody leans a Picasso on it because nobody wants to see the cat urine soaking into all your broken snowflakes melting in the light of day. Next week, everybody shovels more snow on it to keep the Picasso from falling over.

Programming Sucks

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Love this. Link saved

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ • Edited

Seasoned engineers know code is merely the paintbrush for good art

And for some, the code itself is a part of the art - another facet of the whole

Collapse
 
vinibrsl profile image
Vinicius Brasil

I like how you see it :)