Suppose I write a very large class and to cope with that length I need to divide the source into multiple file. How could I spread that source code in such a way? If it not viable, how do the large libraries handle coding large scale programs ?
Asked
Active
Viewed 67 times
0
-
3They do so by using the Single Responsibility Principle. A class should not be that large. – Leifingson Dec 28 '13 at 00:48
-
2Agreed. If you need to make `class Bike`, feel free to make separate files for `class Wheel`, `class Tire`, `class Spoke` and import them into `Bike,` but do not make `Bike` a million-line gargantuan program. – Adam Smith Dec 28 '13 at 00:53
-
1Just to provide context (and some crawler bait): This is called partial class in C#. It is used (AFAIK mainly) to separate auto-generated and handwritten parts of the same class. Splitting into two classes is not desirable because of visibility. – Palec Dec 28 '13 at 04:45
-
If you did not ask for best practices on large library maintenance, this question would be exact duplicate of http://stackoverflow.com/q/9638446/2157640 – Palec Dec 28 '13 at 05:05
-
And this is an answer, IMO: http://stackoverflow.com/a/295760/2157640 – Palec Dec 28 '13 at 05:13