DEV Community

Discussion on: Writing Good Method & Variable Names

Collapse
 
pavlosisaris profile image
Paul Isaris

Totally agree with your point. Taking a step back and putting some thought on how to name a variable or a method can help your app have more SOLID foundations and save you hours of refactoring.

Collapse
 
rachelsoderberg profile image
Rachel Soderberg

I feel like it saves me a lot of time when I do small refactoring as I go instead of waiting until I have a 6000 line method to break apart all at once. (not to mention the time saved debugging when the only clue you have is "thing broke in main()"

Collapse
 
pavlosisaris profile image
Paul Isaris

I am not talking only about breking long methods to smaller ones, but conceptual refactoring when trying to name a variable/method. Often times I find myself struggling with coming up with a name, only to end up deciding that my method needs to be a part of a better designed class (or to be extracted to a new class), even before start writing it 😃