Etiquette for refactoring other people's sourcecode?
- by Prutswonder
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)?