LAB3 Agenda
Room
08:30- 10:30
Data Structures and Algorithms Ex C LAB D002 Lecture room, Ser-D
Get Students Matr. numbers
- give a paper to sign
Today’s agenda
- Good coding Style
- ArrayList: how should be done
What is good coding style (30 min)
-
An example of a bad code. What does it do?
-
Is this code bad?
-
Good coding style principles. Let’s discuss them.
ArrayList: how should be done (30 min)
Focus on:
- Comments
- Variable names
- Methods organization
Common mistakes I saw on the assignments 1
- Overall, I am happy!
We should pay focus to improve
- How to test your methods (we do it next)
- How to organize running tests (we do it after)
Errors that occur when no testing:
- Math.random()
- shift right/left
- swap
Test even most simple methods!
Separate file with explanations.
The explanations of your solution to the problem or the analysis of running time results should be reported in a separate file. For this you should use plain text file(s) (e.g., .txt ) and or your favorite word-processes (e.g., Word)
Style problems:
- bad indentation
- strange variable names
- errors in the code
Testing of ArrayList
- Use a separate method for testing
- Use JUnit
- In principle, it should be possible to obtain all test results by calling one method from main method
Organizing Run-time testing
- Separate class or test class
- In principle, it should be possible to obtain all run time by calling one method from main method