DEV Community

Discussion on: What's your favorite line of code?

Collapse
 
daniel13rady profile image
Daniel Brady • Edited

A wise old wizard I used to work with once said,

My favorite line of code is the one I get to delete.

It's taken me a few years, but I've finally caught on to that appreciation.

Collapse
 
bittnkr profile image
bittnkr • Edited

My favorite line of code is that I will never delete, because is perfect and cannot be replaced.

Collapse
 
daniel13rady profile image
Daniel Brady

That sounds great, but I'm not sure I'll ever be good enough to write a line of code that never gets modified before being deleted. Seems like a good goal to strive for!

Thread Thread
 
bittnkr profile image
bittnkr

Sorry for the 'never'...

I mean, a line of code to be "perfect" must:

  1. Solve the problem
  2. Be reliable
  3. Be easily tested or (pardon the heresy) dispense testing
  4. Be as terse as possible
  5. I can forget about it.

But my really favorites, "the perfect ones" are those that beyond that, yet saves me the typing of another lines. :D

Collapse
 
daniel13rady profile image
Daniel Brady

And a wise old wizard I currently work with offers up a bottle of Scotch during our company's annual Hackathon to the dev who creates a PR which deletes the most code while maintaining bug-for-bug compatibility without adding new code. 😍πŸ˜