Wednesday, September 26, 2007

11 webspider part 2

I tried to work on the webspider project again but found that the only significant change I made was to the logging part. Instead of using System.out.println to output any logging, I used the java logger class to implement my logging. This was mildly difficult because I had no experience with this class or anything like it. At least when I had to use map I had a basic idea of what I wanted in a nut shell. With logging, I didn't even know where to begin. So like any other good program, I looked up example on the internet.
Even on the internet there weren't many useful links. I tried to look at the API but as complex as it is, I found myself unmotivated and bored. There were a few pages that described how to use the logging class but what I really wanted was an example of just how the code worked. There nothing like seeing the code in action to really grasp what it can do.
I tried to work on other parts of the code but I was just not motivated enough to think up a better, more robust code. It may be because I feel that I am "done" with this assignment or just the lack of sleep over the past week catching up with me, but it seems like I'm satisfied with this code and can't bring myself to really dive into it and make it more efficient.

here's the link to the new version...

http://www2.hawaii.edu/%7Eeykim/webspider-eykim-1.0.925.zip

Monday, September 24, 2007

11.webspider

This was probably the longest assignment I've done in a while. It was very complicated and I still can't believe that I actually finished it. I'll admit that I had to look to a lot of other people for inspiration but I finally got it done. It's also not the prettiest piece of code that I've written but that's my fault. I procrastinated till the end and suffered for it. I eventually got all three tasks done.

What I've learned from this homework assignment is that simultaneously learning a new language, xml, while trying to brush up on an old language, java, leads to some very frustrating problems. The problem that comes to mind was that one line in the build file that we needed to change so that the java library files were included externally. It took me a long time to read through the code and understand what it all meant. Even then, I still had no idea what I needed to do. It was through the help of a friend that finally solved the problem.

I'm not proud of it but I also depended heavily on the work of those that finished before me to get me through this homework. Although I did finish task 1 mostly on my own, I still needed to look into Randy Cox's code to figure out how to translate the weblinks into string format. Afterward, I had to rely on Jared Sunouchi's idea of using a map to find the most popular page. I had a similar idea but to implement it would mean rewriting my code from scratch at 3 in the morning. Thanks to Jared's map idea, I could easily convert what I was using in my code to a map and traverse it to see which links came up the most.

All in all, I wished that I started earlier but I know that without any help, I don't think I would have finished this assignment. I feel dirty using other people's code to get me through my assignment, but I have to give them due credit because their ideas were brilliant.

http://www2.hawaii.edu/~eykim/webspider-eykim-1.0.924.zip

Monday, September 17, 2007

10.Stack

Here is my file for stack...
http://www2.hawaii.edu/~eykim/stack-eykim-5.0.916.zip

This was actually one of the first project that I got an early start on. I'm also glad that I worked with a bunch of friends. Without their help, I believe I would have been up all night, pondering subtle details about eclipse errors that really had nothing to do with the homework at all. But due to their help, I was able to complete all five tasks.
Although most of the problems that I ran into dealt with very obscure details such as, "I can't get ant to work on the command line" and "Where are the layouts for the JavaNCSS report page?” it would have taken me hours on my own to find the answers to these problems. Evenly dividing the work between all of us, helped to alleviate the stress and lighten up the atmosphere. I believe the biggest problem that we ran into was trying to figure out how to write the ant task for JavaNCSS. It really was like learning a new language in just one day. I had to continuously research online and read over the code to get a firm grip on just what each tag did. I've never used xml before this but I feel that after looking at and developing code for the JavaNCSS, I have a decent grasp on xml. The other problems I ran into were just a result of not reading the manuals enough or just doing a simple bit of research on the topic.
As for Ant, I believe that it is a great program. It seems like a hassle for a non-trivial program but I can easily imagine how it could literally "save my ass" if I had a monster of a program with hundreds of classes and methods. Aside from making sure that all of my code was recently compiled, the tests that I could easily run and the information from programs like "emma" really help me to become a better programmer overall. Before this assignment there was a number of methods that I didn't even know existed.
There really aren't too many standards that I don't understand the motivation for. The "tabs" rule is a great rule because I've run into multiple problems when transferring code over from one computer to the next or from one platform to another. As for naming conventions, number of tab spaces and the like, it really depends on your style but having one common convention really makes it easy for everyone to be on a level playing ground. Also using an IDE like eclipse where you can add formatting standards makes converting to the standard very easy.
As for SCLC and JavaNCSS, SCLC is nice because it tells you just how many lines may differ from each version of code but I think that using JavaNCSS is more efficient because you can use it to figure out just when you should refactor. Using the code metrics in JavaNCSS, I can easily see when I don't have enough comments for a certain method or if a method is getting too unruly. As opposed to SCLC where I get hard facts about just how big my source code is in general. I really do prefer JavaNCSS. Now, if only I could use it efficiently.

Wednesday, September 5, 2007

Code Ruler Redux

LINK TO CODE:
http://www2.hawaii.edu/~eykim/eykimv2.zip


MEMBERS: Like before, I did this homework on my own but I'm seriously considering doing the other project with a partner from now on.


RESULTS:
I decided that I needed to work on improving the code that deals with the peasants. I decided that just moving them randomly was not enough. I noticed that most of the sample ruler tried to go after the peasants at first so I decided to give them a chase. I wrote code that would check the area around each peasant for any opponent and moved in the opposite direction of the opponent.
It took me a long time to actually develop code that wouldn't give off errors and the resulting code was actually pretty ugly. But I got it cleaned up and it got the job done. I noticed that when I faced off against gang up ruler, I stood a much better chance of survival due to the fact that gang up ruler would send all his knights after my peasants. My peasants on the other hand avoided the knights pretty well giving my castle plenty of time to create more knights to ultimately defeat gang up ruler's knights.
Split up ruler was a completely different story. It seemed like I faired worse than before when it came to split up ruler. Split up ruler completely destroyed my peasants before they even had a chance to run. Afterward they would attack all my knights and I usually ended up with either no minions or sending countless knights to their doom. This was one error that I wish I had more time to fix. I noticed that if I was left with just a few knights and a castle, all my knights would just attack the castle a few at a time. Split up ruler would kill these few knights and gain incredibly high points off of it.

SCORES:

               `My score      enemy

split 122 446

split 137 416

split 168 407



migrate 596 11

migrate 577 16

migrate 559 9



gang up 376 224

gang up 382 282

gang up 294 373


LESSON LEARNED:
I've learned that to truly develop code is an on going process and that no code is really ever done. There will always be some kind of improvement that could be made. Everything from studying the problem from all angles to collaborating with my fellow students can greatly improve the quality of code that I write. I should have made better use of these resources.
I also realized that as I delved deeper and deeper into my strategy, the more complicated the code became and the more frustrated I've become. After looking at other people's code, I noticed that complicated strategies with endless condition usually faired the best. I tried to emulate this strategy but eventually ran out of time. I honestly thought that my modifications to the peasant's code would be enough. But it was not and left me with a hard learned lesson.