Deep Dive I CodeLab Exercise
Work in progress ….
This CodeLab exercise is designed to help you practice the concepts you have learned in the Java Deep Dive I module on day-1. You will be working on a series of tasks that involve Java Streams, Java Time API, and Lambdas. We will also practice pair programming and using Git and Github. Make an effort to use Git on the command line as much as possible (Git Bash / Terminal) to get more comfortable with it. Check git help in the bottom of this page for more information.
Exercise Overview
Instructions
1. Team up
- Team up in pairs of 2
2. Setup the development environment (one per team)
- One team member should fork Flight data Repo onto their own Github account. The Flight data Repo is a simple application that reads a CSV file with flight data and calculates the total flight time for each airline.
- Add the other team member as collaborators to the forked repository
- Both team members should clone the forked repository to their local machine
- Open the project in IntelliJ IDEA
- Make sure that the project builds and runs without errors. If you have issues, make sure that all Maven dependencies are downloaded and that the project SDK is set to Java 17
3. Get aqainted with the code
- Run the application (find the Main class in
FlightReader
) and see how it works - Look at the code and understand how it works. How does the duration of the flights get calculated and more? You might want to know more about the Lombok library and how it is used in the code to simplify getters, setters etc.
- Look at the
json
file and discuss the structure of the data with your team - Make sure that the data in the
json
file correlates with the data printed in the console - Find the unit-test and run it.
- See if you can understand the test and what it is testing. Could it be improved?
4. Identify tasks, break them down and prioritize
Inspiration for first round tasks:
- Add a new feature (e.g. calculate the total flight time for a specifc airline. For example, calculate the total flight time for all flights operated by Lufthansa)
5. Start working on the tasks (round 1)
- Create a branch off the
main
branch for each task. Call it something likeround-1
- Work on the tasks together using pair programming. Let one person code and the other navigate and ask questions
6. Merge the code
- Merge the
round-1
branch into the main branch:- On the
round-1
branch: add the changes to the staging area, then you commit the changes - Checkout the main branch and merge the
round-1
branch into it.
- On the
- Remove the
round-1
branch - Add, commit, and push the changes from
main
to the remote repository and let the other team member pull the changes. Make sure that the code works as expected - Check that both team members have the latest changes
7. Repeat
- Identify the next tasks (get inspiration from the list below)
- Repeat steps 5-7 for the next tasks and swap roles each round
Inspiration for tasks
- Add a new feature (e.g. calculate the average flight time for a specific airline. For example, calculate the average flight time for all flights operated by Lufthansa)
- Add a new feature (make a list of flights that are operated between two specific airports. For example, all flights between Fukuoka and Haneda Airport)
- Add a new feature (make a list of flights that leaves before a specific time in the day/night. For example, all flights that leave before 01:00)
- Add a new feature (calculate the average flight time for each airline)
- Add a new feature (make a list of all flights sorted by arrival time)
- Add a new feature (calculate the total flight time for each airline)
- Add a new feature (make a list of all flights sorted by duration)
- Refactor the code where needed. Make sure that the code is clean and easy to read.
How to use git in the terminal for round-1
Create a branch and switch to it
git branch round-1
git checkout round-1
Add the changes to the staging area and commit the changes
git add .
git commit -m "Add feature to calculate the total flight time for a specific airline"
Merge the round-1
branch into the main
branch
git checkout main
git merge round-1
Remove the round-1
branch (no longer needed)
git branch -d round-1
Push the changes to the remote repository
git push