![]() ![]() You may only call methods on: parameters, your class properties, globals and on objects you created. You may only call methods on objects that were available when your function started or that you created. They only return and don’t change the state of the system.Ĭommands change the state of the system and don’t return anything.Īvoid asking objects what their state is and tell them what to do directly. Queries are getters or methods that calculate something. The things that happen in your class should be related to each other as much as possible. You classes should be coupled, or use, or know about other classes as little as possible. 3 A row of code should do only one thing. Single responsibility principle extended.Use “introduce parameter object” to make a data class that holds the parameters together. Less parameters is better than more parameters.Keep often used public method names small thou. Naming things allows you to express yourself almost with free speech.Įrr on the side of of being verbose rather than cryptic. Take advantage of naming things to express intent.Works especially well with conditionals (the part between the parenthesis, after the if). Replace hard to understand code with a well named method that explains what the code does. The most important refactoring techniques for writing maintainable code. Use indirection to replace code with a method call. Indirection is the ability to reference something using a name instead of the value itself. Keep functions and classes small.Īim for 5 lines per function and 50 lines per class. ![]() Maintainability comes in small packages. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |