SAP SD/MM ARCHIVING Sheila Schedlbauer Program Manager Microsoft Corporation Session Code: 107.
Teaching Object-Oriented Concepts Through GUI Programming Jesse M. Heines Martin J. Schedlbauer...
-
date post
21-Dec-2015 -
Category
Documents
-
view
215 -
download
1
Transcript of Teaching Object-Oriented Concepts Through GUI Programming Jesse M. Heines Martin J. Schedlbauer...
Teaching Object-Oriented Concepts Through GUI Programming
Jesse M. Heines Martin J. Schedlbauer
Dept. of Computer ScienceUniv. of Massachusetts Lowell
Eleventh Workshop on Pedagogies and Tools for the Teaching and Learning of Object Oriented Concepts
ECOOP, Berlin, Germany, 30 July 2007
2
The OOP Teaching Field The Starting Line
Introducing OO concepts
Working OO examples
CS 1 and CS 2
3
The OOP Teaching Field The Starting Line
Introducing OO concepts
Working OO examples
CS 1 and CS 2
The Finish Line Applying OO concepts Solving programming
problems Advanced courses
4
The OOP Workshop Field 3 papers dealing with “Beginners,”
“CS1& 2,” and “Novice Programmers” Schmolitzky Späh and Schmolitzky Ma, Ferguson, Roper, and Wood
2 papers on “Objects First” Ehlert and Schulte Shümmer and Kösters
2 papers on applying OO concepts Hadar and Hadar Heines and Schedlbauer
5
The OOP Cognitive Field Our experience is that regardless of
how and when OO concepts are introduced, students have trouble applying those concepts in project-based courses
Why? Lack of experience with large programs
The real benefits of OO are difficult to see in the small programs typically used as examples
Consequently, OO concepts do become part of the student’s cognitive field and programming style
“I need an object” instead of “I need a routine”
6
OOP in Class vs. at Work Small programs Large programs
100s of lines 1000s of lines Standalone Hierarchies built
programs using previous code Single files Linked modules
Coded solo Coded in teams Code is never Documentation is
documented absolutely required
Never reused Reused repeatedly By self or others By self and others
7
OOP and GUI Programming Excellent examples of class
hierarchies Java Swing and .NET Students learn just by browsing
Excellent tools for large programs NetBeans, Eclipse, Visual Studio, BlueJ Form designers and code generators
(Mostly) excellent documentation Using the API is a critical skill Creating an API is even more critical Model for student-created
documentation
8
OOP and GUI Programming Inclusion of design patterns
Observers = MVC architecture & listeners
Strategies = layout managers Composites = UI components &
containers Decorators = scroll panes and
borders Singletons = calendars Factories = borders Commands = menus
9
Lecture: Building Bridges Problem: Set the text of the root
node of an existing JTree control Subproblem: There is no method of
the JTree object to set a node’s text Solution: Build
a bridge from the control’s model This requires
understanding relationshipsbetween objects
10
Lecture: Building Bridges Step 1: Create a new root node
DefaultMutableTreeNode root = new DefaultMutableTreeNode ( "New Text" );
Step 2: Get reference to the tree model
TreeModel myTM = myJTree.getModel();
Step 3: Cast the tree model referenceDefaultTreeModel myDTM =
(DefaultTreeModel) myTM; Step 4: Set the tree root
myDTM.setRoot( root );
11
Lecture: Building Bridges Note that this is a very practical
problem with code generators For example, NetBeans always calls
the default JTree constructor
myJTree = new JTree(); One could write “post-creation” code
to set the root node text, but this is a static change, not a dynamic one
Thus, this problem forces students to use the API and think about the objects involved and their relationships
12
Assignment: Object Comm. Problem: Pass data from a custom
dialog box (JFrame) to its parent class Subproblem: Default
member variable access method is private
Solutions: Change access method Use Component.getParent()method
Pass reference to parent in overloaded constructor
13
Exam: FocusTraversalPolicy Center questions around a concept
that students are familiar with (focus traversal), but a class that students have not worked with
Actual questions are in Figure 5 in paper
7 questions address 5 OOP areas Human Factors Issues Use of the API Deprecated Code Class Relationships Application of the concept
14
Additional Information Course websites
Lecture notes, assignments, and examples
teaching.cs.uml.edu/~heines See courses 91.461 and 91.462 on the
Teaching page Contact us
[email protected] [email protected]
Our websites http://www.cs.uml.edu/~heines http://www.cs.uml.edu/~mschedlb