Sunday, October 18, 2009

Midterm Review

The midterm is coming up and to help us study we are creating ten quiz questions that will help us review the material when creating the questions and allow others to review material while scouring for answers. These questions are similar to ones found in class and will test our overall knowledge of the material discussed in class minus anything related to RoboCode.

10 Questions are posted, return on Tuesday for the Answers!

Edited with Answers on the Bottom

Questions

1. Please code the FizzBuzz program discussed at the beginning of the semester. Count from 1-100, replace multiples of 3 with fizz, multiples of 5 with buzz, and multiples of 3 and 5 with FizzBuzz.

2. Why is the above useful knowledge?

3. Why is it useful to ask smart questions? What is an example of a Smart question and answer.

4. Why is it important to know how to override equals() and hashCode()?

5. When overriding equals() and hashCode, what are important things to keep in mind?

6. Why is it important to follow coding standards?

7. How effective is multitasking? Can you list some strategies to be more effective at working?

8. What is ant and how is it a useful tool to us?

9. What are the differences between white box testing and black box testing? Can you give an example where they are used?

10. What is Subversion and Git? What are the differences between them? List an Advantage and Disadvantage of both.

Answers

1. Please refer to your first blog post for the answer.

2. The FizzBuzz program is useful to know because it is a common example of a general coding question that would be asked on an interview.

3. It is useful to ask smart questions because it allows anything who may help you information on the problem and allows them to reply more quickly.

4. It is important to know how to override the two methods because it allows you to change the restrictive method to allow better comparability with objects such as object classes that you define.

5. When override these methods, you must remember to override both of them and that when overriding the equals method it has the following characteristics, Symmetry, Reflexivity, Transitivity, and Consistency.

6. It is important to follow coding standards because it allows uniformity between code and easier accessibility by other users reading and trying to understand your code.

7. Multitasking is not effective, it only feels like we are being more efficient, but it spreads user focus across multiple things and lowers the quality of work. Remove your self from distractions such as cell phones or the TV.

8. Ant is a java build tool that allows us to automate a building process of files in a distribution. It is similar to the make tool, but uses java.

9. White box testing is a more internal approach to testing in which the tests are designed based on the actual code, while black box testing is an external outlook at the testing in which we test to see if the code works correctly.

10. Subversion and Git are version control software. A big difference between the two is that Subversion is centralized and Git is distributed. One advantage of subversion is that when there is a change all the versions will be updated to the most recent, but since it is centralized, everyone will experience problems if the centralized version is compromised. With Git you clone the repository and run and change the files from a local copy off your computer, this means that there is no extra history coming from any other contributor and may lead to having multiple copies a file for different versions.



Wednesday, October 14, 2009

Did I just Google Groups Subversion?

This week we are taking our projects online and hosting them through google. We also learned about configuration management through subversion.

Google allows us to host projects through googlecode which allows us to give access of our code or project to other members and then collaborate by sharing ideas and code. One of the ways we can cooperate on a single project is through the use of subversion. This program allows us to download files from our google repository and then after making changes, committed them for everyone else to download and view.

You can view my google project page here.

One of the most difficult things through this process was figuring out how to use the SVN client, SmartSVN, properly and direct it to my repository. Once I got the steps down, it was a simple task and took less than a minute to connect to a classmates repository to download their files. The other majority of the time was spent configuring the google group site to add members and have email notifications. Again this is a problem when you first start using these things.

One of the things I really took from this was the configuration management and using SVN. The ability to collaborate on a larger project without having to constantly contact and talk to other contributors is going to become a great asset to me in the near future. I'm planning on working with a few friends on an upcoming project. One of the things I really like about using our repository was the fact that it allowed for the tracking of changes. It will be a lot easier to quickly read through and understand new changes made by other contributors when it is highlighted for you.

Wednesday, October 7, 2009

Junit Testing My Patience

After learning about build systems we were given the task to create jUnit tests for our robots.

You can find my distribution for my robot with test cases here.

It is one thing to design your robot, but it is a whole other thing to figure out tests for your robot. Trying to think of a way I could test a robot that doesn't have any predefined move path was torture. The fact that my robot's movement is based on the positioning of the enemy robot made it very difficult for me to test the proper movement.

The easiest test for my to do was, other than acceptance tests, were the firing tests. My robot fires very conservatively so it was easy to check, if they move don't fire, if they sit still fire!

The biggest problem was the unit test and the movement behavioral test. The unit test was very difficult because my robot in itself is very simple. Moving constantly in a predefined angled but relative to the enemy, the only thing I could think of was having the only formula I could have in it, which was one we had done earlier in our run through robocode, the Fire03 robot we built who's firepower was determined by the distance from the enemy.

Since this is in fact the first time we are doing tests I don't feel as confident in my test cases than I should be. After all my robot didn't do so well in the competition because I was unable to compensate or catch certain interactions with different movement patterns. All of which could have been better if there was proper testing.

I wasn't able to figure out how to run emma, although understand what it does essentially. I think my robot has a long way to go still. After some though I believe that one of the ways it could be modified for both testing sake and actual performance is to have a more clearly defined movement pattern. Right now I feel that is just too basic and very hard to test for, well how hard is it to test for a robot that moves forward? But then how hard is it to test for a robot that moves randomly without using the math.random() function. I kind of feel like that at this point, stuck between something really basic and something overly complex.

I think simplicity is the key to more sleep.