object-oriented design. object oriented design crc stands for classes, responsibilities,...
TRANSCRIPT
![Page 1: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/1.jpg)
Object-Oriented Design
![Page 2: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/2.jpg)
Object Oriented Design
CRC stands for Classes, Responsibilities, Collaborators
Class name goes on the top Responsibilities go on the left Collaborators go on the right
![Page 3: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/3.jpg)
UML Basics
Inherits, is a...
Implements, is a...
Aggregation, has a...
Dependency
![Page 4: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/4.jpg)
Design
Identify nouns Group nouns into packages Responsibilities Identify more nouns & responsibilities Use case - example that helps identify what the
program needs to do/handle
![Page 5: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/5.jpg)
Testing
It's a good idea to write unit tests, small examples of things that should happen
Language feature: assert()
![Page 6: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/6.jpg)
Documentation
/** javadoc comment */ put them on classes, methods, fields, as
appropriate @see refer to another class or method @param document a param @return document the return value
![Page 7: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/7.jpg)
Examples
Blackjack? Chess? Battleship? Adventure?
![Page 8: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/8.jpg)
Debugging
To debug:
compile with the -g flag, javac -g Prog.java
To run the debugger
local debugging
jdb Prog remote debugging
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8080 Prog
jdb -attach 8080 To profile:
run like this: java -agentlib:hprof Prog
then start jconsole and attach to your program
![Page 9: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/9.jpg)
Debugging
stop at BlackJackViewer:58 sets breakpoint
clear BlackJackViewer:58 clears breakpoint
dump bj / print bj.game.deck.cards.size() prints out variables
run / step / step up / next / cont
![Page 10: Object-Oriented Design. Object Oriented Design CRC stands for Classes, Responsibilities, Collaborators Class name goes on the top Responsibilities go](https://reader035.vdocument.in/reader035/viewer/2022081822/5697bf9b1a28abf838c92a6f/html5/thumbnails/10.jpg)
Debugging
threads / thread locals set watch threads where