Week 3 Class 6 Thu Jan 30 Posted: Jan 30
After Class
Announcements
Project 1 v1a
Scores (out of 20 possible) are in Brightspace for Project 1. The feedback is in GitHub in the Issues tab of your repository. Issues include:
Do not expect that every part (e.g., v1b, etc.) will be graded before the next part is due. This is a straightforward part. The rest of the parts involve a lot more coding. Also, for some parts, I want to grade the parts together.
The first step of Project 2 will be to fix these issues. You can fix these issues now or later. For small changes, I suggest now. Use a commit message that starts with "Fix". After the issue is fixed, close the issue.
Project 1 v1c
Added the due date for v1c.
The Coding Practices Task List is an issue in your GitHub repository.
Agenda
You will not be asked to explain or define any XML terminology as part of any exam. However, to discuss the problem domain of the project, we require this terminology.
You will need to understand that the parts of XML are a concern, and also that the implementation of a parser for XML is another concern. We will cover the idea of a concern later on.
Exercise 18: Rainfall V
Continuing on using the workflow from Rainfall I
As before, you can follow along and see the commits that I make in class:
Unless otherwise noted, exercises are due by 4:30 pm on Monday, Feb 3.
Week 3 Class 5 Tue Jan 28 Posted: Jan 28
After Class
Announcements
Engineering, Engineering Technology, and Computing Spring 2025 Career Fair
Career Fair Registration
Registration will close on January 31, 2025, at 11:55 pm
Date: Tuesday, February 11, 2025
Time: 10:00 am - 2:00 pm – NOTE THE NEW END TIME (come and go between classes)
Location: Jean Hower Taber Student Union Ballroom & 3rd Floor
We are sold out for our Career Fair once again!
The fair is for students interested in co-op, internship, and full-time placements.
Career Fair & Interviewing Workshop
Date: Tuesday, January 28, 2025, from 1 – 2:30 pm
Resume Review Open House Three Sessions Offered:
Date: Thursday, January 30. 2025
CMake Presets - srcFacts on macOS
On macOS, the libarchive library, libarchive.dylib, is already installed. You just need the proper include files.
I added an (optional) pull request to the repos. If you accept this pull request in GitHub, and do a git pull
in your cloned repositories, it will add a preset for macOS that will correctly set up the include files for libarchive. This does not use the libarchive from brew, but the version already installed on your machine.
To use this, in your build directory, use cmake with the macos
preset:
We will have more presets as the semester goes on, for all platforms. So, be sure to start using this on macOS. To see what presets are available:
Also, if you do not see a pull request, then you may have created your repository (using the GitHub Classroom Invitation Link) after I added the pull request. In that case, you already have the preset. Try it and see (if on macOS).
Agenda
With a few exceptions, the use of proper Git Commit messages is not a part of the grade for Project 1. However, you should try to follow the rules:
Exercise 15: Rainfall IV
Continuing on using the workflow from Rainfall I
As before, you can follow along and see the commits that I make in class:
Unless otherwise noted, exercises are due by 4:30 pm on Wed Jan 29
Week 2 Class 4 Thu Jan 23 Posted: Jan 23
After Class
gh
default The GitHub command-line client, gh
, is very useful. However, the default repo for your GitHub Classroom clones is not your own repo, but the original that your repo was cloned from, the one I setup to generate yours. So if you do a:
it doesn't take you to your repo at GitHub, but to the repo UACPSC/cpsc-421-oop-spring-2025-srcfacts-OOPS25-srcFacts.
The easy fix is to reset your default. The command is:
It will ask you to pick what you want as your default. Pick your repo. Here is an example run:
If you want to truly automate the command and not have to pick, you can use the following:
Note that every time you clone your repository you will have to do this.
srcFacts on macOS
On macOS, the libarchive library, libarchive.dylib, is already installed. You just need the proper include files.
I added an (optional) pull request to the repos. If you accept this pull request in GitHub, and do a git pull
in your cloned repositories, it will add a preset for macOS that will correctly set up the include files for libarchive. This does not use the libarchive from brew, but the version already installed on your machine.
To use this, in your build directory, use cmake with the macos
preset:
We will have more presets as the semester goes on, for all platforms. So, be sure to start using this on macOS. To see what presets are available:
Also, if you do not see a pull request, then you may have created your repository (using the GitHub Classroom Invitation Link) after I added the pull request. In that case, you already have the preset. Try it and see (if on macOS).
Announcements
All project due dates are 11:59:59 pm.
Agenda
Build and run the Project 1 srcfacts program performing the following:
cmake
make
make run
make
Enter the following command:
To demonstrate this, you will record a terminal session using asciinema. It records the commands you enter and the output the command produces. asciinema
is already installed in the GitHub Codespaces image. You can also install asciinema on Linux/WSL/macOS.
asciinema
is relatively straightforward to use.
You can play, pause, skip, etc. You can also copy the commands as text. Note that the replay even includes your pauses and any delay as the command is run.
At the end of the terminal session, asciinema
will show a URL. Anybody can use this URL to view the session. This is what you will submit for the exercise to the link in the exercise title.
IMPORTANT The URL should not contain "connect" or be a local file. Test your URL in a browser verifying that it shows the session you recorded. An incorrect URL will receive a 0.
Exercise 12: Rainfall III
Continuing on using the workflow from Rainfall I
As before, you can follow along and see the commits that I make in class:
If you have any questions or issues, make sure to contact me.
Unless otherwise noted, exercises are due by 4:30 pm on Fri Jan 24
One approach to understanding a system's source code is to count things, such as the number of statements, functions, classes, expressions, and LOC (Lines Of Code). The program srcfacts
produces a report of these counts.
Writing code in a program to directly parse C++, i.e., identify the syntactic parts of the code, is very difficult. So, the srcfacts
program does not parse the C++ source code. It uses another tool, srcML, to convert the C++ source code into an XML format. The srcfacts
program inputs this XML format, parses the XML while collecting counts of parts of the input code, and produces the report. The input has to be in the srcML format, e.g., demo.xml, however it can be compressed or part of an archive, e.g., demo.xml.zip, linux.xml.gz.
The srcfacts.cpp program is one large, main() function using almost no design features. It is extremely fast; for example, it can produce a report on the entire Linux kernel (verison 6.13, 60,392 source-code files, an 4.7 GB file in the srcML format) in under 8 seconds. However, in its current form, it is not easy to debug the XML parsing, add additional program element counts, or even understand what is going on. It includes code for parsing all parts of XML, but it would not be easy to adapt the XML parsing code for another purpose, e.g., another report. The only way to reuse this code is by copy/paste reuse. Overall, it has the following:
Design Characteristic | Level |
---|---|
Scalability | Very High |
Performance | Very High |
Portability | Medium |
Usability | Medium |
Modularity | Very Low |
Extensibility | None |
Reusability | None |
Maintainability | None |
Your task is to take the srcfacts code, improve the overall design, and extract the XML parsing part of the code. When completed, a set of functions in the files xml_parser.hpp
and xml_parser.cpp
will handle as much XML parsing as possible, while the main program, srcfacts.cpp
, generates the report using the XML parser functions for parsing.
The steps (in order) with the associated (git) tag are:
Tag v1a
: Without changing the design, add the code necessary for the report to include the number of return statements. First see how the other counts are collected, then use it as a guide. Do not make any other changes to the project. The heading in the table must be "Returns". Due Jan 28
Tag v1b
: Move the refillContent()
function into the separate refillContent.hpp and refillContent.cpp files. The build is already configured for these files. Due Jan 31
Tag v1c
: Apply the specific design changes from the Coding Practices Task List (an issue in your repository). As you verify that the code follows the practices given, check them off. Once you have completed all of them, close the issue. Due Feb 4
Tag v1d
: Extract a set of (free) functions to handle the low-level details of the XML parsing. Extract one function at a time, i.e., each commit can only include a single extracted function. Due TBA
Tag v1e
: Add the necessary code to count the number of line comments and literal strings. The headings in the table must be "Line Comments" and "Strings". Due TBA
Your repository for this project is through GitHub Classroom, with a link on the Brightspace course page.
v1a
must be completed before Step v1b
.g++
and clang
. An easy way to verify is with GitHub Codespaces.class
es or struct
s created for this project. You are extracting a set of free functions. Any class you create to solve this problem now would not solve the primary problem of how the srcFacts code uses an XML parser.main()
handles XML errors (invalid XML format) with a direct return 1;
so the program exits with the status of 1
. To exit the program from within any function, use exit(1);
which requires the include file stdlib.h
.git clone
and git checkout
.sudo apt-get install libarchive-dev
. To install it on macOS, use brew install libarchive
. The GitHub Codespaces image already has libarchive-dev installed.General Guidelines
Week 2 Class 3 Tue Jan 21 Posted: Jan 21
Special Announcement
Class Meeting 3 on Tuesday, Jan. 21, is remote. We will meet via Teams during class meeting time.
The class meeting should appear on your Teams calendar. If not, there is a direct link in Brightspace.
Announcements
I posted a feedback report, Report1.md, in your repository under the branch feedback. I strongly suggest looking at it on GitHub:
I posted the scores and any additional comments in Brightspace
Report1.md Example report.
Points were taken off for:
Also, do not use term "assignment" or "exercise" in your code. We simulate working on real code.
If you have spacing or wording to fix, you can fix them. However, these commits must start with the word "Fix". Not "Fixing", "Fixed", or "fix", but "Fix".
Exercise 6: Development Environment Setup Results
If you do not have cmake 3.31 or later, you will have problems with further exercises and the projects. Follow my Development Environment Setup instructions. If you have issues or problems setting it up, do not ignore it.
Agenda
Exercise 9: Rainfall II
Continuing on using the workflow from Rainfall I
As before, you can follow along and see the commits that I make in class:
If you have any questions or issues, make sure to contact me.
Unless otherwise noted, exercises are due by 4:30 pm on Wed Jan 22
Week 1 Class 2 Thu Jan 16 Posted: Jan 16
After Class
Remote Teaching In anticipation of the forecasted cold and possible extreme wind chills, class on Tuesday, Jan. 21, will be remote. We will meet via Teams.
The class meeting should appear on your Teams calendar. If not, there is a direct link in Brightspace.
Announcements
Agenda
Exercise 4: Statement Design Quiz
You can follow along and see the commits that I make in class:
If you have any questions or issues, make sure to contact me.
Unless otherwise noted, exercises are due by Noon on Mon Jan 20
Take the starting rainfall.cpp code and make the same changes that I make in class.
Your code is in a repository from GitHub Classroom:
Environment
Local
This would be on your own machine with local files.
First, you need to authenticate your local environment with GitHub: Guide: GitHub Authentication. This only has to be done once per environment, e.g. WSL on Windowws.
Then you clone the repository. Cloning creates a local repository that is a copy of your repository at GitHub.
You can get the repo link from the button <> Code button on GitHub, then under Local and HTTPS.
Cloning a repository creates a directory with the name of your repository, e.g., _rainfall-
GitHub Codespaces
GitHub Codespaces provides a development environment in the browser. When you create one from your GitHub Repository, you are already authenticated with GitHub and have a clone repository. So you can start working right away
You can start a Codespace from the <> Code button on GitHub, then under Codespaces.
Build Setup
Git Workflow on Rainfall
Note Your code must build and compile. If you have a build warning or error, fix these before making any more changes to the code.
Note You must commit each change that I make separately and use the exact commit message that I use in class
Week 1 Class 1 Tue Jan 14 Posted: Jan 14
Announcements
GitHub We use GitHub and GitHub Classroom in the class to manage source code for projects, exercises, and examples. You are required to have a GitHub account.
Optionally, you can apply for the Student Github Developer Pack and get a free GitHub Pro account. To apply, your account email can be a school account, or a personal account if you upload documents to prove your current enrollment status.
git
commands to do so.g++
and cmake
, so avoid relying on them.O'Reilly Online Learning The course textbook is available in O'Reilly Online Learning.
You do not have to be on the campus network (e.g., via VPN) to access O'Reilly Online Learning.
To access content, click the "Institution not listed?" link below the dropdown and enter your UA email. You will then create an account and use that account from now on.
For more information: Library LibGuide
Agenda
Exercise 2: Course Content Crossword
Unless otherwise noted, exercises are due by 4:30 pm on Wed Jan 15
Greetings and welcome to CPSC 421 Object-Oriented Programming (OOP) for Spring 2025.
GitHub In the class, we use GitHub and GitHub Classroom to manage source code for projects, exercises, and examples. You are required to have a GitHub account.
Optionally, you can apply for the Student Github Developer Pack and get a free GitHub Pro account. To apply, your account email can be a school account or a personal account if you upload documents to prove your current enrollment status.
See you on Tuesday, Jan 14 at 9:15 - 10:30 am in (CAS) room 136