This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Java in General and the fly likes Improving code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Improving code" Watch "Improving code" New topic
Author

Improving code

Tom Joiner
Ranch Hand

Joined: Sep 19, 2006
Posts: 47
Here is some code I am writing I am looking to improve. What it does is attempt to solve a puzzle of blocks, by orienting them in every possible permutation to see if they fit in.

Note that I am using enums for orientation, but not for the block position. Why? Because I am using the block position as an index into arraylists, and also walk through the positions in an incrementing manner (like an int). Is this a correct strategy, or should I use enums after all?

This particular routine counts the number of valid permutations which the blocks fit together correctly.

Am I cloning things properly? (I am trying to just do a shallow copy)

Thanks for any ideas on how to improve it.



SCJP
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Improving code
 
jQuery in Action, 3rd edition