D
Davej
In what languages in this considered acceptable or even good form?
Thanks.
Thanks.
In what languages in this considered acceptable or even good form?
Thanks.
In what languages in this considered acceptable or even good form?
In what languages in this considered acceptable or even good form?
Thanks.
There are languages where this is not permitted. However, in C# you can
spread the code over files almost as much as you like. Neither the class
mane needs to match the file name nor the nemespace needs to match the
path nor a class has to be defined in a single file (partial classes)
nor one file could contain only one class. It is only a question of code
style rules.
From my point of view the code should primarily be readable. And
whatever is required to meet this demand should be done. Strict coding
rules usually do not always hit the nail on the head. Sometime it is a
good advise to spread a class over files. First of all in case of
generated code (which itself is a work-around for some other problem).
Secondly a nested class might be better placed in a separate file if it
is rather large. On the other hand small classes or interfaces or enums
that are dedicated to a single class only, might be naturally placed in
the class file without causing any confusion.
Marcel
Thanks for the responses. I guess what had me confused is that it
seems to be a hard requirement in Java and a recommended practice in
C#. I am learning both of these concurrently and get them confused
constantly.