• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Using a Dummy Head for a Singly Linked List

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey everyone, Ive been trying in vain to figure out what I am supposed to do for this. I have been all over the internet for days, and every time I think I got it right I find something else that makes me think otherwise.

What I am trying to do is set up a constructor for a singly-linked list that makes the list empty. I also have absolutely no idea how to create a Dummy head, and to complete my assignment I need to implement one.

This is what I have so far:

 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, can you tell us how this isn't the solution? What is wrong with it? In other words: TellTheDetails (<- link).
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well its not necessarily that I even know. The main issue is that I have gone all over the internet and gotten conflicting signals on how to create an empty singly linked list using a dummy head and I am not sure now how to even check if what I have is right. Most of the stress revolves around creating the Dummy Head.
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then my suggestion is to stop searching the internet. Start with a pencil and piece of paper. Define what an empty doubly linked list means. Then restate the definition using simpler words, and more sentences. Then repeat that process until you are pretty sure you could tell a 10 year old what an empty doubly linked list it. At that point it probably won't be too hard to translate to Java.

You problem is that you are wasting your time waiting for the internet to tell you what to do. What you need to do (says the internet) is analyze the problem and design a solution. There will be less conflicting opinions if you are the only one with the opinions.
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Will understanding doubly linked lists help me with understanding a dummy node acting as a cursor to a singly linked list?
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I misread this sentance:

What I am trying to do is set up a constructor for a singly-linked list that makes the list empty.

as

What I am trying to do is set up a constructor for a doubly-linked list that makes the list empty.

So my advice was to get you through that hurdle. Substitute 'singly' for 'doubly' in my post above.

Will this help you with the dummy head? One step at a time, friend. Stop thinking about the next problem until you fixed this problem. If you determine that the definition of an empty singly linked list means you need a dummy head (because your prof told you it does), then you will have to address the dummy head problem first. In that case, do the same exercise with 'dummy head' as you are doing with 'empty singly linked list'.

1) Use paper and pencil
2) Define what dummy head means.
3) Simplify the definition to child-like words.
4) Translate to Java.
5) then power on the computer and write code.
 
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Robert, I think Steve has given you some good advice, which I'll try to add to. It seems to me as though you've heard from some source about something called a "dummy head." Armed with that phrase and with the phrase "singly linked list," it seems you've had a frustrating experience searching for help via Google. While Google is a great tool, you may have used it somewhat backwards. That is, a "dummy head" may or may not be relevant to your problem; using Google to learn more about singly linked lists might (or might not) tell you what is (and is not) relevant to that topic. By looking for help associated with that phrase ("dummy head"), I think you may have excluded what would otherwise have been some useful guidance.

Looking at your class file, I see you have both "head" and "next" as instance variables. This has me wondering if you know that each item in your list will contain a reference called "head," and if that's what you even want. Fact is, you don't need "head" in your class (nor "tail," for that matter) to implement a singly linked list. To know for sure, you should follow Steve's advice: do this with paper and pencil before you write more code. A typical linked-list diagram is pretty simple to sketch out:



Note that the "head" in this one is not a dummy; it's a pointer. A lot of people build their lists like this:



That's because they seem not to get the difference between a data structure and a pointer to a data structure (even though, in a linked list, each entry in the list will be a data structure that includes a pointer to a data structure).

Now, Java doesn't have pointers in the sense that C and C++ have them. But it does have references, which will do the same thing for you in this exercise.

One thing that may throw you, a bit, as you consider how to design your class(es) is that you may feel you need some kind of "SinglyLinkedList" class, and also some kind of "ListElement" class. You're probably going to find you don't need the first of those, because each ListElement will include a reference (a pointer) to the rest of the list between that element and the tail element.

All sound kind of vague? It's not, once you see that you can translate, as Steve has suggested, a paper diagram and simple wording into Java. But you need the paper diagram and the simple wording first.

Come back here if you get stuck with that.
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh I see, so the pointer does not have a value in itself, while all the other elements have values as well as a pointer directing them to the next element.

So, the issue I am having now is how do i get that pointer without a value to act as a cursor?
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a full summary of what I have to do, it should explain in easier terms what I am trying to accomplish with the "dummy" head.

http://www.pcs.cnu.edu/~siochi/classes/cpsc270/ListSCBL/
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Maino wrote:Oh I see, so the pointer does not have a value in itself, while all the other elements have values as well as a pointer directing them to the next element.



You got it, Robert!
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stevens Miller wrote:

Robert Maino wrote:Oh I see, so the pointer does not have a value in itself, while all the other elements have values as well as a pointer directing them to the next element.



You got it, Robert!



Thats great, but I still do not know how to implement it Q_Q
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Maino wrote:Here is a full summary of what I have to do, it should explain in easier terms what I am trying to accomplish with the "dummy" head.

http://www.pcs.cnu.edu/~siochi/classes/cpsc270/ListSCBL/



Well, props to you for not hiding the fact that this is an assignment (unless, by some chance, you are doing this on your own initiative).

Think about how you came to understand that a dummy head is not needed. Now, if your head pointer did have a value (that is, if it were contained within an actual object, rather than being merely a reference to the first object in your list), what difference would that make? Since the assigment actually calls for a constructor that returns a list, not just an element, and the methods appear to operate on lists, not elements, think about how the cursor could be a reference to one element. The list object could maintain tha cursor and it would, in many ways, be an extension of the head reference I suggested earlier (that is, it could simply be a reference to a list element).

Now, I know that's vague, but local policy here is not to give answers to homework questions, only guidance, and it seems to me that you're getting a grip on the problem. Also, there's another reason I can't be more specific about how to approach this just now, which requires that I first say this:

<PERSONAL RELIGIOUS RANT ABOUT DUMMY HEADS>

This is a really dumb assignment if the purpose is to teach you how to implement a singly linked list. Dummy head, fergawdsake? I just showed (and this student quickly got) that such a thing is completely unnecessary. Further, the operations as specified show a procedural bent when this ought to be a really good object-oriented exercise. List items should be told to insert themselves after others, not have a single "list object" do it all in one class. And, a "goPrev" method? Unless the point is to show that this is not efficient (or else not easy) to do in a singly linked list, what is that method doing in the assignment?

Java makes this kind of thing quite easy to do, and quite easy to understand, if you are allowed to do it right. The point of this assignment would appear to be, for reasons I do not know, to make the student do it... well, maybe "wrong" would be hard to prove, but... well, "not right" is pretty close.

Dummy heads in linked lists. In the year 2013. Good gawd.

</PERSONAL RELIGIOUS RANT ABOUT DUMMY HEADS>

Based on the assignment's requirements, I believe a lot of what I would have envisioned as being directly available to the creator of the list will now have to be done inside the list object's class definition. Nothing wrong with that per se, but it means my original statement about how you will only need ListElement and not SinglyLinkedList was wrong in this context.

Good luck with the rest of the problem.
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, so I tried something else, but I still have zero indication whether to tell me if I am on the right track or not.

ListSCBL.Java


Node.java
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Maino wrote:Alright, so I tried something else, but I still have zero indication whether to tell me if I am on the right track or not.


What, you mean that you wrote code that you weren't sure of? Does that mean you guessed? Please StopCoding (<- ink), and get the pencil and paper out, and start writing out the steps. There are too many permutations for you to guess correctly.

How do you know you are on the correct track once you do start coding? Your prof. told you: every method should have a test written for it (it is in the requirements.) That is a great practice to get into. You can also try to write the tests before you write the method, so you think about what 'success' and what 'failure' means. Then run them after coding and make sure your 'success' tests succeed and your 'failure' tests fail.

But that is still ahead. First: you should have a real solid feel of what you need to do written out, in simple terms and great detail before you code. You should be pretty confident you understand what you are doing first. Otherwise you code yourself into corners. (believe me, I know, I've been in many a corner).
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Maino wrote:Alright, so I tried something else, but I still have zero indication whether to tell me if I am on the right track or not.


I'd suggest that is because you don't have a main method anywhere. What is going to run this code? How are you going to test it?

One of the reasons that I think Steve's "do it on paper first" idea is good advice is that it gets you thinking about how you will put your class and objects to use. "Structured programming" and "top-down programming" are such widely accepted practices that, these days, one hardly even sees those phrases anymore. But, that doesn't mean the techniques they describe(d) are obsolete. Far from it!

So, let's get you back to basics: If someone else had already fully implemented (that is, "written") the required ListSCBL class, you would be able to write a program to use it, right? That's how you should proceed to develop your own implementation. of that class; write a program with a main method that creates its own ListSCBL object and calls each of its methods. Initially, you will create a class that doesn't do anything. But, inside that class, you can define each of the specified methods. Initially, none of them will do anything either, but you can have them each return some value that is at least consistent with the specified return type (which is actually void for all but three of the methods).

Once you've done that, one by one, you can create the code for each method that will actually work. One by one, as you do this, you can use your main method to test what you've done.

Without a way to test what you've done, you truly do have "zero indication" of whether or not you're on the right track.

So, I believe your next two steps are:

1. With pencil and paper, sketch out what each method does (not how it does it) to a linked list. Consider the case where a method must work on an empty list when you do this, as well as cases that call for any special handling of the head or the tail (or the case where the head and the tail are the same element).

Once you are confident that you know what each method does, proceed to

2. Write a main method that creates a list, calls the defined methods, and produces output that will let you confirm that the results of those calls are what you expect. (Note that you don't have to write all those calls before writing any of the ListSCBL methods. But, before you write your, say, "goNext" method, add code to your main method that calls your goNext method, and that does so in a way that will produce a result you can predict, so you can compare your prediction with what your goNext code does when you write it.)

When I was learning to program back in The Stone Age (about 1980), we called this technique "top-down programming." It's not the only way to get things done, but it may be a very good way for you to feel like you have some sense of whether or not you are making any progress.

(In all candor, I should admit that one criticism of top-down programming is that it tends to lead to procedural coding more than to object-oriented coding. But, this assignment appears to be focused on a classic data structure, not a programming paradigm and, as such, I think the top-down approach will work well for you. Others may wish to suggest something else.)

 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:Your prof. told you: every method should have a test written for it (it is in the requirements.) That is a great practice to get into. You can also try to write the tests before you write the method, so you think about what 'success' and what 'failure' means. Then run them after coding and make sure your 'success' tests succeed and your 'failure' tests fail. [emphasis added by Miller]


This is a more succinct, less preachy way of expressing what I tried to suggest.

But that is still ahead. First: you should have a real solid feel of what you need to do written out, in simple terms and great detail before you code. You should be pretty confident you understand what you are doing first.


I cannot emphasize (even with bold face and italics) how important this advice is. For new programmers, the desire to get to the keyboard can be overwhelming. But, when you are learning how to manage data structures, most of your computer programming will take place on a blackboard or a sheet of paper. This is serious advice I have lived through myself. I think it was at least five years after I finished my master's degree before I stopped finding pads and napkins in my desk drawers and file cabinets with boxes and arrows drawn all over them. If it helps you accept this any, tell yourself that you are doing computer science, not computer programming.

Otherwise you code yourself into corners. (believe me, I know, I've been in many a corner).


Brother, I feel your pain.
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I took all of you all's advice, how does this look?

ListSCBl.java



Node.java
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Maino wrote:Well I took all of you all's advice



Where is the main method and the testing code?
 
Robert Maino
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats the only thing -le shrug- I couldnt exactly find a way to test it, im still looking in my book. Bizarre i know, but this entire thing has been so stressful I am not sure how to create a list of objects xD
 
Marshal
Posts: 80769
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stevens Miller wrote:tell yourself that you are doing computer science, not computer programming...


Like it; and I intend to plagiarise it too.

Winston
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Robert Maino wrote:I couldnt exactly find a way to test it



Robert, with all due respect, you seem too bright to be this thick . We've told you how: write a program that calls each of the methods in the javadoc specification your professor has laid out. Draw diagrams that show what the effect of each method should be, then use more calls to query the list and verify that the results of the calls match what your diagrams predict.

Now, speaking as someone who also took science courses at a liberal arts college, I am aware that the pedagogical context you are in may not be the one most suited to learning how to turn conceptual data structures into running code. Indeed, when I was at Amherst in the late '70s, we didn't even have any computer courses (because, y'know, computers are actual things and, well, this is an arts school, and you can get a job in the computer field, so, well... we don't teach that here). Most of us who had to write programs at all did so because it was part of an intro physics class wherein the (very thinly camouflaged) purpose was to make physics students believe that numerical simulations were not reliable ways to get answers to questions about physics. I will admit that, over 30 years later, it is somewhat disturbing to see that all of physics, computer science, and engineering, are lumped together at one of my own state's rising-star liberal arts colleges. Makes me wonder if, just as I experienced, you are being taught how to use computers by people who are, if not disdainful of them themselves, surrounded by colleagues who disdain machines. Can't blame you for that, if you are, but it might explain why you are in this pickle of a problem you clearly have the potential to solve, while being at kind of a loss from your instructional materials (and your instructor, apparently) at how to solve it.

What I can blame you for is not taking the good advice you're getting right here! Come on, now; Campbell has written an almost complete test suite for you (though he has, understandably, written it in the expectation that your singly linked list is best treated as a stack, while your professor seems to think it can be treated more like a doubly linked list, but we've been through that once already, so I won't repeat my rant on that any further here).

So, let me ask you: Have you drawn the diagrams we've been talking about?
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Stevens Miller wrote:tell yourself that you are doing computer science, not computer programming...


Like it; and I intend to plagiarise it too.


Typical Brit's respect for words.

It's "plagiarize."
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stevens Miller wrote:It's "plagiarize."


No, it isn't.

Typical Yank's respect for spelling.

Winston
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you got me there.

Hey, while we're waiting for Robert to do his diagrams and get back to us, maybe you can help me with a problem of my own. I can't seem to get this to compile:



Any suggestions? <hee, hee, heeee>
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stevens Miller wrote:Any suggestions?


Yeah. Get the Oxford University version of Java. It also has a java.awt.Colour class, like the original should have done

Unfortunately, as you can see, they haven't updated all the API links yet.

Winston
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Stevens Miller wrote:Any suggestions?


Yeah. Get the Oxford University version of Java.



Does it actually recognize synchronised as a keyword? Since we're all about internationalization these days, that makes sense, but I am really kind of surprised it's not a compile-time switch or option.

Now, in good ol' C, we'd have solved this problem thus:
Or something along those lines.
 
Campbell Ritchie
Marshal
Posts: 80769
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stevens Miller wrote: . . . Campbell has written an almost complete test suite for you

Not at all. It won’t work. Not even close. I wrote “lits” instead of “list”.

(though he has, understandably, written it in the expectation that your singly linked list is best treated as a stack, . . .

That is because all the diagrams in this thread looked like stacks.

I see you have been ranting. I was busy, changing bicycle chains, and going to a concert (Youth Chorale preforming Brahms’ German Requiem and Haydn’s Missa in Angustiis (“Nelson” Mass), so I couldn’t comment earlier. And now I am not sure I can comment, because whatever I say, either you or Winston will tell me I have spelt it wrongly!
I think I agree with you. I seem to see so many posts on this forum where I get the impression people are being examined in their ability to write bad code.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:II was busy, changing bicycle chains, and going to a concert (Youth Chorale preforming Brahms’ German Requiem and Haydn’s Missa in Angustiis (“Nelson” Mass), so I couldn’t comment earlier.


Nice. My step-mum has actually done the Nelson Mass in the Halbert 'All.

Winston
 
Campbell Ritchie
Marshal
Posts: 80769
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I enjoyed the Brahms, but was much more impressed with the Haydn. There was much more to it.
I have only ever managed to sing “Land of Hope and Glory” at the Albert Hall, but both my daughters have performed there.
Next thing we are performing is Stabat Mater by Dvořák on 23rd March. Anybody within range, come and listen.
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Stevens Miller wrote: . . . Campbell has written an almost complete test suite for you

Not at all. It won’t work. Not even close. I wrote “lits” instead of “list”.


Tsk, tsk. We are all about spelling here.

(though he has, understandably, written it in the expectation that your singly linked list is best treated as a stack, . . .

That is because all the diagrams in this thread looked like stacks.


Indeed, and that is part of what got me ranting. A singly linked list is one way to implement a stack, but the professor's instructions call for methods that are appropriate to a doubly linked list (and for a structural element--the dummy head--that is appropriate to a circularly linked list, if even then, which it isn't, but I digress...)

I see you have been ranting.


Well, you know me. I'm a ranter. I rant. It's what I do.

I am not sure I can comment, because whatever I say, either you or Winston will tell me I have spelt it wrongly!


No, no! You misunderstand us: we would each offer you a different proper spelling.

I seem to see so many posts on this forum where I get the impression people are being examined in their ability to write bad code.


So true. Winston kindly stoleadopted my distinction between "computer science" and "computer programming," in favor of science when one is learning to cope with structures. But, at some point, one must write code if one is going to program computers. My concern for a long time has been that, in the academy, programming is not taught by programmers, it is taught by scientists. This is rather like having mechanical engineering taught by physicists. Worse, it appears that Robert's work is going to be graded by a computer and- oh dear God! I just looked up what the "WebCAT" system he is being graded by is. Here are the criteria it applies, from the DIY Computer Science Web site:

WEB-CAT follows a certain sequence of steps to assess a project submission. A submission is assessed only if it compiles successfully. If compilation fails, then a summary of errors is displayed to the user. If the program is compiled successfully then WEB-CAT will assess the project on various parameters. It first tests the correctness of the program by running the student’s tests against the program. Since these tests are submitted by the students, and it is expected that 100% of the tests will pass, because we do not expect students to submit a program that fails their own tests. After this the student’s test cases are validated by running them against a reference implementation of the project created by the instructor. If a student's test case fails on the reference implementation then it is deemed to be invalid. Finally the coverage of the student’s test cases is evaluated. Once the scores are obtained a cumulative score out of 100 is calculated applying a certain formula on the scores from all criteria. The results are displayed immediately to the student on an HTML interface.



So let's see if we can even start to count all the things this approach to testing overlooks: self-explanatory variable and method names; consistent useful indentation; helpful comments; modularity; efficiency; good use- oh, it's not even worth it. Robert's not going to be graded on his program at all: he's going to be graded on its output.

That's just wrong.
 
Campbell Ritchie
Marshal
Posts: 80769
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like being examined on your ability to write bad code.
I am grateful for having gone through the degree route, where marks were given for code style, comments, lengths of methods, etc. As you say, you can write completely non‑object‑oriented code and get good marks because it passes the tests. I think it is unfair to say this is being set and marked by scientists, however. It is being marked by a machine. Somebody on this website used to have a sig saying anybody can write code for a computer to read, but only good people can write code for people to read (??Martin Fowler)
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stevens Miller wrote:So true. Winston kindly stoleadopted my distinction between "computer science" and "computer programming," in favor of science when one is learning to cope with structures. But, at some point, one must write code if one is going to program computers. My concern for a long time has been that, in the academy, programming is not taught by programmers, it is taught by scientists. This is rather like having mechanical engineering taught by physicists.


1. Haven't stolen adopted yet. It was merely a statement of intent.

2. I'm not quite sure I agree with you on your second point. While it's certainly true that programmers need to code, half our time here on the forums seems to be taken up with stopping (or at least delaying) beginners from coding; and the reason for that, IMO, is that it would seem there isn't enough theory (read "science") being taught before students are unleashed on fairly major projects.
In my case, I'm quite convinced that one of the most important reasons that I'm a reasonably good programmer is that I had a very good grounding in data analysis, so I can spot redundancy problems a long way off in a dark alley simply by "smell".

The one area that I would agree does need more programmers is when it comes to "thinking objectively"; particularly from bods like me (and, I suspect, several others here) who have gone through the long and painful process of conversion from 'procedural' to 'objective'. You can explain objects and object-orientation all you like to people, but until they
(a) actually run into situations where procedure isn't enough, and
(b) have someone who can explain why their solution is flawed
they are unlikely to get over the "objective hump".

My 2 cents.

BTW, if anyone feels that this is hijacking the thread, I'll be happy to split it off into a different one.

Winston
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the complaints [about the grading method] are superficial and filled with assumptions. WebCat is just the tool the professor uses to test functional completeness (the code compiles, runs, and does what it is supposed to). Nowhere is it mentioned that WebCat is the only grading standard. It is simply a tool to save the prof. from having to compile and run every submission. So before another rant about how bad some prof. is doing their job, perhaps take a step back and consider what your assumptions are.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:Nowhere is it mentioned that WebCat is the only grading standard. It is simply a tool to save the prof. from having to compile and run every submission.


I see your point, but I'd worry that knowledge of the particular product used could slant people to coding solutions that are likely to produce the best results from it, rather than actually thinking about the best solution to the problem.

Winston
 
Stevens Miller
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Stevens Miller wrote:So true. Winston kindly stoleadopted my distinction between "computer science" and "computer programming," in favor of science when one is learning to cope with structures.


1. Haven't stolen adopted yet. It was merely a statement of intent.


I am flattered, nonetheless. Putting on my lawyer's cap (alas, we don't have powdered wigs in this jurisdiciton), I will say you are licensed to use the concept and phrase as you see fit. While I would prefer to achieve immortality through not dying, achieving it through my words will probably have to do.

Steve Luke wrote:I think the complaints [about the grading method] are superficial and filled with assumptions. WebCat is just the tool the professor uses to test functional completeness (the code compiles, runs, and does what it is supposed to). Nowhere is it mentioned that WebCat is the only grading standard. It is simply a tool to save the prof. from having to compile and run every submission. So before another rant about how bad some prof. is doing their job, perhaps take a step back and consider what your assumptions are.


Anything is possible, Steve. My assumptions are that this prof is probably doing his job like most of them, and not grading his own students' work. Perhaps Robert will return and tell us more (if, indeed, he knows; I was almost done with four years of college before I found out that most of my papers were being graded by graduate students at the university down the street).
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Stevens: (finally) moved our dicsussion a new topic.

Winston
 
reply
    Bookmark Topic Watch Topic
  • New Topic