| 8 | | * Don't ever, never ever. Never ever? Yes, never ever use static methods, unless you are creating a singleton. |
| 9 | | * If the question is, "Should I use a singleton?" The answer is no. If the question is, "Are you sure I shouldn't use a singleton?" The answer is still no. If the question is still, "I think I should use a singleton." then okay, you obviously know what you are doing, so go ahead. |
| 10 | | * Classes should be small. |
| 11 | | * Methods should be small. |
| 12 | | * Views should be in a separate file. |
| 13 | | * Classes should only contain unique code. |
| | 10 | * Don't ever, never ever. Never ever? Yes, never ever use static methods, unless you are creating a singleton (best practice). |
| | 11 | * If the question is, "Should I use a singleton?" The answer is no. If the question is, "Are you sure I shouldn't use a singleton?" The answer is still no. If the question is still, "I think I should use a singleton." then okay, you obviously know what you are doing, so go ahead (best practice). |
| | 12 | * Classes should be small (best practice and Single Responsibility). |
| | 13 | * Methods should be small (best practice). |
| | 14 | * Views should be in a separate file (separation of concerns and best practice). |
| | 15 | * Classes should only contain unique code (Single Responsibility and obviously, best practice). |
| | 16 | * If the answer is "I could just extend this class to change the functionality." Then you are asking the wrong question. You are better off creating a new interface and moving the code you were going to add by extending to a new class and dependency injecting the class that matches the new interface. |
| | 17 | |
| | 18 | The end result will be greater amount of smaller classes with interfaces that describe functionality that can be called in functions and other objects. No object should reference a class by name, only check that the class implements interfaces. |