Etiquette for refactoring other people's sourcecode?
Posted
by Prutswonder
on Stack Overflow
See other posts from Stack Overflow
or by Prutswonder
Published on 2010-03-26T09:39:44Z
Indexed on
2010/03/26
9:43 UTC
Read the original article
Hit count: 629
Our team of software developers consists of a bunch of experienced programmers with a variety of programming styles and preferences. We do not have standards for everything, just the bare necessities to prevent total chaos.
Recently, I bumped into some refactoring done by a colleague. My code looked somewhat like this:
public Person CreateNewPerson(string firstName, string lastName) {
var person = new Person() {
FirstName = firstName,
LastName = lastName
};
return person;
}
Which was refactored to this:
public Person CreateNewPerson (string firstName, string lastName) {
Person person = new Person ();
person.FirstName = firstName;
person.LastName = lastName;
return person;
}
Just because my colleague needed to update some other method in one of the classes I wrote, he also "refactored" the method above. For the record, he's one of those developers that despises syntactic sugar and uses a different bracket placement/identation scheme than the rest of us.
My question is: What is the (C#) programmer's etiquette for refactoring other people's sourcecode (both semantic and syntactic)?
© Stack Overflow or respective owner