Tuesday, October 28, 2014

Changes 10/28/14

Java:

  • Did the first Stringlist activity, where you are essentially creating a string-like class that follows the ADT list interface.  
  • I was unhappy because it forced me to use string concatenation where a StringBuilder would have been much more efficient.  
  • The underlying store of character data in the eimacs implementation was a String. Replacing this String with a StringBuilder make much more sense, as the object's implementation of List interface methods like #add() and #set() suggests that the underlying data will be modified quite a bit.
  • I also had some trouble during that activity because I couldn't figure out how to get the length of a string.
  • This caused me to realize that Java's naming conventions are really counter intuitive, and place too much emphasis on implementation details. 
    • To get the length of an array, you call Array[].length;
    • To get the length of a String, you call String#length();
    • To get the length of a List, you call List#size();
  • The reason I took 10 minutes trying to figure out how to get the length of a string was because I falsely remembered that you didn't need brackets after it.  A programmer really shouldn't need to care that the length of an array is a static field while the length of a String is a method, but Java forces you to know that because you must put brackets after #length when calling it on String.
  • Then, they take this and just throw it all out when implementing ADT list, making it #size() instead.  I was also falsely under the impression that the naming convention was .length when the length is a static field and #size() when the length must be found using a method, but this is not the case.
  • If I was using Eclipse or IntelliJ, I would have figured this out right away, but the eimacs web interface doesn't have tab completion. 

Life Skills:

  • Learned how to order pizza online, which I had never done before.  People were kinda mean about it though, and acted like I was stupid for not knowing exactly how to do my first time.
  • Learned that the Dominos website shows you coupons, which I guess is to make you feel like you are spending less on pizza.  One coupon cut our order from $30 to $20, and that $20 seems like much less when compared to the $30 than it might if that was the original order price.
  • I'm assuming that's what their going for, because it's kinda stupid that you can get the exact same order for a drastically different price depending on whether you click on the site a couple of extra times or not

1 comment:

  1. One option is for you to do your development using Eclipse (please use Eclipse, since that is the environment with which you need to become familiar for the programming contest), and only when you have it working copy and paste it into eIMACS. There will probably be things about any language you don't like (there are even things I don't like about Python, just not many ;-) The tool is what it is. You should strive to work with it, not against it. You should check out a good book like Bruce Eckel's "Thinking in Java" if you want to work to understand the language well. I have a copy if you want to look at it.

    ReplyDelete