Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hill:275 [2009/10/13 17:55]
hill
hill:275 [2009/10/14 12:33] (current)
hill
Line 34: Line 34:
   - Create a new mind map about Software Engineering:​   - Create a new mind map about Software Engineering:​
     * Add children nodes by going to "​Insert > New Child Node", hitting the "​insert"​ key, or selecting the lightbulb {{:​hill:​bulb.png|}}     * Add children nodes by going to "​Insert > New Child Node", hitting the "​insert"​ key, or selecting the lightbulb {{:​hill:​bulb.png|}}
-    * Add at least 5 nodes, with some at least 3 levels deep+    * Add at least 3 levels of children, with at least 2 children per level
     * Save the mind map     * Save the mind map
   - Select a middle node (not leaf or root) and attempt to fold it. There are 3 ways to change a node's folding status:   - Select a middle node (not leaf or root) and attempt to fold it. There are 3 ways to change a node's folding status:
Line 43: Line 43:
  
 ===== Using the type & call hierarchy to understand code ===== ===== Using the type & call hierarchy to understand code =====
 +
 +==== Call Hierarchy ====
 +
 +The call hierarchy shows calling relationships between methods in a program. For example:
 +
 +  * Navigate to the method ''​toggleFolded(ListIterator listIterator)''​ in class ''​freemind.modes.minmapmode.actions.ToggleFoldedAction''​
 +  * Right click the method name and select "Open Call Hierarchy"​
 +  * Look at the callers {{:​hill:​callers.png|}} and callees {{:​hill:​callees.png|}}
 +  * Going back to the callers, expand ''​toggleFolded''​ & ''​toggleFolded''​ again. Look at the callers of ''​actionPerformed''​.
 +  * Try looking at the callers of other methods, such as ''​nameSetFolded''​
 +
 +//**What information does the call hierarchy give you? Why is it useful for understanding a program?​**//​
 +
 +==== Type Hierarchy ====
 +
 +The type hierarchy shows how types are related. For example:
 +
 +  * Right click in the editor window for ''​ToggleFoldedAction''​ and select "Open Type Hierarchy"​
 +  * Right click on ''​AbstractAction''​ and select "Focus On '​AbstractAction'"​
 +
 +//**What information does the type hierarchy give you? Why is it useful for understanding a program?​**//​
 +
 +
 +**Exercise:​** Show me an interesting call hierarchy and type hierarchy on **your own** project code (where "​interesting"​ = more than 3 nodes)
  
 ===== Basic Refactoring ===== ===== Basic Refactoring =====
 +
 +//**What is refactoring?​ Why use it?**//
 +
 +==Rename==
 +  * Right click on ''​toggleFolded''​ and select "​Refactor > Rename"​
 +  * Add your name at the end of ''​toggleFolded''​
 +  * Verify your change is complete by looking at the call hierarchy & double clicking the callers
 +
 +//**Why rename?**//
 +
 +==Extract Method==
 +  * In the renamed ''​toggleFolded'',​ select the 3 statements (6 lines) starting with ''​modeController.getAction...''​
 +  * Right click & select "​Refactor > Extract Method"​
 +  * Enter a name (e.g., "​initiateToggleAction"​) and hit enter
 +
 +//**Why extract methods?​**//​
  
 ===== Debugging in Eclipse ===== ===== Debugging in Eclipse =====
 +//​**What'​s debugging? What's a debugger?​**//​
 +
 +**Task:** How does the UI toggle folding action (click, space, etc.) initiate the ''​toggleFolded''​ implementation?​
 +
 +  * In the margin next to ''​toggleFolded'',​ right click & select "​Toggle Breakpoint"​
 +  * In the menubar, select "​Window > Open Perspective > Debug"
 +  * Make sure freemind isn't running
 +  * Next to the green "​play"​ arrow, select the green bug icon {{:​hill:​bug.png|}} - there will be some delay
 +  * Toggle a node. Notice the upper-left "​Debug"​ pane, investigate the upper-right "​Variables"​ pane, and see the current statement in the editor pane. The arrows in the debug pane {{:​hill:​arrows.png|}} let you step through the execution by one method call, by one statement, or by returning.
 +
 +**Exercise:​** Show me a debugging trace for ''​toggleFolded''​. Which method calls in the trace do you think handle your input method (click, space, right click, etc.)?
  
hill/275.1255470917.txt.gz ยท Last modified: 2009/10/13 17:55 by hill
  • 213 Smith Hall   •   Computer & Information Sciences   •   Newark, DE 19716  •   USA
    Phone: 302-831-6339  •   Fax: 302-831-8458