flwyd: (java logo)
[personal profile] flwyd
I created a fairly simple programming exercise for job candidates. It's not trivial, but it's not super hard. Someone who's written programs before and can figure out the solution should be able to write the program in two hours or less. The problem description says "Your program should read from standard input (stdin) and write to standard output (stdout). Sample input and output are available."

I'm rather dismayed by the number of submissions which don't read from standard input or output. The most common violation is using a hard-coded path like C:\input.txt (tip: I'm not running Windows, I don't have a C: drive; even if I did, I wouldn't have the sample input there). Other violations include requiring filenames on the command line (not terrible), prompting for all values interactively in such a way that I can't just run cat input.txt | program, and one submission in PL/SQL that hard-coded the sample input as a bunch of INSERT statements. Tip: I put "use stdin and stdout" in the instructions so that you didn't have to bother with all the file opening and closing details. Also, do they not teach students to run their programs before submitting them? Running a submission on input bundled with the problem shouldn't throw an error before producing any output. Maybe students don't know how to use a command line environment any more and I/O redirection is a foreign concept.

Do today's computer science students really not know what standard input and output are? Do they really have assignments that say "Read this file from C:\Homework\Problem1?" My hope was to create an evaluation script that ran several files through submitted programs and report a correct answer rate. But when correct programs are little more likely to read from stdin, I can't even write a script capable of getting an answer.

Punks.

Date: 2008-09-12 05:57 pm (UTC)
From: (Anonymous)
I'm no programmer, but couldn't your assignment be completed with one or two lines of Perl? With that fish-face thing? (<>)? Or am I thinking of something totally different?

And yes, I'm guessing with all the cutesy little GUIs out there for programming, a good chunk of the students have no idea what some of the most basic concepts mean. stdin and stdout ignorance are just the tip of the don't-know-don't-get iceberg.

Date: 2008-09-12 06:00 pm (UTC)
From: [identity profile] flwyd.livejournal.com
Yes, the "fish-face thing" in Perl makes it trivial to read lines of standard input. The program is more than just two lines in perl; it involves building and navigating a graph with some constraints. But I designed the problem so that you could do all the I/O in two lines of Perl because text file I/O is the sort of thing that should be idiomatic.

Date: 2008-09-12 06:01 pm (UTC)
From: [identity profile] murasaki-suki.livejournal.com
Whoops, that was me. Didn't notice I was logged out (speaking of not paying attention...) :)
December 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2025

Most Popular Tags

Page Summary

Expand Cut Tags

No cut tags
Page generated Sunday, January 4th, 2026 10:18 pm
Powered by Dreamwidth Studios