Programmer's Nightmare – Ruby Prank
github.com
Programmer's Nightmare – Ruby Prank
1–10 of 11 posts
Re: Programmer's Nightmare – Ruby Prank
#2In the end I configured Emacs to highlight all unicode characters, trailing whitespace and tabs bright red. I also had it render zero width characters as normal spaces, otherwise they were still invisible. https://github.com/kzar/emacs.d/blob/master/init.el#L181-L19...
Re: Programmer's Nightmare – Ruby Prank
#3Re: Programmer's Nightmare – Ruby Prank
#4Re: Programmer's Nightmare – Ruby Prank
#51) no LICENSE file
2) not configurable
3) not idiomatic ruby (e.g. camelCase not snake_case)
4) overtly complicated. A better, and shorter version, is:
bad_whitespace = " "
ARGF.inplace_mode = ""
ARGF.each_line do |line|
print line.gsub(" ", bad_whitespace)
end
5) bad commenting. The style of commenting each line for what it does is often silly. Something like "fileModified.close # Close file" tells me exactly nothing more than reading the code. Having "noisy" comments makes important comments less obvious, and thus actually makes the overall commenting worse.This is a sign of a college coder who had some class where the teacher said "you're required to have at least this much commenting", or a beginner programmer.
And finally, this is obviously a dumb toy program.
This isn't useful to show-hn. This isn't anything novel, or even interesting. It's not hard to do. It's poorly implemented and not portable (really, why require the user to edit the filename? ARGF exists for a reason).
This was also submitted by a new hn account mere hours after it was created (clearly by the author). I have no problem with showing off your own work, but at least let it cool down to see if it's a good idea; see that other people think it's interesting or useful in its own right.
I consider presenting an essentially 5-line program that is not generally useable or insightful as being basically spam.
I do recommend keeping on programming and, once you've got a project you're proud of that has seen some use besides yourself, seen at least one other happy user, and relates to HN's interests, post away!
Re: Programmer's Nightmare – Ruby Prank
#6Even worse, we actually had a regression at work caused by a zero width space sneaking into some code. Most editors won't even display anything for that character, even the code review tool we used didn't! In the end I configured Emacs to highlight all unicode characters, trailing whitespace and tabs bright red. I also had it render zero width characters as normal spaces, otherwise they were still invisible. https://…
Re: Programmer's Nightmare – Ruby Prank
#7Re: Programmer's Nightmare – Ruby Prank
#8Re: Programmer's Nightmare – Ruby Prank
#9Critique: 1) no LICENSE file 2) not configurable 3) not idiomatic ruby (e.g. camelCase not snake_case) 4) overtly complicated. A better, and shorter version, is: bad_whitespace = " " ARGF.inplace_mode = "" ARGF.each_line do |line| print line.gsub(" ", bad_whitespace) end 5) bad commenting. The style of commenting each line for what it does is often silly. Something like "fileModified.close # Close file" tells me exac…
If it's not interesting to you don't upvote the post but saying it's "dumb" and "ARGF exists for a reason" is just being rude.
Re: Programmer's Nightmare – Ruby Prank
#10Critique: 1) no LICENSE file 2) not configurable 3) not idiomatic ruby (e.g. camelCase not snake_case) 4) overtly complicated. A better, and shorter version, is: bad_whitespace = " " ARGF.inplace_mode = "" ARGF.each_line do |line| print line.gsub(" ", bad_whitespace) end 5) bad commenting. The style of commenting each line for what it does is often silly. Something like "fileModified.close # Close file" tells me exac…