Jun 152017
 

OER Logo
The Worcester State University Library has called for proposals for Open Educational Resources Initiative (OERI) mini-grants to support Fall 2017 courses to the use of Open Educational Resources.

I have submitted a proposal to support the use of OER in CS 343 Software Construction, Design, and Architecture. This is the first required course in our Software Development Concentration in the Computer Science Major, and is taken by students in the concentration in the Fall of their Junior year.

Rather than repeat material from my mini-grant proposal, I’m just going to reproduce my submission here. Whether I receive the mini-grant or not, I will still be doing this with my course, and I will blog about it here as I work on it.


Course Number

CS 343

Course Title

Software Construction, Design, and Architecture

What type of course is this?

LASC
Check Box Noun project 10759Required course in the major
Elective course in the major

Number of Students

Please estimate the enrollment of the course, either using data from previous semesters (average or aggregate), exact enrollment from the last time the course was taught, or, if proposing a new course, an estimate of anticipated enrollment.

Currently 33 registered for Fall 2017. (Another 5-10 are likely when transfer students register.)

(There were 26 students in the last offering in Fall 2016.)

(This course is a first-semester junior-year course required of all Software Development Concentration students in the CS Major, offered every Fall semester.)

Current Textbook(s) or Anticipated Textbook(s) that will be replaced

If more than one, please list all

Flexible, Reliable Software: Using Patterns and Agile Development, Henrik B. Christensen, CRC Press, 2010 (was used in Fall 2016)

Clean Code: A Handbook of Agile Craftsmanship, Robert C. Martin, Prentice Hall, 2008 (I will likely require this book for Fall 2017 in addition to any OER materials – although if I can find equivalent OER material, I will not require it. This book will be used in all 4 courses of the Software Development Concentration – CS 343, CS 348, CS 443, CS 448.)

New Cost of Current Textbook(s) or Anticipated Textbook(s)

Please list the current price on Amazon for a new version

Christensen – $79.49

Martin – $36.59

Used Cost of Current Textbook(s) or Anticipated Textbook(s)

Please list the current price on Amazon for a used version

Christensen – $51.30

Martin – $29.99

What are your goals regarding this initiative? What are your intended outcomes for your students’ learning?

I am redesigning this course from scratch and there is no single textbook that covers the range of material that I want to include in this course.

My plan is for this course to cover the design of software systems, as represented by design patterns and software architectures. The students will design software systems, and construct some of them from those designs, in some cases using available software frameworks. The unifying theme for these three design topics (design patterns, software architectures, and software frameworks) will be the concept of modeling these designs using the Unified Modeling Language (UML) as a representation.

To implement this plan, I will need to find resources covering four areas:

  1. Learning the most commonly used diagrams in the UML and learning to use a modeling tool to create the models and diagrams.
  2. Learning about the most commonly used design patterns, and to what types of problems they should be applied.
  3. Learning about a number of commonly used software architectures, to what types of problems they should be applied, and how to design with them.
  4. Learning about a number of commonly used software frameworks that correspond to some of the architectures, and how to implement a design/system with them.

By using OER materials for:

  1. The UML – I will be able to pick and choose which diagrams we cover, and to what level of detail. Students will not need a textbook that is larger than needed. In addition, we will have access to instructions for using the most recent version of the modeling tool, and students will not have to translate from a different tool that might be used in a textbook.
  2. Design Patterns – I will be able to pick and choose which patterns we cover, and to what level of detail. Students will not need a textbook that is larger than needed. In addition, I will be able to find more relevant examples of the design patterns for the students.
  3. Software Architectures – I will be able to pick and choose which architectures we cover, and to what level of detail. Students will not need a textbook that is larger than needed. In addition, I will be able to find more relevant examples of the architectures for the students.
  4. Software Frameworks – I will be able to pick and choose which frameworks we cover, and to what level of detail. Software frameworks are not typically covered in textbooks. In addition, we will be able to use the most up-to-date versions of appropriate frameworks, which change quite frequently.

Finally, it will be easier to have the course materials reflect the current state of software design for future semesters, as a textbook would go out of date quickly and not be updated as frequently.

Please give a brief description of the plan for which you seek support. This might include how you will go about identifying or creating resources to replace the materials used in your course, how students will access the assigned content (e.g., via laptop, mobile device or smartphone), how you will make your educational resources openly available, etc.

There are literally hundreds of online tutorials and blog posts about the four areas I want the course to cover. There may be some materials in some of the open content and open textbook databases, but I am not having as much luck with those. The difficulty will be determining which of the materials are of high enough quality and at the right level for the students. The bulk of my effort will be put into finding and reviewing the materials. Once the materials have been identified, compiling them into lessons and background reading for assignments will not be too difficult.

As the materials I am looking at are mostly Web resources, the students will most likely be accessing them on their laptops, although access through a mobile device will be possible.

All materials that I produce myself (syllabus, lists of readings and resources, lessons, assignments, project specifications, and tutorials) will be licensed CC-BY-SA (which I have been doing for years) and will be available on the GitHub repository for the course. I will look into which of the OER sites is the most appropriate for posting to as a directory to link to my materials.

What challenges do you anticipate in implementing your goals? (e.g., time constraints, technology barriers, etc.) How do you plan to address those challenges?

The biggest challenge will be having enough time to review the large quantity of web materials. Another challenge will be the fact that I am still designing the course, as I am researching materials.

I plan to address those challenges by adopting a “good-enough” approach and finding something good enough for each topic first, and then when additional time is available, looking for better materials before the topic is covered (or after the course has ended to prepare for the next offering.)

What library or other support will your project require?

I have not spent any significant time investigating library resources, particularly database and ebook offerings. Spending some time with one of the librarians to look at what is available will be helpful.

How do you plan to assess the effectiveness of this initiative? Will you be able to participate in library assessment?

I will blog about my efforts to design the course and select materials. I will survey the students on the materials themselves. I plan to have the students spend time looking for materials themselves and blogging about them as part of the course, in service of our program outcome:

“Learn new models, techniques, and technologies as they emerge and appreciate the necessity of such continuing professional development.”

I will give the students both the Pre-Test and Post-Test that the Library develops to assess the OER Initiative.

May 252017
 

I am preparing for a new (for me) course for the Fall 2017 semester: CS 343 Software Construction, Design, and Architecture. My intention is for this to be a course primarily about software design and I want to approach it through design patterns, software architectures, and modern software frameworks. These are all topics that I have read a little about, but not enough to really teach. So, I am spending my summer reading a lot about them.

For other courses, I’ve learned little bits of UML (mostly class diagrams, with a very small amount of use-case diagrams, sequence diagrams, activity diagrams, and state diagrams) and all very informal. So, I decided that, if I’m going to teach design, I need a representation for those design patterns and architectures and it’s time that I finally learned UML more formally.

Standardized Structural and Behavioral Modeling for System DesignI am currently working my way through the video series UML Fundamentals, Standardized Structural and Behavioral Modeling for System Design by Simon Bennett from O’Reilly Media (6 hours, 12 minutes). So far, it’s pretty good, although it seems almost more about how to create the diagrams in Enterprise Architect (a commercial product) than about UML itself. I’m going to have to read some books about UML also to supplement the videos, but it’s a good introduction.

The commercial tool he uses looks nice, but I would like to find a FOSS alternative to use, both for myself, and for the students to use in class. I’ve played around a little bit with some of the Eclipse tools for modeling, but I’ve not found them very easy to use. So, I’m still looking. If you have any suggestions, please let me know.

Dec 282013
 

Now that we have the CS Department’s GitLab server set up, and CS-140 Lab 1 is rewritten and tested using the new server, I’ve started to think about how to automate my interactions with the server. I had already  written some Bash scripts to interact with the Bitbucket server to get student code, convert it to PDF files, and put it back on the server after grading. Those scripts should still work fine with GitLab, since it’s just git on a different server.

One thing that I had not been able to automate previously is the step of issuing a pull request for students to merge my grading branch into their repository. This was not too much of an issue when there were only 6 students in the summer class (so only 3 repositories per lab assignment), but it was going to take more time with ~48 students in the spring class. While reading RSS feeds, I came across a post mentioning the GitLab API. This could be the solution to my problems! And there’s a Python module for the API! I had already been writing Python scripts to make my grading easier, and had been starting to rewrite my Bash scripts in Python.

I started playing with the GitLab API in Python, and had managed to create a merge request (GitLab’s term for pull request.) I had also noticed that you could create GitLab accounts through the API. This seemed like something I should pursue – creating ~48 accounts per semester seemed like something that should be automated.

Since I intended to post my code on Github, one of the first issues I had to address is how to avoid publishing my private token for GitLab. I could have put in a dummy token before pushing my code, but I would have to remember to do that before every time I committed my code. The solution to this issue was solved through the use of the .gitignore file. If I put my token into a file, then I could add a line to my .gitignore file so that it would not be committed.

# Private GitLab Token - not to be stored in repository #
########################################################
gitlabtoken.txt

Then I could just read the token out of the file, and use that string.

# Get my private GitLab token
# stored in a file so that I can .gitignore the file
token = open('gitlabtoken.txt').readline().strip()

After importing the pyapi-gitlab module, I could use that token, along with the server’s URL to create a GitLab object. Notice, that I had to turn ssl verification off, since we only have a self-signed certificate.

# Create a GitLab object
# For our server, verify_ssl has to be False, since we have a self-signed certificate
git = gitlab.Gitlab(GITLAB_URL, token, verify_ssl=False)

Creating a user account is pretty simple using the API:

# Create the account  
success = git.createuser(name, username, password, email)

The returned success value is a boolean — either it worked, or it failed (but you can’t tell why…).

One thing that’s a bit odd about the createuser call, is that you have set a password for the user, but the notification email to the doesn’t include the password. (If you create a user account from the web interface, it generates a random password, includes it in the notification email to the user, and requires the user to change their password when first logging in.) And, the password you set doesn’t seem to work either!

So, I’m just telling the students that they should use the “Forgot Password” link to have a password reset email sent to them, and then proceed from there. (If this is ever fixed, I’ll have to generated a random password.)

Getting the class list as a CSV file from the Blackboard Grade Center is pretty easy, and the first three rows contain the student’s last name, first name, and username. I can use those three strings to generate the name, username, and email needed for the createuser API call.

The only challenge with processing the CSV file is that Blackboard puts some strange character at the beginning of the file, so the file has to be opened with utf-8 encoding. (And the header line needs to be thrown away.)

The last thing I wanted to add is a way to have optional verbose output, so that I could see if the user creation was working. (I decided that it should always notify the user if the account creation failed.)  To do this I had to learn two new things about Python: how to parse arguments1, and how to send output to stderr.

I used the argparse module:

import argparse
# Set up to parse arguments
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='Blackboard CSV filename with user information')
parser.add_argument('-v', '--verbose', help='increase output verbosity', action='store_true')
args = parser.parse_args()

and used the verbose argument to determine what to print:

if not success:
    sys.stderr.write('Failed to create acccount for: '+name+ ', '+username+', '+email+'\n') 
elif args.verbose:
    sys.stderr.write('Created account for: '+name+', '+username+', '+email+'\n')

Full code is on Github here.

  1. I already knew how to do simple argument parsing, but I wanted to learn how to deal with optional arguments.
Dec 132013
 

Downloading student assignment files from Blackboard as a single zip file saves a lot of time — you don’t have to individually open each “attempt”, download the file (renaming it in the process, so you don’t keep overwriting the previous file, since they are all named “Homework1.pdf” 😉 ), and then move on to the next one. Instead you get one convenient .zip file that contains all of the assignment files.

Unfortunately, Blackboard does some other things that make your life a bit more difficult. Once you unzip the file, you will find:

  1. The student files are renamed from filename.ext to assignmentname_username_attempt_datetime_filename.ext
  2. A text file is created for each student named assignmentname_username_attempt_datetime.txt even if the student has not entered any text data or comments.

Checking all of the text files to see if they really contain a comment and deleting those that don’t, and renaming all of the assignment files to username.ext so that I can start grading them 1 This process takes 15 minutes or more per assignment, which certainly lowers my enthusiasm for grading.

Today, I decided that I should write some code to automate this task. The time it would take to write the script would be recouped in only a few assignments. I decided to write the script in Python because I could easily see how to do the string manipulations. My shell scripting string manipulations are not as good. I would have to learn how to do the file system manipulations in Python, but I figured that would be relatively simple.

The first step is getting a list of all the files in the directory (leaving out all of the subdirectories)2:

onlyfiles = [ f for f in os.listdir(dir) if os.path.isfile(os.path.join(os.curdir,f)) ]

The next step is filtering that list to get just the .txt files:

txtfiles = [ f for f in onlyfiles if '.txt' in f ]

Then you can search the contents of the textfiles. You’ll notice that there are two characteristic phrases that indicate no text data and no comments. You can just delete the files that contain both of those:

for f in txtfiles:
    file = open(f)
    contents = file.read()
    file.close()
    if 'There are no student comments for this assignment' in contents and \
       'There is no student submission text data for this assignment.' in contents:
        os.remove(f)
        print('Deleted', f)

After refreshing the list of files to be just the remaining files, you can go about renaming the files. They all have _attempt_ embedded in their filename. Then you want to strip off everything up-to-and-including the first underscore, and from the second underscore up to the file extension. Then rename the file.

for f in onlyfiles:
    if '_attempt_' in f:
        first = f.find('_') # location of first underscore
        second = f.find('_',first+1) # location of second underscore
        extension = f[f.rfind('.'):] # get file extension
        newf = f[first+1:second] + extension
        os.rename(f, newf)
        print('Renamed', f, 'to', newf)

There are probably other features I can add, but this works well enough for now. Back to grading…

Full code is on GitHub here.

  1. I may still have to convert some of them to PDFs, if the students have not followed instructions, since I grade them by marking up the PDFs on my iPad. But that’s something I’ll tackle later. For my programming classes, I do that with my grading scripts which are still a work-in-progress.
  2. http://stackoverflow.com/a/3207973
Dec 102013
 

Chad Day recently completed the installation of our new GitLab server (read about it here and here.) This project was precipitated by some issues I had been having in trying to teach the use of git earlier in our curriculum. I had been having the CS-401 Software Development Process students use git and github in their FOSS projects, but it was difficult for them seeing git for the first time and expecting them to use it intensively in a project in the same semester. They had asked a number of times, “Why don’t you teach this in an earlier course?”

So, I decided to try using it in the first programming course – CS-140 Introduction to Programming. While they don’t do any large projects in CS-140, they do work on their weekly labs as Pair Programming. Using git for the collaboration aspect (so they don’t have to keep emailing versions back-and-forth to each other) and as a way to submit their completed lab assignments to me (so I only have to receive one copy of the assignment per pair) seemed to make a lot of sense. In addition, I had attended a workshop at CCSCNE 2013 entitled “Git on the Cloud” which provided a methodology to do just that, which had encouraged me further.

The “Git on the Cloud” workshop suggested using Bitbucket, since it allows an unlimited number of private repositories.1 I’m very willing (in fact, I often require) students to make their code for senior-level projects public with an open source license. But private is important for coursework at the freshman level.

On the other hand, the “Git on the Cloud” methodology involved using a single repository per student, and a different branch for each assignment(!)  In other words, whenever you change branches/assignments, all of your other code goes away, and is replaced with the code for the current assignment.

After discussing this with Chad and Dillon Murphy, we decided that this was too confusing, and gives students an incorrect idea of how git should be used. Also, it would only work in pairs if the students worked in the same pair throughout the semester, and I like to have my students switch partners for each lab. So, I wrote my lab instructions using Bitbucket, but one repository per assignment, per pair.

I tried it out during my summer 2013 section of CS-140. It was a nice testbed — with only 6 students it was not too difficult to work out the bugs in the procedures. In another post I’ll explain how I had the students use the repository, and how I processed the repositories for grading (including the scripts that I wrote with some help from Stoney Jackson on a train ride from Providence to Philadelphia.)

The problem came when I decided to try it with my CS-135 Programming for Non-CS Majors class in Fall 2014. Soon after we started the first lab — the git lab — the student who had also been in the summer class could not add her lab partner as a collaborator to her Bitbucket repository. After a bit of investigation, we determined that while Bitbucket allows unlimited private repositories, you can have at most 5 collaborators — per account, not per repository — without paying. That had not been a constraint with a class of 6, but it certainly was with a class of 24, and it would just get worse as the students progressed to other courses.

At this point, I gave up on git for the semester and started looking for alternatives. I had used Gitolite in the past, which had worked well but had no web interface. I wanted something more like Github, and came across GitLab. I added installing GitLab to Chad and Dillon’s project of building a number of new servers for the department (see here and here.)

Once Chad had finished the GitLab install and worked out the kinks, we decided to test it by running through the CS-140 Lab 1 using the new server. I quickly updated the lab assignment to refer to a repository on our GitLab server, set up the repository on the new server, and had Dillon and Chad work their way through the lab to look for problems. They found a few typos, and a number of places where I had not replaced all the references to Bitbucket with GitLab, but otherwise it worked.

We had only one puzzling issue — Dillon was able to push changes to a repository he should not have had sufficient privileges to modify. It turns out that (not surprisingly) if you are a GitLab adminstrator, you have the ability to push to any repository on the server.

I’m looking forward to testing the server on a larger scale with 48 students in CS-140 starting in January.

  1. I’m aware that students can get multiple private repositories from GitHub, but that requires contacting GitHub and asking. The Bitbucket option just seemed easier.
Dec 022013
 

In my CS-135 Programming for Non-CS Majors class, one of the primary objectives for the students is to learn to work with collections of data in files. I’m always happy when this requires manipulations that can’t be performed with other tools that the students are comfortable with — thus motivating the need to learn to code.

This afternoon in class, students were working in groups on their final projects. Two groups came up against some problems in getting their data into a format that could be easily processed in Python. Both cases involved data that was only available in the form of PDF files.

The old standby of selecting text and pasting it into Excel did not provide nice columns of information. Our second attempt was to export the data as text.

Case 1

In the first case, we got text data that looked like:

Biology 306 N/A 306
Biotechnology 80 26 106
Business Administration 748 N/A 748
Chemistry 141 N/A 141
Communication 245 N/A 245
Communication Sciences & Disorders 218 N/A 218
Community Health 158 N/A 158
Computer Science 116 N/A 116
Criminal Justice 445 N/A 445
Early Childhood Education 80 19 99
Early Childhood Education, Non-Licensure 26 N/A 26

This looked promising – we’ve dealt with one-record-per-line-space-delimited data files in class before. You just need to read a line at a time, and use Python’s string split method to turn it into a list… But — wait! — the first item  is a variable number of words separated by spaces. That will make for some messy lists — they’ll all be of different lengths:

['Communication', '245', 'N/A', '245']
['Communication', 'Sciences', '&', 'Disorders', '218', 'N/A', '218']
['Community', 'Health', '158', 'N/A', '158']

Here’s the solution: Python lists can be indexed from the end using negative indices. So, we can definitely get at the last three values (numbers of majors — undergraduate, graduate, and total). Assuming a list in a variable department, they are at positions department[-3], department[-2], and department[-1] respectively.

But, what about the department name, which may be in multiple list items? Well, we can get it as a sub-list, using list slicing: department[:-3] yields:

['Communication']
['Communication', 'Sciences', '&', 'Disorders']
['Community', 'Health']

All that’s left is to concatenate them together into a single string:

name = ''
for item in department[:-3]:
    name = name + item + ' '

Full code is here: https://gist.github.com/kwurst/7761789

Case 2

In the second case, we got text data that looked like:

Boston    00350000    4368    65.9    15.2    0.8    2.1    15.9    0.1
Boston Collegiate Charter (District)    04490000    34    67.6    32.4    0.0    0.0    0.0    0.0
Boston Day and Evening Academy Charter (District)    04240000    162    13.0    55.6    0.0    6.8    24.7    0.0
Boston Green Academy
Horace Mann Charter School
(District)    04110000    72    70.8    26.4    0.0    1.4    1.4    0.0
Boston Preparatory Charter Public (District)    04160000    27    74.1    11.1    0.0    3.7    11.1    0.0
Bourne    00360000    145    90.3    4.8    0.0    2.1    2.8    0.0
Braintree    00400000    369    95.1    3.3    0.3    0.3    1.1    0.0

Which could be fixed the same way, except for the fact that some of the district names ended up broken across multiple lines. (I’m not sure why this happened, and it turned out that exporting the data in a different way fixed the problem. But I’d already found a solution, so I’m going to document it here…)

Working from the assumption that the district org code always starts with a zero (I know — not a good assumption, but it works in this case…), the solution involves checking for lines with no zero in them and concatenating them together. Then you can treat the lines as in Case 1.

for line in f:
    while line.find('0') == -1:
        line = line + f.readline()

Full code is here: https://gist.github.com/kwurst/7761789

Jun 292012
 

I purchased the book Seven Languages in Seven Weeks from The Pragmatic Bookshelf earlier this week. I’d heard about this book in multiple blogs, and the languages it covers:

  • Ruby
  • IO
  • Prolog
  • Scala
  • Erlang
  • Clojure
  • Haskell

are all “hot” languages that I thought it would be good for me to have some familiarity with. I’ve got about seven weeks left before classes begin again in September, so this seemed like the perfect time to try this.

Today’s task was to install all seven languages. I’m going to be away from the Internet at times, so I figured I had better download all the language environments and make sure they are working, then I can work on the exercises whether I have network access or not.

I’ll try to write more as I work with each language.