• A method is code block that contains a set of programming statements.
  • Also called a function
  • Purpose: To implement the logic required for specific behaviour or functionality in a class.



  1. Identify the problem that method should solve. will this method calculate and return a value? 
  2. Ensure the method has a single purpose. clarifying the purpose will help determine which class the method belongs to.
  3. Specify the inputs and the outputs, what data the method need? what data should the method return? 
  4. State any assumptions. Does the incoming data need to be within a range of value or date after the current date? Whatever the assumptions are, state them. 
  5. Consider the errors that could occur.



Comments

Popular posts from this blog

Method Overloading

Building a Method