- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
"I hope none of these students are using Windows" - likewise
Admin
This is the ultimate "useless use of cat" scenario. Kudos to the professor!
Admin
Beautiful !
May be in original research project the file came out from something more complex than a cat ?
Admin
and what happens if dog is your tool of choice?
Admin
Just cus you have a degree doesn't mean you're good at it
Admin
Could be like some exam questions I see where no matter what the language the exam question is it was written in Pascal FIRST, so all arrays must have data starting at 1 index, yes they have to offset their indexes for C, C#, Python, Ruby, Java...
Then don't get me started on not knowing how to use globals !!!! Yes globals are defined, then passed as parameters to functions that are declared with parameters of SAME name and reference the same name in the function.
Admin
Well, they could solve that by supplying some supplementary tools with the parser code, namely a cat binary for Windows users. (With a full installation of Cygwin attached to it.)
Admin
In Pascal, arrays can have any subrange of the integers as their range, like -1000:1000 or 1900:2000 or 0:1000 or whatever you want. No reason at all why an array would have to start at index 1.
Admin
In my humble opinion, what if the professor was trying to show their students the java's ability to execute a OS command? In school not everytime you'll see an optimized code, it depends of what the professor is trying to achieve at that time.
Regards
Admin
Someone needs to rewrite 'cat' so it recognizes that when it has no arguments, it is a useless program, and with only one argument it makes sense only if standard output is to an interactive device (I may be simplifying here).
It would output an error "You are a stupid idiot. Learn how to program."
Wishful thinking in many cases, and way too much logic for such a simple program. Then again look at the complexity of the 'true' or 'false' program, the mind boggles...
Admin
The parsing code seems to have an error too. It reads a line before the loop and then inside the loop it throws that line away and reads the next line. I guess it's ok if the first line is a header or something.
Admin
Hi Herby: I understand your point. But what about if that's the catch of the code? The article says about the instructor: "He had more to say, but no one was paying attention".
If I was the teacher and I feel that no one's paying me attention I can use some gotchas in the code to see if students is looking and understanding de codes. If no one looks it or even understsand the code's flow, then I'll blame them lol ;) .
P.S. I'm a evil teacher, hopefully never became an instructor LOL!
Admin
RE: Windows and HTML comments. Code blue! We have haters in aisle 5!
Admin
My guess is that the code was written by someone who came into "programming" from the command-line script world. It's perfectly normal to cat a file and pipe it through grep and pipe that through ... in the bash/DOS world. I've known script wizards that were unbelievably good at doing just about anything in a cmd/bat/sh/... script. And they were almost always more than willing to send me an example of how to do it in a command-line script when I was researching how to do something in C#. :)
Admin
You just wait until it's the year of the Linux desktop! (or laptop in this case)
Admin
I wish there was a Gordon Ramsay of Code that would go around and yell at people on TV for being muppets about their code and then there would be an episode with this professor and he's all arrogant but then Ramsay of Code puts him in his place and tells him his research project is doomed to fail if he continues on like this and then the profressor cries but tries to hide it from the camera after one of his students that's barely making grades meet bakes a fantastic beef wellington I mean algorithm
Admin
Or of any ordinal type, e.g. enums, boolean:
Array[enum1..enumN] of string; Array[False..True] of string; or Array[OrdinalType] as a shortcut
Array[Boolean] of string;
Array[EnumType] of Char; etc
Admin
If you look in our windows, Bill C. and I have pussy on our laptops. Eunuchs have cat instead. We win.
Admin
If we are still running Windows when the sun burns out, we DESERVE Linux on the desktop.
Admin
Well, programming is not a useful skill for a fairly large part of the CS ecosystem. Every line of code you're writing, you're not writing a grant proposal or paper. (Maybe I'm overly cynic, but even teaching is not a useful skill in the university ecosystem.)
Admin
Duh!
It is clearly program demonstrating binding of java and external compiler/transformer/etc tool. While "cat" is clearly just placeholder. Needing such bindings in real world happens every now and then.
For error handling, well, since it is plain study program that is also likely intentional. Also most likely program is originally written by some student earlier ad part of some research. I have had myself sometimes pleasure to deal with such research apps written by ignorant students.
Admin
Greetings KI
Yes, I totally agree with you. Some time ago I was in need to execute an external command to process several files because using a library required the the company spend some $$ to buy it, instead, executing a process from the custom app was easier because we already had such application.
My point was that Herby explained that cat was doing nothing, the code has a bug, my point is that the instructor maybe was trying to say "Guys, the code is ready to be downloaded with a file example, but beware that the code has a bug when reading the file, your homework consist in identify the bug and tomorrow we review it " (I had this kind of homework too when I was at college),.
Anyways, this article was too funny :)
Kind regards guys.
Admin
Greetings KI
Yes, I totally agree with you. Some time ago I was in need to execute an external command to process several files because using a library required the the company spend some $$ to buy it, instead, executing a process from the custom app was easier because we already had such application.
My point was that Herby explained that cat was doing nothing, the code has a bug, my point is that the instructor maybe was trying to say "Guys, the code is ready to be downloaded with a file example, but beware that the code has a bug, your homework consist in identify the bug and tomorrow we review it " (I had this kind of homework too when I was at college),.
Anyways, this article was too funny :)
Kind regards
Admin
I can relate; I love cats! sometimes I'll just throw a bunch of cats into a shell pipeline just because I love cats so much! $ cat file.txt | cat | cat | cat | grep something | cat | cat
Admin
Yes, (in spite of sanitation), it's still right there in the article: "In fact, this code started life as part of a research project conducted by multiple members of the CS department’s faculty."
This is what scripts look like when they start life as something incidental to the main project, and aren't owned by anybody, but can't change because they are used by everybody.
Admin
No. Programming professors are hacks almost by definition. Coming from a developer who has taught many university students how to program, and in that process having to deal with the ridiculous platforms and required utilities enforced by the professor himself. I'm sure there are exceptions to the rule, but I haven't seen any.
If I'd have to hire a programmer, I'd probably avoid the risk and pick someone without a formal education in IT; better to study it at home.
Admin
Hi Dieter:
In my experience I had the opportunity to work with guys without formal IT education and let me tell you that I was gladly surprised :) but not always are the same.
From my very personal point of view, the difference between a person with IT education and one without it, is the way to solve the issue, avoiding at the same time issues like XSS, SQL-injection. I remembered that some years ago I worked making modifications for a web application made by a Oncologist that knows development, but when I reviewed the webapp code I found a lot of security concerns (one example of the several security concerns was that the DB processing was made using javascript inside the front-end). Persons with formal IT education are more intuitive in that kind of issues (of course, they are exceptions).
Regards
Admin
Please, allow me to try again without gibberish:
The difference between someone with an IT education and another one without it, is that the first understand better the programming logic, the processes involved and understand the skills to develop an application, as well as the security concerns involved. The other persons only knows the "language" itself, I mean, understand the language, but don't have the skills and logic to develop applications (something like know a couple of words in french vs someone that can speak in french).
Hope this clarifies.
Admin
Like Google Tran's Later knows millions of French words ...
Admin
Java is bad enough with regards execution speed. When you mess up the code so much that it becomes woefully inefficient, people are just not going to use your programs! The fact that this is a lecturer in programming, makes me shudder for the future IoT. Someone get me off this planet!
Admin
Execution speed - nobody should care. Using cat is unlikely to form a major problem and can easily be replaced. Code that cannot be maintained and is not fail fast (if it correctly fails at all), now there's a problem. And it certainly is in that piece of crap code.
Admin
Every now and then I write some long and convoluted piece of code because it's the only way I see to get the job done. Then some time later I come back to it and realize, Hey, I could have done that with two lines of code! Sometimes because there's some handy-dandy function in the library that does exactly what I need and I didn't know about it before, sometimes because I was just brain dead and did things the hard way.
I wonder if that's what happened here. The teacher didn't know how to read a file in Java, but he knew how to create a process and execute a command and read the output stream. In this case, I think I'd be saying to myself, There MUST be a function in the library to do this, I just need to find it. But maybe he searched and couldn't find it, or something.
Admin
Program terminated?