home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / pub / users / Harry / cse509 / hw3.txt < prev    next >
Text File  |  2002-03-09  |  6KB  |  147 lines

  1. CSE 509  --  HW #3
  2. ==================
  3.  
  4. Date Due:  Wednesday, 30 January 2002
  5.  
  6.  
  7. Goals:
  8. ======
  9.  
  10. -  Write more Smalltalk code.
  11. -  Gain familiarity with the Model-View-Controller and Morphic paradigms.
  12. -  Play with some user interfaces.
  13. -  Gain familiarity with the graphics classes and the classes associated
  14.    with the user interface.
  15.  
  16.  
  17.  
  18. Part 1  -  From the Squeak Textbook:
  19. ====================================
  20.  
  21. (1) Go through Chapter 4 and type in the code for the Clock example as
  22.     you go.  (Do not simply "file it in" from somewhere else.)
  23.  
  24. Note:  You'll need to open a Transcript window, if one is not on the screen. 
  25. A Transcript window is someplace you can print stuff out.  Using the world
  26. menu, open a Transcript and, from a workspace, execute this
  27. "Transcript show: 'hello'; cr.  You should see output on the Transcript window.
  28.  
  29. (2) Read from section 4.3 on in Chapter 4, but you don't need to type in the
  30.     code.
  31.  
  32. (3) Go through Chapter 5 through page 151.  Type in the code and make sure
  33.     it works.
  34.  
  35. Note:  This chapter is based on the MVC interface.  You'll probably need to
  36. open an MVC project and execute this code in that project.
  37.  
  38. (4) Play around with the Clock interface you have created; experiment.
  39.  
  40.  
  41. Part 2  -  An MVC Interface for the Tree Class:
  42. ===============================================
  43.  
  44. (1) The following files are available:
  45.   cs.pdx.edu/~harry/public_html/
  46.    Tree-MVC.st
  47.    Tree-Morphic.st
  48. (Also accessible through the class web page, www.cs.pdx.edu/~harry)
  49.  
  50. (2) File-in the file:
  51.   Tree-MVC.st
  52. This file contains the classes Tree3 and TreeView.  It is meant to be used
  53. in an MVC project and may crash Squeak if used in Morphic.
  54.  
  55. Note:  This version of Tree is a little different from the previous version.
  56. Each node now contains a pointer to its parent (if any) as well as to its two
  57. children.  The parent pointer is needed since we might now be able to delete
  58. a node just by pointing to it.  When deleting a node, we must be able to
  59. modify its parent as well.  I have also made other minor modifications to the
  60. methods as shown in class.  I renamed the class Tree so to prevent conflicts
  61. with your version of Tree.
  62.  
  63. (3) Get a Tree displayed on the screen.  See the class method
  64. TreeView>>example for a start.  Read through and understand the code.
  65.  
  66. (4) Enhance this user interface for the Tree3/TreeView classes.
  67.  
  68.  
  69. Part 3  -  A Morphic Interface for the Tree Class:
  70. ==================================================
  71.  
  72. (1) File-in the file:
  73.   Tree-Morphic.st
  74. This file contains the classes Tree2 and TreeMorph.  It is meant to be used
  75. in a Morphic project.
  76.  
  77. (2) Get a Tree displayed on the screen.  See the class method
  78. TreeMorph>>example for a start.  Read through and understand the code.
  79.  
  80. (3) Try some enhancement for the Morphic user interface for Trees.
  81.  
  82.  
  83. Ideas for Enhancements:
  84. =======================
  85.  
  86. A Tree is always displayed the same way, regardless of the shape of the
  87. window.  In particular, if the window is too small, the tree will be clipped.
  88. Modify the code so that the tree is displayed differently depending of the
  89. window size.  (Hint: Modify the x- and y- increments.  Dealing with vertical
  90. spacing involves thinking about the total available height of the window and
  91. the height of the tree, then figuring how much of a y-increment is reasonable.)
  92.  
  93. If a tree has a huge left branch, but nothing on the right side, it will waste
  94. about half of the window.  The result looks unbalanced.  Figure out how to
  95. position the nodes based on the shape of the tree, to produce a more
  96. aesthetic picture.  (Hint:  Horizontal spacing can be done with this
  97. algorithm: Count the number of leaf nodes in the entire tree and position
  98. them with equal horizontal spacing in whatever width the window allows.
  99. Then position each non-leaf ("interior") node by centering it above its
  100. immediate children.)
  101.  
  102. When the label of a node exceeds more than a couple of letters, the display of
  103. the node doesn't look very pretty.  Modify the code so that the node is
  104. displayed as an oval (or rounded rectangle, or something) that encloses the
  105. text and looks better.
  106.  
  107. Create a way to interact with the tree.  Perhaps you can add a way to add,
  108. delete, or rename nodes.  Perhaps you will include both "delete by name" and
  109. a "delete by pointing at" capabilities.
  110.  
  111. Make modifications appropriate for a Tree that is always ordered.
  112.  
  113. Write a class that handles n-ary trees, which may have any number of children.
  114.  
  115. Any other enhancements/modifications that you think of.
  116.  
  117.  
  118. What to hand in:
  119. ================
  120.  
  121. Part 1: File out the "ClockWorks" category and e-mail it to harry@cs.pdx.edu
  122. with subject "HW #3 - ClockWorks".
  123.  
  124. Part 2: File out the "Tree-MVC" category as you have modified it and e-mail
  125. that file with subject "HW #3 - Tree-MVC".
  126.  
  127. Part 3: File out the "Tree-Morphic" category as you have modified it and
  128. e-mail that file with subject "HW #3 - Tree-Morphic".
  129.  
  130. There should be three files sent.  Please don't submit multiple times without
  131. prior approval.
  132.  
  133. Summary: Please hand-in a single hard copy paper with your name and email
  134. address on it.  Answer the following questions:
  135.  
  136. -  Did you do part 1 (ClockWorks) completely?
  137. -  Tree-MVC: What extensions did you complete?
  138. -  Tree-Morphic: What extensions did you complete?
  139. -  How does your interface work?  The idea is to make sure the grader fully
  140.    appreciates all of the functionality you have provided and to make sure the
  141.    grader can successfully use your user interface.  Include a few of sentences
  142.    such as "The user can add a new node to the tree by..." and "After selecting
  143.    the 'add' menu option, the user should..."
  144. -  Comments on the assignment?  Difficulties?
  145.  
  146. Please keep the summary to a single sheet of paper.
  147.