How many rows are normal for the class?

How many rows are in your opinion acceptable for a class in C++ and maybe even not a bad code? Is it normal to do a class of about 300 lines?
April 7th 20 at 15:39
3 answers
April 7th 20 at 15:41
Solution
As long as necessary to encode the behavior of objects of this class.
And inherent logic in this class is the question of the architecture of the project (project code!).
April 7th 20 at 15:43
Solution
the code should be enough to implement embedded in the class logic execution element will be delegated exclusively to him/the object of this class
it is important to distinguish between functionality that you want implemented as part of a class. to separate flies from cutlets, as they say
the rest is a matter of architecture, as has been previously announced
April 7th 20 at 15:45
I read somewhere that approximately 500-1000 lines of business logic.

But:
1. The number of rows can not depend on the quality of the code. You can have 500 lines of bad code that will not understand even the author. But if you have code, at least on DDD, then the code easier to live. And if there are tests, it is doubly better.

2. You have the code is 1500 lines due to the detailed documentation of the code. Or many rows obtained due to a large number of transmitted parameters in methods. This method have to move every parameter 1 string. @user.
3. You should not rely on the number of rows. If the code to maintain and not difficult to read, not wrapped. If it is difficult - refactoring.

In General, I advise to write the code so that it can be read as English text. To find a name for variables, methods, classes, interfaces, etc.

Find more questions by tags C++OOP