Skip to content

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.

class App {
loadUsers() {}
saveUser() {}
renderChart() {}
sendEmail() {}
parseCsv() {}
authenticate() {}
computeTax() {}
// ...dozens of unrelated methods
}
class UserRepository { loadUsers() {} saveUser() {} }
class ChartRenderer { renderChart() {} }
class Mailer { sendEmail() {} }
class AuthService { authenticate() {} }

Split the class into separate, cohesive classes by responsibility.