[cs631apue] Some details related to the HW2

Jan Schaumann jschauma at stevens.edu
Sun Sep 21 10:47:23 EDT 2014


Sadia Akhter <sakhter at stevens.edu> wrote:
 
> Can you please confirm which behavior you want to be implemented in
> the assignment?

Either is acceptable, but it's worth to consider what the user might
expect.  On the one hand, creating the directory is useful, since the
user seemed to want to have it exist.  On the other hand, users often
times mistype and especially in a deeply nested hierarchy it'd be less
desirable to have accidentally created subdirectories after a typo.  The
counter argument is of course that the program does what was asked of
it.

So yes, either approach is defensible.  Me being lazy, I'd probably opt
for the much simpler approach of erroring out, as that means I have less
code to write.  Less code means fewer bugs, and simplicity is generally
preferred over complexity.

-Jan


More information about the cs631apue mailing list