Code Refactoring Tip To Prevent Disaster

preview_player
Показать описание
This is a code refactoring tip I use all the time. When refactoring code, it can be tempting to delete old code thinking you might not need it again. Instead, I comment out the code before refactoring, that way my code refactor can be safe and I don't need to worry about losing the code.
Рекомендации по теме
Комментарии
Автор

That's not a tip . that's just common sense !! 😂😂😂

Also commenting out code blocks is a great way of trying out different code blocks at a time. It's especially handy when there's a sequential structure within the code.

ksaha
Автор

Don't lie dude, that's never being deleted 😂

StevenMartinGuitar
Автор

The real issue here is that local variables are in pascal case

bananalyzer-ly
Автор

I legit do this the time. Sometimes when I have do refactor a whole function I duplicate the function and comment it out😂

brunobuss
Автор

What are some other useful tips to follow when refactoring code?

plotteldev
Автор

Oh, i do the same! Some code i commented out almost 5 years ago is still in repository.
Just delete it galls. 😊

Cavema
Автор

You can simply create a hook in your text editor to commit at file change. If you want to restore, just revert the commit

rothbardfreedom
Автор

Well, quite a useless tip idk who doesnt know to do that after the first time.. 😂

grishu