DEV Community

Discussion on: What little things make you happy while coding?

Collapse
 
alainvanhout profile image
Alain Van Hout • Edited

Deleting code.

(The context here being: working with problematic legacy code and getting to the point where you have new code (paths) that do(es) the same thing but without the issues, so that the old code, and its issues, can just be discarded)

Collapse
 
themulti0 profile image
Multi

ikr

Collapse
 
ben profile image
Ben Halpern

Yes!

Collapse
 
rommik profile image
Roman Mikhailov

oh so true...

Collapse
 
buinauskas profile image
Evaldas Buinauskas

Or deleting old code that just exists, is no longer used!

Collapse
 
bizzy237 profile image
Yury

yes. I've been deleting a lot of unused code recently and it feels so good. except for that moment when you realize that the code you deleted is used in another module but this is not documented anywhere

Collapse
 
ejbroeders profile image
EJBroeders

Agreed!

Also, deleting code you wrote earlier in the project because you've made a more general applicable implementation, hence the old code isn't used any longer.

Collapse
 
alainvanhout profile image
Alain Van Hout

Yeah I saw that as included in the previous, since I don't see 'legacy code' as inherently being 'code written by somebody else' :-).

Collapse
 
zx8754 profile image
Tokhir Dadaev

When we come up with this kind of comments:

//When I wrote this, only God and I understood what I was doing
//Now, God only knows

I would suggest just comment out codes rather than delete (or have versioning in place).

Collapse
 
alainvanhout profile image
Alain Van Hout

I see some kind of VCS as a baseline project requirement, and in that case commenting out code is a very big anti-pattern.

And even without it, should an obsolete version of a codepath forever remain in your codebase, even long after it's become sufficiently inconsistent as to be irrelevant?

Collapse
 
carlitosx profile image
Carlitos-X

Yep... This too XD