G52SWM
>
>
Workshop 2 (with answers)
CW1 Release; IDEs + Java 9/10/11 additions; Maintaining the ZooApp
Peer-Olaf Siebers
Please note that the slides published AFTER the lectures and workshops are the official slides and are the ones that should be used for revision.
>
Week 2 Organisation
• Lecture 2:
– Going through more advanced Java topics
• Java Collections framework
• Implementation of object oriented principles
• Lab 2:
– Working further on the ZooApp example
– Looking at packages
• Workshop 2:
– CW1 Release
– IDEs + Java 9/10/11 additions
– Maintaining the ZooApp (basic maintenance)
COMP2013-Autumn 2018 2
>
eclipse and intellij
COMP2013-Autumn 2018 3
>
Useful Website to Learn More about the IDEs
• TutorialsPoint: Eclipse (+ Java)
– https://www.tutorialspoint.com/eclipse/index.htm
• TutorialsPoint: IntelliJ
– https://www.tutorialspoint.com/intellij_idea/index.htm
• JetBrains: IntelliJ Video Tutorials
– https://www.jetbrains.com/idea/documentation/
COMP2013-Autumn 2018 4
https://www.tutorialspoint.com/eclipse/index.htm
https://www.tutorialspoint.com/intellij_idea/index.htm
https://www.jetbrains.com/idea/documentation/
>
what’s new in Java 9/10/11
COMP2013-Autumn 2018 5
>
What’s new in Java 9/10/11
• Java 9
– Modules
– jShell (read-evaluate-print loop tool)
• Java 10
– Local-Variable Type Inference
– Enhancements for garbage collection and compilation
• Java 11
– Removal of JavaFX, which is now available as a standalone technology
COMP2013-Autumn 2018 6
>
COMP2013-Autumn 2018 7
Notes from Demonstration
>
maintaining the zoo
management software
Basic Maintenance
COMP2013-Autumn 2018 8
>
COMP2013-Autumn 2018 9
>
Basic Maintenance
• What would you propose how we should get started?
COMP2013-Autumn 2018 10
>
Basic Maintenance
• Use Eclipse
COMP2013-Autumn 2018 11
>
Basic Maintenance
• Use IntelliJ
COMP2013-Autumn 2018 12
>
Basic Maintenance
• Dividing all classes into packages
– Why is this useful?
• Making all animal subclasses abstract
– They should not be instantiated as they are still high level
• Removing redundant code
– “buildNewEnclosure()” is not required any more
– Remove some setters (to gain control)
• Commenting code and producing Javadocs
COMP2013-Autumn 2018 13
>
Basic Maintenance
• Packages are used in Java in order to prevent naming conflicts, to
control access, to make searching/locating and usage of classes,
interfaces, enumerations and annotations easier, etc.
COMP2013-Autumn 2018 14
Remark: This and the following screenshots
are based on an earlier version of ZooApp
>
Basic Maintenance
• Javadocs
/**
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
*
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
* @param variable Description.
* @return Description.
*/
@author John Smith Class, Interface, Enum
@version version Class, Interface, Enum
@since since-text Class, Interface, Enum, Field, Method
@see reference Class, Interface, Enum, Field, Method
@param name description Method
@return description Method
@deprecated description Class, Interface, Enum, Field, Method
COMP2013-Autumn 2018 15
>
Basic Maintenance
COMP2013-Autumn 2018 16
>
Basic Maintenance
COMP2013-Autumn 2018 17
>
Basic Maintenance
COMP2013-Autumn 2018 18
>
And finally …
• Two things we have not dealt with which are vital for SWM
– Version control (e.g. GIT Repository)
– Unit testing
COMP2013-Autumn 2018 19