This topic is locked, you cannot edit posts or make further replies.  [ 36 posts ]  Go to page Previous  1, 2, 3  Next
Back to Java 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Jun 18, 2009 5:10 pm
Posts: 5836
I would guess that you didn't do a thorough top-level design

Before writing a single line of code, one should always sit down with a piece of paper and write down in plain english what you want the program to do. It's called a specification and it is impossible to finish a program without one.

Start with simply breaking it down into blocks such as "Start", "Throw Dart", "Store Dart Value", "Adjust Score", "Check for winner", "Finish"

Add comments to each block

Then take each block and break it down into simpler steps and then break those into even simpler steps until you have a cogent procedure.

If necessary or useful:

  1. add comments to steps that might be a bit opaque.
  2. Use diagrams
  3. assign values to variables and work through manually

One idea should govern your work:

Any programmer should be able to pick up your design and make a successful program. Only once you have a design that you think someone else could code every step of should you even consider going to code.

When you do go to code, the steps from your design will be easily tuned to become comments in your program.

_________________
Jim

Image


Mon Jan 18, 2010 11:23 pm
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
To be honest I think all the comments in this have given you all the answers you need to be able to do the work effectively. Rusty, Oli and myself have offered lots of help. If you have such a problem figuring out what your code does you have either done it wrong, written it poorly so can't read it back yourself or you don't understand why you do what you have done.

Have you stepped through your code to understand what it does?

This isn't a homework help section, we aren't here to do your work, and some of us already have to be honest

_________________
Twitter
Charlie Brooker:
Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.


Tue Jan 19, 2010 12:15 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 5288
Location: ln -s /London ~
Gaaargh - I could have sworn I made another post last night. Essentially it was along the lines of:

To extend Rusty's post a little - for procedural languages you want to be splitting the problem into tasks and sub-tasks, as described. For OO languages you want to look at how the problem can be split into components, and what actions these components perform (and what makes up the components in terms of sub-components and state).

Also, Finlay ++;

If you have specific programming questions you could ask here, but you may get a better response on stackoverflow.com (Again, only if your question is specific)

_________________
timark_uk wrote:
Gay sex is better than no sex

timark_uk wrote:
Edward Armitage is Awesome. Yes, that's right. Awesome with a A.


Tue Jan 19, 2010 10:59 am
Profile
Occasionally has a life
User avatar

Joined: Mon May 04, 2009 10:16 am
Posts: 130
Location: In between a rock and a hard place
I would like to thank everyone for all of there help, I managed to sort it by going through the code step by step like Rusty suggested and found the problem.

Thanks guys you have been great as always.

Note for Finley:

Mate, thanks for your input but not once did I ask anyone to do my work for me! I cant help it if people want to try and give me the answer, I was merley trying to get pointers on what I may be doing wrong, and thanks to everyone I WILL have better coding standards the next time I write a programme, but I dont appreciate you suggesting I want people to do the work for me or im cheating! I never once asked for someone to just fix the programme and hand it back, so please dont make this something its not.

I know this isnt a homework help forum but I have every right to post a question on it and if it pisses you off so much to answer it then why do it? I appreciate your help but if it makes you so angry to answer someones post I dont see why you put yourself through the hassle of typing out suggestions. I would however like to thank you for the help you provided as it was useful and I am greatful but if I write a post and you really dont want to answer it and you feel that its a huge hassle its fine.

Cheers

Kal

_________________
[color=#BF0000][b]Arctic Cooling Freezer 7 Pro
620W Corsair HX Series Modular SLi PSU
Intel Core 2 Quad-Core Q6600 G0 SLACR, 95W, S775, 2.40 GHz
asus maximus formula, iX38, S 775
ASUS GEFORCE EN8800 GT 512MB GDDR3


Sat Jan 23, 2010 12:49 pm
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
kalisclark wrote:
Note for Finlay:

Learn to spell my name correctly, it shows a lack of respect not even checking you have spelled it correctly.

kalisclark wrote:
Mate, thanks for your input but not once did I ask anyone to do my work for me! I cant help it if people want to try and give me the answer, I was merley trying to get pointers on what I may be doing wrong, and thanks to everyone I WILL have better coding standards the next time I write a programme, but I dont appreciate you suggesting I want people to do the work for me or im cheating! I never once asked for someone to just fix the programme and hand it back, so please dont make this something its not.

First off, I am not your mate, you don't know me.

You have asked for the answers, you asked why your code wasn't working, among other things, you asked:

Quote:
The first is I need to make a record of all throws and be able to see them when the game is done.

Second I need to make the game a 2 player but I have no clue how to do that.

Also if anyone has the time could you possibly have a look at the code and tell me why on the 4th and 10th dart throw it starts adding to the score instead of taking away lol, just spotted it today and I have no idea why its doing it.


1 and 2 you should have done the research yourself. They aren't difficult answers.

This is clearly without going through your own code to try and understand it does what it does. Have you stepped through your code? You have over this and the previous topic you created pretty much tried to get it all done for you. You don't understand WHY your code does what it does, as you didn't really write it, or understand what you used where you did.

kalisclark wrote:
I know this isnt a homework help forum but I have every right to post a question on it and if it pisses you off so much to answer it then why do it? I appreciate your help but if it makes you so angry to answer someones post I dont see why you put yourself through the hassle of typing out suggestions.

You don't have every right. It's against your university regulations to allow ghosting on your work. This is where someone else does the work for you. It's like collusion except you don't share the work. If you have a true question such as "How can I do X in Y" then fine. But you aren't asking for that, you are asking for much more.

How would you feel if someone on your course found out about this and sent it to the lecturer or university? You would be kicked out for ghosting, as your source code is here, and quoted by others, so even editing your post doesn't remove it from the thread. You have enough problems as a programmer writing the game to start with let alone rewriting the code to show that you didn't cheat on your assignment.

You also lied to us.

viewtopic.php?p=77880#p77880
You say it's an assignment. This means it is individual work (or group work for those submitting)

viewtopic.php?p=87479#p87479
You call it a project, meaning it's not something submitted as part of assessed work, helping is possible on that.

I am all for helping another programmer who needs help. But when you clearly have no concept of programming or ability, failed to listen to advice and more than that clearly haven't done any work yourself to try and solve the problem. There is no point helping someone on the belief they want to help themselves only for them to want someone else to do the work for them.

_________________
Twitter
Charlie Brooker:
Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.


Sat Jan 23, 2010 8:17 pm
Profile
Occasionally has a life
User avatar

Joined: Mon May 04, 2009 10:16 am
Posts: 130
Location: In between a rock and a hard place
First off, there was no disrespect on my part from that last post, you took it the wrong way. On your part there was. ok fair enough your not my mate, I tried to be friendly, you don't want to be, thats your choice but don't threaten me, there was no call for that. I never insulted you.

_________________
[color=#BF0000][b]Arctic Cooling Freezer 7 Pro
620W Corsair HX Series Modular SLi PSU
Intel Core 2 Quad-Core Q6600 G0 SLACR, 95W, S775, 2.40 GHz
asus maximus formula, iX38, S 775
ASUS GEFORCE EN8800 GT 512MB GDDR3


Sun Jan 24, 2010 2:36 am
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5161
Location: /dev/tty0
Learn to use a debugger (Eclipse has a built in one, as does VS and I would presume Netbeans does too).
If you understand your code, but things are still playing up, using a debugger with breakpoints is very very helpful, you can see what values variables have at different points in the code, it can take a while, and you will have to know your code, but it really does help.

Programming of any sort is difficult until it clicks. You'll get there :)


Sun Jan 24, 2010 2:49 am
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
kalisclark wrote:
First off, there was no disrespect on my part from that last post, you took it the wrong way. On your part there was. ok fair enough your not my mate, I tried to be friendly, you don't want to be, thats your choice but don't threaten me, there was no call for that. I never insulted you.


Where did I threaten you?

If you feel threatened me asking about a worse case scenario about what you have done I think you have much deeper concerns about yourself than your programming abilities. Secondly, there was disrespect, my name is in my damned username, if you can't care enough to check a spelling of someone you are addressing it shoes you don't have respect for that person. It shows you are sloppy and don't care about details, especially where others are concerned.

If you are insulted that I called you a bad programmer. Tough, you are. I will openly say I know I'm not a great programmer, I simply don't have the experience of the languages I use to be great, but I do know enough to solve a problem, and the experience to know where and how to apply my knowledge to solve said problem, most importantly the ability to learn new skills and approaches when needed. That is something the other programmers on here do have, to differing degrees.

They also have humility, if someone doesn't know something about a specific area (believe me, there are areas we all know little or nothing about) they will ask a question, they will however show the respect for others (I presume in the way they wish to be treated as I know it's how I like to be treated) by being exact, giving a short example of the code they are using or just a function and doing some work on trying to solve it themselves. Maybe if it is warranted in some cases to post longer excerts of code but in your case it most certainly isn't. If I posted one of my short programs I have written, you would be looking at at least a thousand lines of code. I would however have the respect for myself and others to attempt to make it as readable as possible instead of copying and pasting direct from the IDE into the message body, including the use of comments and [ code ] blocks.

As said before by others as well as myself, learn to debug your own code. Step through it line by line if you have to. If you don't understand what it is doing, your code needs to be rewritten, if you don't understand why it something random is happening, it's your job to find out by debugging.

As an example if you need help next time, keep it short and specific to one area, like
viewtopic.php?f=3&t=5672

_________________
Twitter
Charlie Brooker:
Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.


Sun Jan 24, 2010 2:52 am
Profile
Occasionally has a life
User avatar

Joined: Mon May 04, 2009 10:16 am
Posts: 130
Location: In between a rock and a hard place
I know I am a bad programmer, probably because I have just started. I have never dealt with any kind of code in my puff. The leacturer is very Vague in everything he says and is always too busy to help, And the book we got given to read was the worst pile of crap I have ever read, the author is terrible at explaining Java.

I never lied, I may have explained it differently but never lied, it was an assignment in groups of 2.

_________________
[color=#BF0000][b]Arctic Cooling Freezer 7 Pro
620W Corsair HX Series Modular SLi PSU
Intel Core 2 Quad-Core Q6600 G0 SLACR, 95W, S775, 2.40 GHz
asus maximus formula, iX38, S 775
ASUS GEFORCE EN8800 GT 512MB GDDR3


Sun Jan 24, 2010 3:04 am
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
kalisclark wrote:
I know I am a bad programmer, probably because I have just started. I have never dealt with any kind of code in my puff. The leacturer is very Vague in everything he says and is always too busy to help, And the book we got given to read was the worst pile of crap I have ever read, the author is terrible at explaining Java.

I never lied, I may have explained it differently but never lied, it was an assignment in groups of 2.


You're a bad programmer because you have just started, you don't know how to learn effectively and you are relying/blaming others for things you should be doing yourself. If your lecturer teaches you something and you don't understand it's your responsibility to ask questions or ask for guidance.

Have you asked the other person you are working with to explain it to? Have you asked the lecturer for any other reccomended reading or sites to look at? I can't believe you have ONLY one set text, I had one suggested and about a half dozen alternatives for my first module, and was told to go have a read of each and pick the one that I found easiest to understand. There was a set text for programming problems but that was the only required text.

You should be able to effectively use self directed learning, that means to look for information yourself and learn it.
http://www.google.co.uk/search?q=java+t ... =&aq=f&oq=

Well would you look at that... I wonder what that is, oh look, the first 3 are all respected sites with comprehensive Java tutorials and explanations. Not only that but the 3rd one is in fact a compilation of other educational facilities and other sites with Java tutorials. FFS you are doing one of the most common languages there is at a relatively simple level. If you were writing a recursive compiler in COBOL then I would understand not being able to find much on the area. Pull your thumb out and take some responsibility for your own education.

A project and an assignment imply two very different things. My mobile applications and one of the Indie games I am making, they are projects, stuff I do in my spare time. My other Indie game (a demo in reality due to time constraints.... and possibly shorter due to mitigating circumstances) and my dissertation software... they are assignments.

Articulate in a better manner next time, you don't want to get into a situation of saying:
I helped my uncle jack off a horse
when you mean
I helped my uncle, Jack, off a horse

_________________
Twitter
Charlie Brooker:
Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.


Sun Jan 24, 2010 3:28 am
Profile
Occasionally has a life
User avatar

Joined: Mon May 04, 2009 10:16 am
Posts: 130
Location: In between a rock and a hard place
It's strange, you want Respect from me! when you are incapable of giving it. You also stated earlier that I don't know you...true, but you also don't know me.

_________________
[color=#BF0000][b]Arctic Cooling Freezer 7 Pro
620W Corsair HX Series Modular SLi PSU
Intel Core 2 Quad-Core Q6600 G0 SLACR, 95W, S775, 2.40 GHz
asus maximus formula, iX38, S 775
ASUS GEFORCE EN8800 GT 512MB GDDR3


Sun Jan 24, 2010 3:37 am
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
kalisclark wrote:
It's strange, you want Respect from me! when you are incapable of giving it. You also stated earlier that I don't know you...true, but you also don't know me.


You don't understand the difference between being honest and being disrespectful. If I wanted to be disrespectful I wouldn't have helped you, made a mockery of your inability to write coherent code and been generally unhelpful.

It might hurt what I have said, but it is the truth.

You are correct, I don't know you. I can however use my powers of observation to deduce that:
You have been working on this from some time now, you don't understand the problem and are hesitant to resolve this, you are new to programming and OO languages in general, you don't take the comments of others particularly well, you don't seem to like taking responsibility for your own learning and understanding of an area and seem lazy when it comes to solving your problems.

Feel free to correct me if I am wrong on any of those as long as you can actually prove it and aren't just taking a defensive stand from being called out on truth and feel demeaned by it.

_________________
Twitter
Charlie Brooker:
Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.


Sun Jan 24, 2010 3:49 am
Profile
Occasionally has a life
User avatar

Joined: Mon May 04, 2009 10:16 am
Posts: 130
Location: In between a rock and a hard place
No I havn't been working on this that long, because I have had other things that needed done first. Yes your right I am new to OO languages, no your not right, I do take costructive critisims but your just taking the piss. I do take responsiblity for my own learning and understanding, I have been asking for help but under no circumstances did I want anyone to do the work for me. A lot of the answers given didnt help me, so I figured it out myself. I did take the tip on going through everything from the bottom up and I fixed my programme, so maybe your powers of observation are just crap. no need to respond I know exactly what your going to say, its all getting a bit repetitive now.

Bye

_________________
[color=#BF0000][b]Arctic Cooling Freezer 7 Pro
620W Corsair HX Series Modular SLi PSU
Intel Core 2 Quad-Core Q6600 G0 SLACR, 95W, S775, 2.40 GHz
asus maximus formula, iX38, S 775
ASUS GEFORCE EN8800 GT 512MB GDDR3


Sun Jan 24, 2010 4:06 am
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
kalisclark wrote:
No I havn't been working on this that long, because I have had other things that needed done first.

Procrastinated, you have been on it over a month, seeing as you posted the other thread mid December.

kalisclark wrote:
no your not right

I believe the phrase you are looking for is:
No, you're wrong
anyway...
kalisclark wrote:
I do take costructive critisims but your just taking the piss

Please enlighten me, I didn't see any improvement after the first set of help given in
viewtopic.php?p=74513#p74513

Most people agreed with my comments, and you blindly coded in stuff you had no idea what you were doing. You still haven't coded any of the switch statements correctly, you might as well use a block of if/else if's in there. You also have no comments on your code that YOU wrote. Self commenting code helps you to understand what you have done and for others to read your code.

kalisclark wrote:
I do take responsiblity for my own learning and understanding, I have been asking for help but under no circumstances did I want anyone to do the work for me. A lot of the answers given didnt help me, so I figured it out myself.

Then why did you start this before/at the start of December and you still don't understand the problem you were initially given, or the basic statements that your code does. You were given answers that pretty much spelled it out for you if you just stopped and read it a few times.
viewtopic.php?p=88018#p88018

And why is it your game doesn't actually follow the rules for darts? your game ends wrongly since you showed the code. Did you even look at the rules for darts? Why don't you have a Bullseye on your board? You're missing parts of a dartboard you can score on, and assume every dart thrown hits the board.

kalisclark wrote:
I did take the tip on going through everything from the bottom up and I fixed my programme, so maybe your powers of observation are just crap.

They why do you still not understand why your code does what it does? If you can't identify the lines where your game goes wrong yourself you don't understand your code and your software is still broken. My powers of observation still look a lot better than your code does.
kalisclark wrote:
no need to respond I know exactly what your going to say, its all getting a bit repetitive now.


Wibble, banana, monkey dribble, disabled onions

_________________
Twitter
Charlie Brooker:
Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.


Sun Jan 24, 2010 12:09 pm
Profile
Occasionally has a life
User avatar

Joined: Mon May 04, 2009 10:16 am
Posts: 130
Location: In between a rock and a hard place
Then why did you start this before/at the start of December and you still don't understand the problem you were initially given, or the basic statements that your code does. You were given answers that pretty much spelled it out for you if you just stopped and read it a few times.

I started before December, but then I had other things to do so I wasnt able to get back to it until lately. I do know the rules of darts but hadn't put them into the programme on the one posted in this forum which is not the finished version. The finished version works as a game of darts should.

Jeeze you would think you had something better to do than pick out my grammer mistakes.

_________________
[color=#BF0000][b]Arctic Cooling Freezer 7 Pro
620W Corsair HX Series Modular SLi PSU
Intel Core 2 Quad-Core Q6600 G0 SLACR, 95W, S775, 2.40 GHz
asus maximus formula, iX38, S 775
ASUS GEFORCE EN8800 GT 512MB GDDR3


Sun Jan 24, 2010 12:54 pm
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 36 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.