Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5
OOP problems 
Author Message
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 11:36 pm
Posts: 3527
Location: Portsmouth
Reply with quote
Thanks guys - I've zipped it up here.

I know it's not perfect - but I don't think it's a fail.

In other news - I got 70% for a feasibility report I wrote for another unit today. :D

_________________
Image


Fri Apr 30, 2010 3:07 pm
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 9:40 pm
Posts: 4876
Location: Newcastle
Reply with quote
Just a quick look through the piece file (having to use notepad)

Code:
boolean returnVal = pieceObject.confirmSquareInRange( targetX, targetY, currentX, currentY, false );
      
return returnVal;


Could easily just be
Code:
return = pieceObject.confirmSquareInRange( targetX, targetY, currentX, currentY, false );


As you are wasting cycles and memory.


ChessBoard
Code:
userInput = scanUserInput.next();
      
if ( userInput.equals("Y") )


Could be (I don't know if java has this but I know C# does)
Code:
userInput = scanUserInput.next().ToLower();
      
if ( userInput.equals("y") )

I'm not sure on that, as it looks like you only check uppercase, if it's not type sensitive there is something worrying there with Java as a whole

Code:
//first copy the target piece into it's new location
         
boardSquare[ moveLocations[1][0] ][ moveLocations[1][1] ] =
         
boardSquare[ moveLocations[0][0] ][ moveLocations[0][1] ];

You have this multiple times, could be replaced with a function where you just passed in the array.

That was just a quick look with notepad, will try and look again if I have time

_________________
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.


Fri Apr 30, 2010 6:11 pm
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 11:36 pm
Posts: 3527
Location: Portsmouth
Reply with quote
Cheers man, I'll include those improvements.

What do you think of it as a first attempt at Java? Can you see any glaring mistakes in how objects/classes have been used?

_________________
Image


Fri Apr 30, 2010 6:55 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Nick wrote:
Cheers man, I'll include those improvements.

What do you think of it as a first attempt at Java? Can you see any glaring mistakes in how objects/classes have been used?

I had a brief look at it structure-wise and I can't really see where you could fit more classes/inheritance in without losing the efficiency by having too many.

I'll have another better look tomorrow to see if I can extract/refactor anything or use some inheritance/etc... anywhere.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Fri Apr 30, 2010 8:04 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5

Who is online

Users browsing this forum: No registered users and 7 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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.