Practical work 1

https://github.com/heig-vd-dai-course

Web · PDF

L. Delafontaine and H. Louis, with the help of GitHub Copilot.

This work is licensed under the CC BY-SA 4.0 license.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Objectives

  • Create a command line tool (CLI) to process files with Java IOs
  • Practice Java, Maven and picocli
  • Practice a Git workflow to share your work with your team
  • You can choose what the CLI will do (you can be creative! - extract metrics from a text file, grayscale a JPEG file, etc.)
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Demo

Compile the project:

./mvnw clean package

Run the CLI without any arguments:

java -jar target/practical-work-1-demo-1.0-SNAPSHOT.jar
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0
Missing required options: '--input=<inputFile>', '--output=<outputFile>'
Usage: practical-work-1-demo-1.0-SNAPSHOT.jar [-hV] -i=<inputFile>
       [-I=<inputEncoding>] -o=<outputFile> [-O=<outputEncoding>] [COMMAND]
Process an input file and return a result.
  -h, --help                Show this help message and exit.
  -i, --input=<inputFile>   The input file.
  -I, --input-encoding=<inputEncoding>
                            The input file encoding (default: UTF-8).
  -o, --output=<outputFile> The output file.
  -O, --output-encoding=<outputEncoding>
                            The output file encoding (default: UTF-8).
  -V, --version             Print version information and exit.
Commands:
  uppercase  Converts the input file to uppercase.
  lowercase  Converts the input file to lowercase.
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Run the CLI with the uppercase command:

java -jar target/practical-work-1-demo-1.0-SNAPSHOT.jar \
  --input input.txt \
  --output output.txt \
  uppercase

You can also specify the encoding of the input and output files:

java -jar target/practical-work-1-demo-1.0-SNAPSHOT.jar \
  --input input.txt --input-encoding UTF-8 \
  --output output.txt --output-encoding US-ASCII \
  uppercase
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

See the result

Input file:

$ cat input.txt
Bonjour, comment ça va aujourd'hui ?

Output file:

$ cat output.txt
BONJOUR, COMMENT ?A VA AUJOURD'HUI ?

Why is the ç not converted to uppercase?

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Group composition

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Group composition

  • 2 students per group
  • Create a GitHub Discussion to:
    • Announce your group members
    • Announce your idea (even a draft is fine)
  • Do it as soon as possible before next week!
    • This helps us to plan the presentations
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Idea validation

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Idea validation

  • You must state your idea on your GitHub Discussion
  • We might ask you to change your idea if it is too simple or too complex
  • We will help you to find a good idea if needed
  • Do it as soon as possible before next week!
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Grading criteria

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Grading criteria

You can find all the grading criteria in the course material:

  • 0 point - The work is insufficient
  • 0.1 point - The work is done
  • 0.2 point - The work is well done (without the need of being perfect)

Maximum grade: 25 points * 0.2 + 1 = 6

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Constraints

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Constraints

  • The application must be written in Java, compatible with Java 21
  • The application must be built using Maven with the maven-shade-plugin plugin
  • The application must use the picocli dependency
  • You can only use the Java classes seen in the course to process the files (you can use other libraries to help you once the files are opened)
  • Your application must be slightly more complex and slightly different than the examples presented during the course
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Tips

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

The UNIX philosophy and the KISS principle

  • Write programs that do one thing and do it well.
  • Write programs to work together.
  • Write programs to handle text streams, because that is a universal interface.
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

The KISS principle summarizes the Unix philosophy in a simple sentence: Keep it simple, silly!

  • Do not try to do too much
  • Focus on the essentials
  • Do it well

Do not be Numérobis from the movie Astérix et Obélix : Mission Cléopâtre!

Check the movie scene here: YouTube

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

External libraries

  • You can use any external librairies you want in your Maven project
  • You must explain why and how you use it in your README
  • You cannot use some external libraries to open/close the files
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Add members to the repository

  • Add your team members to your repository as collaborators
  • This allows them to push directly to the repository
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Protect your main branch

  • GitHub allows to protect the main branch:
    • Force pull requests
    • Force code review
    • Force signed commits
  • This is a good practice to guarantee quality
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Submission

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Submission

Your work is due as follow:

  • DAI-TIC-C (Friday mornings): 17.10.2024 23:59
  • DAI-TIC-B (Monday mornings): 20.10.2024 23:59

Update the GitHub Discussion with the link to your repository as mentioned in the course material.

If you do not submit your work on time and/or correctly, you will be penalized (-1 point on the final grade for each day of delay).

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Presentations

More details for this section in the course material.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Presentations

The practical work presentations will take place in room B51a on:

  • DAI-TIC-C (Friday mornings): 18.10.2024 8:30-10:25
  • DAI-TIC-B (Monday mornings): 28.10.2024 8:30-10:25

We only have 6 minutes per group. You decide what you want to show us and how you want to present it. Come 5 minutes before your time slot with your computer. You will have access to a beamer.

Please state your group on GitHub Discussions before next week.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Grades and feedback

Grades will be entered into GAPS, followed by an email with the feedback.

The evaluation will use exactly the same grading grid as shown in the course material.

Each criterion will be accompanied by a comment explaining the points obtained, a general comment on your work and the final grade.

If you have any questions about the evaluation, you can contact us!

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Questions

Do you have any questions?

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Find the practical work

You can find the practical work for this part on GitHub.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Finished? Was it easy? Was it hard?

Can you let us know what was easy and what was difficult for you during this practical work?

This will help us to improve the course and adapt the content to your needs. If we notice some difficulties, we will come back to you to help you.

➡️ GitHub Discussions

You can use reactions to express your opinion on a comment!

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Sources

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0