Wednesday, October 8, 2008

Polymorphism forgetfulness

Since I just got into a silly argument and lost because I retrained myself poorly I'm going to write it down several times so I can (hopefully) remember it:

Java uses the object instance to determine which overridden method to look at and the reference of a parameter to determine which overloaded method to call.

Example:

public class A {
public void test(A a) { System.out.println("A from A"); }
public void test(B b) { System.out.println("B from A"); }
}
public class B extends A {
public void test(A a) { System.out.println("A from B"); }
public void test(B b) { System.out.println("B from B"); }
}


So which class the test method is called from depends on whether you called new A() or new B(). Which method in that class is called depends on whether you assigned the object to a reference of A or B.

Monday, September 22, 2008

Changing default locale for Java in Windows

I was trying to test something for a different locale and make the mistake of assuming that what I did actually changed it for java without confirming it. I smartened up and actually tested it and lo and behold it didn't actually change it. The correct way is to go to Control Panel -> Regional and Language Options, then update the Standards and formats to the desired language and click Apply. If you run a Java program to check out the default locale it will show the new locale.

Friday, September 19, 2008

Mixing horizontal menu styles

In dealing with my horizontal menu issues and finding issues with item wrapping in Firefox when trying to use display:inline and then hitting up against the infamous z-index issue with IE (nicely explained over at mahzeh.org) when trying to use float I decided to experiment with using both. By default (since it is generally IE that is the culprit) I set things up to use float. Then I use some hacking tags to identify specific IE versions and set float:none which then makes use of the display:inline tag. This seems to work fairly nicely and avoided me having to change the structure of things too much or add a bunch of javascript to get z-index to behave.

Tuesday, September 16, 2008

Firefox issue with wrapping in horizontal menu

So I've been trying to make some modifications to a style sheet to get around some funny mapping that is happening when the items get too long. Unfortunately the CSS has gotten pretty complex and looks like it could stand for some refactoring, but I was able to distill out something that I didn't expect for behavior from firefox. Here's what is happening with the menu wrapping that just isn't right:



Then menu consists of an unordered list and list items that each contain a sublist. The quirk of this menu that I'm not used to seeing is the list items for the main menu are organized using display: inline and white-space: nowrap. As it turns out the offending line was in the html file.

<li class="mi-top">
Third Menu

Once I remove any white space from between the > and the "T" everything is fine. My understanding is that it should ignore any line feeds inside of the li tag. I'm going to switch this over to using floats instead of display: inline to see if that will take care of the issue as well.

9/17/2008 - Float followup: Floats took care of it without having to worry about the white space.

Tuesday, June 17, 2008

Measuring Teams

I had recently read The Wisdom of Teams which left me with the idea that I've never worked on a real team. In fact any of the jobs I've had have had an averse environment for them, even though some could have benefit from having real teams. Now I've found myself thinking in my current job how I'd define some goals that are clearly defined and something the rest of the potential team could get behind and I keep getting stuck. Even if good goals were eventually around how would we know we got there.

This lead me into measurements where I poked around for a good book on that and decided to read Measuring and Managing Performance in Organizations. Robert Austin develops an interesting model for behavior and a compelling case for concern when measuring the performance of employees. It seems that a critical base for helping teams form is likely in working hard to ensure informational measurement can be kept while avoiding motivational measurement. This ties back to the need for trust among team members that is mentioned in The Wisdom of Teams.

That was silly...remember measurements do not make teams, but if a team has measurements then they should strive to be informative instead of motivational.

Monday, February 11, 2008

"Controlled Versus Open" Source Control

I've started working on a project that is using ClearCase as it's source control tool and I'm still learning how to use it and what it does for us. My previous background has been mostly with CVS and dash of Subversion thrown in. My initial impression is that while CVS seems to focus on keeping it simple, ClearCase seems to be more concerned with making sure there are checks and balances.

As I was looking through the code and seeing things that, while they aren't causing any harm, probably should be fixed (like, unused imports, typos, etc...) I'm realizing that in CVS I would've just done it. By in my new world I'm going to need to submit a formal request explaining what I'm changing and why to get a approval so that someone can create a ticket that I can then check the code out against.

There are times where that checks and balance stuff is really nice - I imagine. Possibly when you're trying to change a piece of code that is central to the application. I wonder how much it squashes peoples desire to clean things up. There must be a happy middle ground, which is something I need to research and think about some more.