A method is the smallest block of code in an application. Methods can be reused, which helps prevent duplication. A method hides the details of an operation, so refactoring will not affect the calling code. This takes careful planning to achieve. In this chapter, we will discuss different techniques used to create quality methods: parameters, return values, guard clauses, length, comments, and nesting.
Parameters
Without parameters, there would be no way to manipulate method outcome. Parameters make methods flexible, which creates opportunities for reuse and helps prevent code duplication. Instead of copying ...