Week 4 Class 8 Thu Feb 02 Posted: Feb 02
After Class
Crosswords
Crossword Labs had an update in the past couple of days. Printing is much more standard. So now you can
Project 1 v1d
General principles that I carefully went over and emphasized, but are being overlooked.
make
make run
, and verify the result.Announcements
Project 1 Pull Request
I created a pull request for Project 1 to create the (empty) files, xml_parser.hpp
and xml_parser.cpp
for part v1d. The easiest way to merge this into your code is the Merge pull request at GitHub. Once you merge, then remember to do a git pull
in all of your cloned repositories.
Note that xml_parser.{hpp,cpp}
expands to xml_parser.hpp
and xml_parser.cpp
in a shell.
Class
Exercise 16: srcFacts Concerns- Handout in class, due by the end of the class meeting
Unless noted otherwise, all exercises are due by 4:30 pm on Monday, Feb 6.
Week 4 Class 7 Tue Jan 31 Posted: Jan 31
After Class
Project 1 Pull Request
I created a pull request for Project 1 to create the (empty) files, xml_parser.hpp
and xml_parser.cpp
for part v1d. The easiest way to merge this into your code is the Merge pull request at GitHub. Once you merge, then remember to do a git pull
in all of your cloned repositories.
Note that xml_parser.{hpp,cpp}
expands to xml_parser.hpp
and xml_parser.cpp
in a shell.
Announcements
v1c
GitHub Desktop & Atom Users Keep your software updated. It is easy to forget about any virtual environments and not update them.
On Windows, Windows Update does not update the Ubuntu in WSL. So for WSL (and Ubuntu):
On macOS, macOS updates do not update the software in brew
. So for brew:
Also, before you install a package, do the above first.
Cleaning Up Package managers download packages and installs them. Once they are installed, the downloads are not needed, unless you want to reinstall
at some point. And, they can be downloaded again if needed.
For WSL (and Ubuntu):
For brew
:
Class
Unless noted otherwise, all exercises are due by 4:30 pm on Wed Feb 01
Week 3 Class 6 Thu Jan 26 Posted: Jan 26
After Class
Announcements
git pull
before you start making any changes to your code. That prevents
the need for a git merge after. That would have prevented some of the git warnings that students were getting.Class
Unless noted otherwise, all exercises are due by 4:30 pm on Monday, Jan 30
Week 3 Class 5 Tue Jan 24 Posted: Jan 24
After Class
git pull
before you start making any changes to your code. That prevents
the need for a git merge after. For the 010 section, that would have prevented some of the
git warnings that students were getting.Announcements
Class
Exercise 11: Separate Compilation Crossword - Delayed until after next class
Exercise 12: Rainfall IV
We continue on with the notes on Rainfall Coding Practices. Refer to Exercise 5: Rainfall I.
Unless noted otherwise, all exercises are due by 4:30 pm on Wed Jan 25
Week 2 Class 4 Thu Jan 19 Posted: Jan 19
After Class
Announcements
Navigation In WSL, if you enter the following command in the WSL shell:
the Windows File Explorer will open with the directory you are at in the WSL shell.
Carefully note that there is a single dot, .
, in the command. A single dot in a shell is the current directory. Two dots, ..
, refer to the parent directory (as in cmake ..
)
Class
Exercise 8: Build & Run srcFacts
Create your srcFacts repository from GitHub Classroom and clone the repository on your machine. Build and run the program to verify it works in your development environment. At the end of the commands, enter the following:
Upload a screenshot (or multiple) to Brightspace of these commands executing.
Exercise 9: Rainfall III
We continue on with the notes on Rainfall Coding Practices. Refer to Exercise 5: Rainfall I.
Unless noted otherwise, all exercises are due by 4:30 pm on Fri Jan 20
One approach to understanding the source code of a system is to count things, e.g., the number of statements, functions, classes, expressions, LOC (Lines Of Code), etc. The program srcFacts produces a report of these counts.
It is very difficult for a program to directly parse C++ source code, i.e., identify the syntactic parts of the code. 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 collecting counts, and produces the report.
The srcFacts program is one large, main() function using almost no design features. It does have high scalability and performance as it is extremely fast and, for example, can produce a report on the entire Linux kernel in under 6 seconds. However, it is not easy in its current form 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. It has no modularity, extensibility, reusability, and specifically no maintainability.
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. The heading in the table must be "Returns". Due Jan 24
Tag v1b
Move the refillContent()
function into the separate refillContent.hpp and refillContent.cpp files. Due Jan 26 27
Tag v1c
Apply the specific design changes from the Coding Practices Task List (to appear). As you verify that the code follows the practices given, check them off. Once you have completed all of them, close the issue. Due Jan 29 31 Feb 1
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. These function declarations and definitions belong in the files xml_parser.hpp
and xml_parser.cpp
, as described above. Due Feb 2 6 9
Tag v1e
Add the necessary code to count the number of line comments and the number of literal strings. The headings in the table must be "Line Comments" and "Strings". Due Feb 6 7 10
Your repository for this project is through GitHub Classroom with a link on the Brightspace course page.
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
.Week 2 Class 3 Tue Jan 17 Posted: Jan 17
After Class
Missing Repositories
I did some cleanup of membership on UAComputerScience, the organization used for GitHub Classroom.
Unfortunately, if you were a member of UAComputerScience, it may have removed your access to your repository.
For most of you, this should not be a problem.
I am restoring access. If you don't have access, send me an email, or a message via Teams.
Update Going through all the repositories, it is only those who took another class of mine (e.g,. Software Engineering) and were members (instead of "outside collaborators"). For those few, I sent out invitations to restore access to your repository.
Navigation In WSL, if you enter the following command in the WSL shell:
the Windows File Explorer will open with the directory you are at in the WSL shell.
Carefully note that there is a single dot, .
, in the command. A single dot in a shell is the current directory. Two dots, ..
, refer to the parent directory (as in cmake ..
)
Announcements
Ubuntu 20.04
If you are having issues installing gh
in WSL, then you probably have Ubuntu 20.04 installed instead of
Ubuntu 22.04. To check your version of Ubuntu:
At some point you will need to update. In the meantime, you can use the following commands to
directly install gh
:
Note that to install an updated CMake, you will have to follow the directions at apt.kitware.com for Ubuntu Focal Fossa (20.04)
Class
Exercise 7: Rainfall II
We continue on with the notes on Rainfall Coding Practices. Refer to Exercise 5: Rainfall I.
Unless noted otherwise, all exercises are due by 4:30 pm on Wed Jan 18
The scores and feedback for Exercise 6: rainfall.cpp is in two parts:
feedback1
branch of your repository. Best to view this on GitHub.The report check/shows the following:
cmake ..; make; make run; make check
git show
cmake ..; make; make run; make check
for the code in this commitdiff
of rainfall.cpp with what I enteredI use the report to give feedback. In some cases, the report can be off, e.g., if you had extra commits.
Overall observations:
git push
.Valid commit messages:
Invalid commit messages:
Week 1 Class 2 Thu Jan 12 Posted: Jan 12
After Class
If you are having issues installing gh
in WSL, then you probably have Ubuntu 20.04 installed instead of
Ubuntu 22.04. To check your version of Ubuntu:
At some point you will need to update. In the meantime, you can use the following commands to
directly install gh
:
Note that to install an updated CMake, you will have to follow the directions at apt.kitware.com for Ubuntu Focal Fossa (20.04)
If this doesn't work, then use GitHub Codespaces to work on Rainfall.
Announcements
Class
Exercise 5: Rainfall I
Note Due to the required setup, Exercise 5 is due by 8 am on Monday, Jan 16. Even with this extra time, there is a lot of setup, so start early.
Unless noted otherwise, all exercises are due by 4:30 pm on Fri Jan 13
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:
Then you clone the repository. Cloning creates a local repository that is a copy of your repository at GitHub.
Now to setup the build:
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
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.
Week 1 Class 1 Tue Jan 10 Posted: Jan 10
After Class
Announcements
O'Reilly Online Learning The course textbooks are 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
Exercises
Exercise 2: Course Content Crossword
Upload a PDF of the completed crossword to Brightspace in Assessments/Assignments, Exercise 2: Course Content Crossword
Make sure to follow the print directions given in class to create a PDF of the crossword.
Also, try to include the headers and footers in the pdf.
All exercises are due by 4:30 pm on Wed Jan 11
Greetings and welcome to CPSC 421 Object-Oriented Programming (OOP) for Spring 2023.
See you on Tuesday, Jan 10 at 10:45 am - 12:00 pm in Arts & Sciences (CAS) room 136