- if classes / methods become lengthy and complicated you need to consider refactoring
** extracting code in separate classes methods
** eliminate redundant code
[background-color = "#124990"]
[color = "#fff6d5"]
== Some useful considerations
== Refactoring
- work on the code without adding functionality
- simplify and optimize
- make it more maintainable and reusable
== Refactoring (2)
- find problem areas and improve
** very long classes or methods
** long list of parameters
** confusing package structures
** ...
== Refactoring (3)
- aim for short methods with simple control flow
- avoid recursion (harder to understand the )
- limit loops
- limit variables to the smallest scope possible
== Nesting
- complex flow in methods is hard to understand
- if you are beyond 2-3 levels you need to consider refactoring
== Naming
- use suggestive names
- adhere to conventions
- do not abbreviate
- avoid single letter variables (y)
- do not include types in names (intCount, bResult)
== Naming (2)
- do include units where needed ( delayInSeconds )
- difficulty naming might indicate the need to rethink design
- avoid naming classes Abstract... or Base...
- avoid using an evergrowing "Utils" class
[background-color = "#124990"]
[color = "#fff6d5"]
== UML Diagrams
[.smaller-80]
== UML - Unified Modelling Language
- 13 diagrams that show various perspectives on the system
- purpose:
** Stimulate and focus discussion about an existing or a new system
** Document an existing system
** Detailed description to generate a system
- informal use of UML:
** “I do not find UML to be useful during the design process itself and prefer informal notations that are quicker to write and that can be easily drawn on a whiteboard.” (Sommerville, s. 175)