EVERYONE must complete these exercises!
(This is the last
week the above reminder will be posted. Thanks!)
-
Lesson Setup
This is stuff
you'll need to
download and/or
browse before
starting this
lesson
-
Start-of-lecture
Slides
(Required) Online students
will need to
read these on
their own.
Hybrid students
will seem them
at the start of
class.
-
'Starter'
project for
the lesson
02 PCEs (DOWNLOAD THIS!!)
(Project
updated on
1/12)
Download and extract this file. You will
(generally) use it to do all the programming exercises for the
rest of this lesson. (Note: You may not use all the provided classes in the
starter project)
- The
above
link
provides
a
starter
project
that
works
with VS
2019 and
.Net
Core
(.Net 5,
really).
In case
that
doesn't
work I'm
going to
leave
a link
to the
previous
version
of the
starter
project
here.
ONLY
DOWNLOAD
THIS IF
YOU HAVE
PROBLEMS
WITH THE
ABOVE
PROJECT
Please
note
that for
Lessons
01 and
02 the
exercises
are the
same for
both
versions
are the
same but
the file
structure
is very
different. The new
version
(above)
has
everything
in one
file
while
this
older,
backup
version
has
several
different
files
(and
projects)
instead.
-
Watch
the online
videos for this
lesson and
demonstrate your
knowledge
(Hand-In) You have two
choices to
demonstrate that
you've watched
(and understood)
the videos:
either create an
outline or fill
out the viewing
comprehension
quiz (described
below).
Either way make
sure that you
include the
appropriate file
in the .ZIP file
you hand in for
this lesson (in
either Word
.DOC/.DOCX
format or .PDF
format). NOTE:
You can
download
a .ZIP of all
the
videos for this
lesson from
Microsoft's
OneDrive website
by
opening the
folder (click
this link to
open the folder),
then clicking on
the "Folder
Actions" menu,
then clicking on
the "Download
Folder" menu
item.
-
Review: How To Use The
Debugger
- Lesson 02 was a lot of work for a
bunch of people. Let's move 'Debugger' to Lesson 03 or
04?
Covering NUnit first, then the debugger briefly, seemed to
be a good way to go. It gives the students several
examples, and a clear use-case for the debugger
-
VIDEO:
OneDrive:
Debugging, Part
1
DropBox:
Debugging, Part
1
(Remember that these are two separate links to two separate
copies of the exact same file. You can watch either
one, and you only have to watch one)
-
VIDEO:
OneDrive:
Debugging, Part
2
DropBox:
Debugging, Part
2
- Exercise:
How to use a debugger: Intro
-
Enumerations (enums) by using
git and GitHub
-
VIDEO:
OneDrive:
Enums
DropBox:
Enums
-
Exercise:
Figure out what
an enum is
(Demo
Video
VS Project Used
in the Video)
-
Exercise:
Define and use the ErrorCode Enum
(Hand-In)
Link to
access the project for this assignment in GitHub
-
Exercise:
Adding a
file to git, using VS on your computer
(Hand-In)
-
Review: Big Oh Notation
(Running Time Analysis)
-
VIDEO: (18:02)
OneDrive:
Big Oh Review
DropBox:
Big Oh Review
-
Exercise:
Review: Big "Oh"
Notation
(Hand-In)
-
(Handy
reference:
A Beginner's
Guide To Big O
Notation)
-
Exception Handling
-
VS Project Used
in the following videos
NOTE: all of the 'exception handling' videos are in a
subfolder named 'ExceptionHandling'
- Video:
(5:49 - this video is 5 minutes and 49 seconds long)
OneDrive:
Exception Handling: Overview
DropBox:
Exception Handling: Overview
- Video:
(7:10 = minutes:seconds)
OneDrive:
Exception Handling: File I/O
Overview
DropBox:
Exception Handling: File I/O
Overview
- Video:
(5:52)
OneDrive:
Exception Handling: Try Catch
in the same method that throws the exception
DropBox:
Exception Handling: Try Catch
in the same method that throws the exception
- Video:
(4:22)
OneDrive:
Exception Handling: Try Catch
in Main
DropBox:
Exception Handling: Try Catch
in Main
- Video:
(3:19)
OneDrive:
Exception Handling: Throwing
your own exceptions; using exception handling in a constructor
DropBox:
Exception Handling: Throwing
your own exceptions; using exception handling in a constructor
-
Exercise:
Use the exception
handling to reimplement the SmartArray
(Hand-In)
-
Preview: Investigate The
"Stack" Abstract Data Type
- Exercise:
Figure out what
a stack is (Hand-In)
- Exercise:
Preview: Using
the .Net FCL
Stack (Hand-In)
- This link provides some really interesting, really well-done
visualizations of data structures. It's well worth
checking out:
http://www.cs.usfca.edu/~galles/visualization/Algorithms.html
-
Extra Credit
(ADDED ON
4/5/2019 at
11am)
I'm
thinking about
switching from
NUnit to MSTest.
They're so close
that they're
almost
identical, but
MSTest is made
by Microsoft and
I'm wondering if
it'll "just
work" without
the
troubleshooting
that NUnit seems
to need.
In order to get
5 points of
extra credit you
need do the
following:
-
download
this project
NOTE: this
is separate
from the
starter
project
listed
above.
If you take
a screenshot
of the wrong
project you
will NOT get
the extra
credit
points
-
extract it
-
open it
-
open up the
Test
Explorer
window (just
like you did
with NUnit)
and click
'Run All'
-
wait about 5
seconds for
Visual
Studio to
find the
tests and
run them
NOTE: most
of the tests
will fail
and that's
fine.
NOTE: If VS
does _not_
find the
tests that's
also fine -
I just want
to see if
this works
better than
NUnit or
not.
-
The
goal is to
see a list
of tests
that are
colored red
(and/or
green),
which shows
that the
tests were
not only
found but
that they
were also
actually
run.
-
grab a
screenshot
that
includes the
Test
Explorer
window
-
Put that
screenshot
into a Word
.DOCX file
-OR- a .PDF.
Make sure
the file is
named
MS_TEST_RESULTS.docx
(or .pdf).
(Note - I
don't really
care what
the file is
named I just
want to be
able to find
it quickly
and easily.
As long as
it's clear
which file
contains it
then I'm
fine)
-
Make sure to
include that
file in the
.ZIP that
you upload
for this
lesson
-
Unit
Testing With the
NUnit Framework:
Getting the tests to pass
-
The goal
for this
section
is to show
you how
to run
NUnit-based
unit
tests,
how to
diagnose
problems
when a
test
fails,
and to
get you
some
practice
getting
tests to
pass
before
next
week
(when
all your
work
will be
verified
using
NUnit
tests)
-
WARNING:
Because
of
the
open-ended
nature
of
figuring
out
"why
is
this
test
failing?"
you
may
need
to
dedicate
a
goodly
amount
of
time
to
getting
these
tests
to
pass.
-
Warning:
Lessons
03 and
onwards use
NUnit
to
generate
part
of
your
PCE
grade.
-
Download
a
copy
of
the
feedback
form
and
read
through
it.
You
must
hand
in a
copy
of
this
form
with
whatever
feedback
you
can
provide.
- In general, I want to check that this activity can be done and that the course materials clearly explains what you need to do.
All feedback is appreciated, but I particularly want to check that the activity is doable and the materials clear.
- A smaller amount of Insightful feedback is better than a huge volume of space-filling feedback
-
NOTE:
You
will
continue
using
the
same
'NUnit'
material
that
you
used
in
the
prior
lesson.
(I've
included
these
links
here for
your
convenience
but they
link to
the same
files
that
they did
last
time.)
-
Starter project
(using VS
2019, NUnit
3, and .Net
Core / .Net
5) for
the below videos and exercises
(yes, this is
separate from
the above
starter project.
You do NOT need
to hand this one in)
- This
same
slide
stack
is
used
by
all
the
NUnit videos:
Slides (used in the following NUnit videos)
- One really good way to use these slides is to skim/read through thrm to get an idea of what's in each video. For example, if you wanted to remind yourself how to get the tests working (which was covered in the prior lesson) you might flip through those slides again. If you need more detail you can then watch the video, or not.
- You should start this work by downloading the NUnit starter project, extracting it, and making sure that you can see all the tests listed in the 'Test Explorer' panel on Windows or in the 'Unit Tests' panel on Mac
- You may
have
trouble
getting
the
tests to
show up
and/or
getting
them to
run.
If so,
please
refer
back to
the
advice
in
Lesson
01.
In
particular,
the
video
for
How To
Get NUnit3
To Work
In Visual
Studio
(and the
corresponding
slides
in the
NUnit
slide
deck)
can be
very
helpful.
NOTE:
This may
(or may
not)
happen
every
Lesson
(every
time you
download
a new
project)
-
VIDEO:
(4:08)
OneDrive:
How To
Run The
Tests DropBox:
How To
Run The
Tests
-
NOTE:
Yes,
there
are a
bunch of
videos
to
watch.
I've
tried to
keep
each one
pretty
short.
This is
one is
(4:08) -
only 4
minutes
and 8
seconds
long!
-
VIDEO:
(1:36)
OneDrive:
How To
Debug A
Test DropBox:
How To
Debug A
Test
-
VIDEO:
(1:27)
OneDrive:
Explanation
Of Files DropBox:
Explanation
Of Files
-
VIDEO:
(9:56)
OneDrive:
NUnit
Details DropBox:
NUnit
Details
-
VIDEO:
(5:50)
OneDrive:
Finding
Things
Quickly
In
Visual
Studio DropBox:
Finding
Things
Quickly
In
Visual
Studio
-
Exercise:
Make failing tests
pass (Hand-In)
-
Exercise:
Making a basic
unit test pass
(Hand-In)
-
VIDEO:
(6:25)
OneDrive:
Attributes:
'Values'
and
'TestCase' DropBox:
Attributes:
'Values'
and
'TestCase'
- There
are
no
exercises
specifically
for
these
two
attributes
-
TODO:
there's
a
section
in
the
video
about
combos
- it
looks
like
I
claim
that
2
params
X 4
values
is
256,
when
it's
actually
16
(4^2)
-
VIDEO:
(11:21)
OneDrive:
Example
#1 for
getting
tests to
pass DropBox:
Example
#1 for
getting
tests to
pass
-
This
is
the
'Exercise
description'
document
used
in
the
above
video:
example
#1
-
VIDEO:
Example
#2 for
getting
tests to
pass
(using
the
debugger)
()
-
This
is
the
'Exercise
description'
document
used
in
the
above
video:
example
#2
-
VIDEO:
(5:11)
OneDrive:
I/O
Redirection DropBox:
I/O
Redirection
-
Exercise:
Fixing broken
output (Hand-In)
-
Exercise:
Fahrenheit to
Celsius (Hand-In)
- In
order to
hand in
your
work for
this
section,
please
create a
folder
named
something
like
"NUnit",
and put
the
following
two
files
into it.
Put the
NUnit
folder
inside
the .ZIP
file
that you
hand in
-
Student_Answers.cs
- The
feedback
form
-
Last Steps
- Hand in your work:
Because some of your work was done via GitHub and some
wasn't you'll need to hand in both parts, in two separate
steps
- Please follow
the instructions listed here
to hand in the starter project for the overall Lesson.
(These instructions are for BIT 142 specifically, but they
should make sense for this class, too)
MAKE SURE
THAT YOU INCLUDE
THE 'PLACEHOLDER' FILE FOR INSTRUCTOR FEEDBACK,
and that you upload this file directly to Canvas.
-
in order to hand in
exercise 3-C ("Define and use the ErrorCode Enum")you’ll
need to commit your work into your local git repo and
then push those changes back to your copy of the repo
that’s stored in GitHub.
If you need a refresher on how to do that please review
the material from the previous Lesson and/or make use of
office hours, the tutoring hours in the Bock Learning
Center, and/or Google/Bing/etc.
-
Hand in
your work:
Go to the
StudentTracker web app, and create an account for
yourself, and then "enroll" in the course. (There's a
link to
StudentTracker
on the main
page for
this course) Please submit a .ZIP (and ONLY a .ZIP - not a .RAR, .7z, etc).
It's fine for it to contain files that I"m not grading, but
please make sure that contains the Program.cs
files, the video outline/viewing quiz .DOCX (or .PDF), the NUnit
folder with the
Student_Answers.cs file and the NUnit
feedback form, along with any other files you wish to include.
-
For these PCEs please keep the Program.cs
files in the folders you found them in so it's clear
which Program.cs is which. For example, please keep the PCE_Starter folder, please
leave in that folder the Program.cs that was there,
please keep the SmartArray_EH_Test folder with it's
Program.cs, etc. That said - as long as I can find the Program.cs file
that I'm looking for reasonably quickly and easily I'll
be happy :)
-
VIDEO:
Using
StudentTracker
-
VIDEO:
How to .ZIP your homework into a single file
-
Remember that you can use an extension to
hand in your work slightly late (see the lecture 1
slides for details). Once you get the feedback (the grade) from the
instructor you have a limited time to email your missing
work to the instructor (make sure to tell the instructor
that you're using an extension). You can use an extension if you forgot to hand in the
entire .ZIP file, and you can use the extension if
you forgot to include an entire, specific file.
You CANNOT use an extension to revise work that you
submitted and got a grade on.
This is true as long as you have extensions
left; next week will be the last time that this notice
is posted
- Make sure that you're working on
the next homework
assignment.
Details
are listed on the
homework assignment page. The due date is listed on the
main page.
- Practice
what you've
learned
Remember
that in
order to
really learn
this stuff
you're going
to need to
practice it.
Go back and
redo the
exercises
from this
lesson until
you've
really got
it down.
Go back to
the prior
lesson(s)
and review
and redo
that.
Make sure
that you've
really got
this stuff
in your head
(and
remember
that it gets
easier each
time you
redo the
work)!
-
Modern collections classes:
generic classes and interfaces
If you find something confusing you should seek
help earlier than normal - post a question to the class
discussion board, email your instructor, talk to other students,
etc. The Visual Studio project that is
used in the videos below can be found here.
-
VIDEO: What is a
modern collection class? (including "What is a 'generic'
class?")
Part 1:
Collections
Part 2:
Generics Note that there are no quiz questions for these videos, so
you
will need to do a video outline, instead.
Slides from the video
- Exercise:
Using
the GENERIC .Net FCL
Stack as an
example of a Collection class (Hand-In)
-
VIDEO:
Creating your
own generic class
Note that there are no quiz questions for this video, so
you
will need to do a video outline, instead.
- Exercise:
Create a basic,
generic class (Hand-In)
-
VIDEO:
What is an
interface?
Note that there are no quiz questions for this video, so
you
will need to do a video outline, instead.
Slides from the video
- Exercise:
Implement the
generic 'IComparer' interface (Hand-In)
- New Material
Feedback (Hand-In)
Your feedback is critical to improving this new
material. Please fill out
PCE_Feedback.docx and include it in the .ZIP file for
this week.
|