[cs615asa] HW5 grades

Jan Schaumann jschauma at stevens.edu
Sun May 6 13:36:22 EDT 2018


All,

I've just sent out grades for HW5.  If you did not receive an email from
me regarding HW5, please let me know.

Given that you could verify your script against the server, most of you
did get all the functionality.  As mentioned in class, the real exercise
here was not so much writing the simple pipelines to answer the
questions, but to go through the process of going from one or two
commands to an interactive tool that can do a variety of things, while
at the same time testing your outcomes.

A few things to note, as several of you ran into them:

Don't try to parse command-line arguments yourself; use getopts.  You're
not going to get the logic right with optional arguments or multiple
options being given in any order etc.  getopts handles all this for you
(and exists for just about any programming language).


Some of you tried to save execution time and CPU cycles by decompressing
the input data once, then storing the output in a variable.  This is not
scalable: at some point, the data I feed your program will be larger
than what you can hold in memory.  Sometimes you have no choice but to
process the data as a stream.

A similar problem exists if you try to write it to a temporary file, as
you may not have enough disk space to uncompress the data.  In addition,
temporary file handling is a bit more complex than you may initially
think.  Here's a longer explanation of the issues involved (which,
again, apply conceptually to all programming languages):
https://www.netmeister.org/blog/mktemp.html


Several of you showed a pattern like the following:

var=$(some command here)
echo $var

This needlessly creates a whole new subshell and then tries to stuff the
output into a variable, only to then echo the variable.  What's worse,
echoing a variable can, depending on e.g. whether it's quoted or not,
change the output.  Stdout is already going to the terminal, so Instead,
just run

some command here


The readability of your scripts left much to be desired.  As I stressed
in class, you should write your code -- every code you write -- such
that it can serve as an example of your skills.  Use functions, use
appropriately scoped variables, avoid useless comments, and be
consistent in the use of whitespace.  Don't mix tabs and spaces; pick
one or the other, then stick to it.


Finally, when downloading the data file, several of you mentioned that
they had to use 'curl -k'.  I've mentioned this in class, too: don't do
that.  "Oh, curl https://url gave some error" should not yield the
automatic response "curl -k https://url, there, problem solved".  You
should understand what the error was that you encountered and then
figure out what solutions might exist.


-Jan


More information about the cs615asa mailing list