Death by a thousand cuts



  • Disclaimer: It's student code, but significant amounts of this are supposedly written by Comp Sci grad students.

    It's not exactly a representative line, more like a representative snippet. It starts like this:

    ArrayList xmlDocumentInfoList;

    Package-protected, and used elsewhere. (At least it's not public, which is an improvement from so much of the code I've seen here.) No generics in sight. Alright, let's see what this is actually used for:

    public void addXMLDocument(String name, String location, String size) {
    	this.xmlDocumentInfoList.add(name + "," + location + "," + size);
    }

    Well, alright, maybe they're going to print it out... Maybe this is dumped to a CSV or something... right? Right? I mean, the people writing this have in theory passed courses in which they were forced to build their own linked lists, graphs, and manipulate and use maps, so a simple map to a custom object would be the obvious thing here, right? There's a reason it was done this way instead, right?

    for (int i=0; i<this.xmlDocumentInfoList.size(); i++) {
    	String eleString = (String) this.xmlDocumentInfoList.get(i);
    	if ( eleString.substring(0, eleString.indexOf(",")).equalsIgnoreCase(name) ) {
    		...

    Nope. Whoever wrote this should've failed CS2 (Data Structures).

    I keep looking for a CodeSOD, or a real WTF, but TRWTF here is in finding things like this several times a day. Public static variables which must be set before calling a given public static method, instead of using arguments or actual object-oriented programming. Code is tightly bound to the GUI, and when it isn't, there are several thousand line long "util" classes. Creating objects is discouraged, as this project is old enough to remember the Java garbage collector being a massive performance bottleneck -- and there are often attempts made to re-use objects, rather than create new ones, to avoid this problem. Exceptions are often caught and then ignored -- if you're lucky, you get a stacktrace to stderr, but other than that, it's barely better than "on error resume next."

    There are very few truly fatal flaws, just a lot of annoyingly sloppy code. Code which is never truly horrifying, but always just bad enough that what should be a one hour task takes most of a week, mostly spent refactoring -- yet not quite bad enough to submit as a WTF.



  • I think this is perfectly good practice in awk. I didn't know awk had advanced types such as ArrayList though.



  • gasp Sanity has arrived to these forums?



  • @Sanity said:

    Nope. Whoever wrote this should've failed CS2 (Data Structures).

    Unfortunately AFAIK a lot of comp sci programs have dropped Data Structures and Algorithms as a requirement.  Hell some school's don't even offer it as a course. 



  • @galgorah said:

    @Sanity said:

    Nope. Whoever wrote this should've failed CS2 (Data Structures).

    Unfortunately AFAIK a lot of comp sci programs have dropped Data Structures and Algorithms as a requirement.  Hell some school's don't even offer it as a course. 
     

    I keep hearing this but it's never confirmed.  Where is this happening?  Or are people conflating a CS degree with an IT certificate from DeVry?



  • @Justice said:

    Or are people conflating a CS degree with an IT certificate from DeVry?

    Well, they've been conflating CS with programming for quite a while, so why not?



  • @galgorah said:

    @Sanity said:

    Nope. Whoever wrote this should've failed CS2 (Data Structures).

    Unfortunately AFAIK a lot of comp sci programs have dropped Data Structures and Algorithms as a requirement.  Hell some school's don't even offer it as a course. 
     

    Any CS program that dropped their data structures course would very likely lose their accreditation. 

     



  • @esoterik said:

    @galgorah said:

    @Sanity said:

    Nope. Whoever wrote this should've failed CS2 (Data Structures).

    Unfortunately AFAIK a lot of comp sci programs have dropped Data Structures and Algorithms as a requirement.  Hell some school's don't even offer it as a course. 
     

    Any CS program that dropped their data structures course would very likely lose their accreditation. 

    I call BS on that.  I have a former BU student working for me who never took the course.  They offered it but it was not a requirement when he was a student.

    Data structures courses are programming courses.  while an intro to programming may be required for all cs students.  A large portion go into othere areas of comp sci.



  • @galgorah said:

    some school<font color="red">'</font>s don't even offer it as a course. 

    Do they still teach English?



  • @lolwtf said:

    @galgorah said:

    some school<font color="red">`</font>s don't even offer it as a course.

    Do they still teach English?

    FTFY. HTH. HAND.

     



  • @lolwtf said:

    Do they still teach English?
    Yes but its often split into literature and writing courses.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.