- TIE-0240x
- 3. Interfaces: the interface as a contract
- 3.3 Exercise (COMPULSORY): Starting Project Work
Exercise (COMPULSORY): Starting Project Work¶
The aim in this week is to start working in a new Qt project. .. In addition we practice design-by-contract (pre- and postconditions and .. class invariants) and get familiar with Doxygen, which enables .. embedding documentation into the comments in source code.
The exercise is compulsory so you must complete parts: Qt project and Tags. The submission is done with the help of version control. Remember to commit your work frequently.
The files needed in this task can be pulled from version control. They are in repository student_template_project You must set it as a remote to your local repository. The codes needed in this exercise are in the directory EX1. Note that you do not have rights to update the repository.
- Doxyfile: Configuration file of Doxygen that can be edited with doxywizard program (start from command line) or by hand. (Note! Editing is not obligatory in this exercise.)
- date.hh/.cc: Example class, the interface of which is documented in Doxygen format with pre- and postconditions.
- fraction.hh/.cc, string.hh/.cc, vector.hh/.cc: Classes of the task with missing interface documentation.
Using several remotes¶
On this course, you need to use other remote reposiories in addition to your own to fecth material for course work. Hence, you need to add another remote into your working directory in addition to origin. This is done with: git remote
.
- clone your own remote repository
- move to your own remote repository
- add another remote
git remote add upstream student_template_project.git-URL
, wherestudent_template_project.git-URL
is replaced in its entirety with the URl of the repository. It starts either withhttps://
or withgit@
- pull the contents of the remoten for local use
git pull upstream HEAD
NOTE! The URL of the remote is decided based on whether you have set the SSH key to GitLab or not.
Qt-project¶
Start the exercise by creating a Qt-project for it: New Project-> Non-Qt Project->Plain C++ Application
. The project must be named DesignByContract
. Create it into the same directory ar the codes pulled from version control EX1
.
Qt will create a new subdirectory into you directory. Move the codes needed in the excercise there git mv
, e.g. git mv file.txt Dir/
Open DesignByContract.pro
and fix a couple of important things in it: the compiler should use C++ version C++17and Qt’s libraries.
CONFIG += console c++17
CONFIG += qt
After this add the files for the exericse in to the .pro-file. This can be done from Qt’s user interface from right-click DesignByContract->add existing files...
SOURCES += \
...
DISTFILES += \
Doxyfile
HEADERS += \
...
Tags¶
On the course, all code submissions are done through version control. Before you can go into submitting this week’s work, you need to check it is in a correct state. You can see this from GitLab:
- Push your changes
- Go to GitLab
- Open your repository. You should see a green round icon on the dashboard next to your latest commit. You can see the entire pipeline under CI/CD.
- If the pipeline shows a green
passed
your work is ready for submission. If the commit is red, fix your work and commit again.
Submit your work with a tag starting with EX1_submission. A tag is created:
git tag -a "EX1_submission" --message "Message for tag here"
git push origin HEAD
git push origin --tags
It is important to remember to push both the changes and the tags.
A+ presents the exercise submission form here.