Sobes.tech
Junior — Middle

What do you think about classes in code exceeding 2000 lines?

sobes.tech AI

Answer from AI

A class exceeding 2000 lines is usually a sign of poor architecture and a violation of the Single Responsibility Principle (SRP). Such a class is difficult to maintain, test, and understand. It is recommended to split a large class into smaller, logically related components or services. This improves code readability, reusability, and maintainability.

For example, if you have an Activity in an Android app with a huge amount of code, it is better to extract logic into ViewModel, separate data handling classes, utilities, etc.

What do you think about classes in code exceeding… - sobes.tech