Spring_2008_Understanding_complex_method_behaviors_a_case_study_of_weave

Spring_2008_Understanding_complex_method_behaviors_a_case_study_of_weave

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 1316: Representing Structure and Behavior Dawn Finney 1 Understanding complex method behaviors: A case study of weave Understanding complex method behaviors: A case study of weave Introduction to understanding complex method behaviors Often in course of your education or even in industry, you will need to figure out what a particular method or function does depending on the current situation. However rather than tediously tracing code line-by-line, sometimes it is easier to determine the method s behavior based on the results of a few well-selected inputs. However, what can actually be considered exemplary inputs and how do we go about choosing them? A case study of weave To better understand how to choose your inputs, we will walk through an analysis of the weave method. Below is the actual code for the weave method: Because weave is a linked list method, we know that it somehow operates on a linked list of nodes. Thus it would be a good idea to have distinct nodes within the list so that any change will be clearly reflected. a1 g5 c2 1 public void weave(AdvancedSongNode afterThisNode, 2 AdvancedSongNode newNode, int count, 3 int skipAmount) { 4 AdvancedSongNode current = afterThisNode; 5 for (int i = 0; i < count; i++){ 6 for (int j = 0; j < skipAmount; j++){ 7 if (current != null) 8 current = current.getNext(); 9 } 10 if(current != null){
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Spring_2008_Understanding_complex_method_behaviors_a_case_study_of_weave

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online