Refactoring long class step by step (2)# Programming - 葵花宝典
g*g
1 楼
6. Many god classes pack everything together, but it's better to
keep them in different function groups. We often see GUI classes
doing that. It's nothing wrong when the class is short and everything
in a page of two (couple of hundred lines), but when it's getting
bigger, time to apply MVC pattern. For other long classes that
have no obvious pattern to apply, check the instance variables, you'll
see some variables are used intensively in some functions, and rarely in
others. That's a good smell
keep them in different function groups. We often see GUI classes
doing that. It's nothing wrong when the class is short and everything
in a page of two (couple of hundred lines), but when it's getting
bigger, time to apply MVC pattern. For other long classes that
have no obvious pattern to apply, check the instance variables, you'll
see some variables are used intensively in some functions, and rarely in
others. That's a good smell