La clase de Java

Yesterday the “Advanced Java” class just started actually coding. I thought the class would be interesting, as there are people with so much experience in the room. People with a masters degree in something or other who used computers extensively back in the punchcard days, etc. There’s a guy who had worked at IBM for ten years. I couldn’t believe it! Why are they taking a Java class at Front Range?

But after they actually started programming, it became painfully obvious that I was the best programmer in the room. Not obvious to them (yet :-), just to myself. We’re designing this GUI database interface with labels that change based on the locale. And the teacher’s solution kept a JLabel variable for each label! When he wanted to change the locale of each label, the code looked like:

    updateLocale(languageLabel, locale);
    updateLocale(savingsLabel, locale);
    updateLocale(contribLabel, locale);
    updateLocale(incomeLabel, locale);
    updateLocale(currentAgeLabel, locale);
    updateLocale(retireAgeLabel, locale);
    updateLocale(deathAgeLabel, locale);

Ugh (And I hate camelCase, but alas, ’tis the Java way). And he had this sort of thing in three places in the program. What a nightmare to maintain! And he didn’t even align them!

Thankfully, we don’t have to use his code. Most everyone did it the way he did. I put them in a list and looped through them when I needed to. The teacher “blames” that on my Perl origin.

This should be a fun class, though, because there are few programming projects that are monotonous unless a specific coding technique is enforced, which it isn’t (well, as much as Java doesn’t). It’s always interesting to come up with a design that significantly reduces my workload.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s