God Class (ARCH3189)
هذا المحتوى غير متوفر بلغتك بعد.
Key typescript.quality.god-class · Severity warning · Category quality
Classes holding many methods and fields take on unrelated responsibilities, leading to low cohesion and high change risk. By the single-responsibility principle they should be split into separate classes.
Incorrect
Section titled “Incorrect”class App { loadUsers() {} saveUser() {} renderChart() {} sendEmail() {} parseCsv() {} authenticate() {} computeTax() {} // ...dozens of unrelated methods}Correct
Section titled “Correct”class UserRepository { loadUsers() {} saveUser() {} }class ChartRenderer { renderChart() {} }class Mailer { sendEmail() {} }class AuthService { authenticate() {} }Split the class into separate, cohesive classes by responsibility.