Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

As you've found out, code works fine regardless of which file you put it in. So it comes down to organization... where will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack OverflowThis Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.

As you've found out, code works fine regardless of which file you put it in. So it comes down to organization... where will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.

As you've found out, code works fine regardless of which file you put it in. So it comes down to organization... where will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.
added 5 characters in body
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683

As you've found out, code works fine regardless of which file you put it in. So it comes down to organization... Wherewhere will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.

As you've found out, code works regardless of which file you put it in. So it comes down to organization... Where will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.

As you've found out, code works fine regardless of which file you put it in. So it comes down to organization... where will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.
Source Link
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683

As you've found out, code works regardless of which file you put it in. So it comes down to organization... Where will you put things?

What I've found is that any departure from the "standard" conventions makes it very difficult to navigate through a code base of any significant size. You say you have this little helper class, but where the hell is it? You put it in a different solution, and I have a metadata reference to it, but where did you actually put it? Unless you adhere strictly to the one file per class/interface/whatever, you've now forced me to do a search, and I'm coming after you with a carving knife.

This Stack Overflow post lists some of the exceptions where it might make sense to break this rule:

  1. Partial classes,
  2. Extension methods,
  3. Enums that only pertain to a single class, although I still generally put those in their own file.