An answer to a student asking 'Help'
Archive - Originally posted on "The Horse's Mouth" - 2007-11-27 07:08:30 - Graham EllisI've got time - a lot of time - to help people who are learning; it's really rewarding to teach the subjects that we do, and the most rewarding students are those who take the time to go above and beyond the norm in asking questions. So why, when I get an email out of the blue asking for help with a learning project, am I often very reluctant to muck in directly? Here's why - in the form of an answer sent out in the last few minutes ....
I'm always very reluctant to give students advise on their assignments as I don't know what you have been taught so far and what the intent of the assignment was. It would be too easy for my to start using elements of Java that you haven't been taught about yet, and to spoil the way you're learning - that would be very unhelpful in the longer run. If you're having trouble with the assignment, then your teacher or his assistant or your school/college help desk really should be the ones who know how best to help you (and good on you for asking for help).
In particular, I look at your use of switch in the first enclosure and see that you have it go 52 ways - once for each card in the deck. There's a programming paradigm that says "if you find yourself repeating something, there MUST be an easier way of doing it" and indeed that is the case - your code is 10 times longer than it should be BUT ONLY IF you have already been taught things like the loops and arrays you would need to make it shorter .... (and in a real practical solution it should be shorter to cut down on the maintainance issues of a live system)
I would, though, agree that if you feel your teacher doesn't know enough about the subject to be comfortable as he/she teaches it and has no support, you're in a bit of a problem area. Have a look at
http://www.wellho.net/resources/ex.php4?item=j707/ransbury.java
and the other examples in that area of the site as a starter. and that may help you.
Finally, and slightly reluctantly, I have to decline to offer free ongoing support via email to students who ask me for help - especially where I'm given a time limit. It feels a bit like having a gun held to my head. I just don't have the time, the answers to be good are all "one off", and so it's inefficient for me in terms of writing for a bulk of readers, and I'm often off line for a period and couldn't be relied on anyway. I suggest that you follow up your Java through the examples on our site that I have pointed you towards, through the resources that should be provided for your course, and (if you need) through forums such as ours at http://www.wellho.net/cgi-bin/opentalk/YaBB.pl
And all the best in your studies of Java!
Graham