Posted by: phil swenson | March 28, 2008

Java coding practices that bug me

  1. Use of checked exceptions.  IMO checked exceptions are a failed experiment.  This is a blog post in itself, but I think Bruce Eckel makes a good argument here: http://www.mindview.net/Etc/Discussions/CheckedExceptions
  2. Interfaces with one implementer.  Why create an interface if you only have one implementer?  I was just working on some 6 year old code where everything had an “ImplementationInterface” and only one implementation – “*JDBCImpl.”  The thinking being that there might, someday be another persistence implementation.  Well, 6 years later and there is still only a JDBC implementation and the result of the interface is annoyance, extra code, extra complexity, and yet another layer of indirection.  If you decide to add another implementation, then and only then add the interface.
  3. StringBuffer/Builder.append instead of using the String + operator.  Come on.  Unless you are in a tight loop or something there is no reason to do this.  In most cases it compiles to StringBuffer/Builder anyway.  And it’s ugly.
  4. Creating complexity “ahead of time.”    See #2.  Programmers are terrible at predicting the future.  Add complexity when you need it.
  5. No defaults for configuration.  Java has a pervasive XML configuration culture – dunno why.  For some reason almost every Java coder thinks it’s proper practice to create an XML configuration file for every conceivable setting that could ever happen (see #4).  And for some reason almost every Java coder never sets a default, forcing every user to configure the setting even if 100% of all users configure the setting to the exact same value.  Why not just set a default host/port/etc?  Let the “exceptions” be configured.

Posted by: phil swenson | March 10, 2008

Why does Firefox suck so badly?

I remember when Firefox was fast and used less than 100 megs of memory…Tasklist

Posted by: phil swenson | March 3, 2008

Making Java (or Scala) dynamic

We all know the benefits of static typing. You get awesome tool support. You get compile time checking (a weak form of testing). You get excellent performance.

But you give up a lot. ActiveRecord is impossible with static typing. So are Groovy Builders. Ruby on Rails could never be built with Java or Scala. Statically typed languages simplely can’t be bent to your will and “expanded” in ways that are needed to support these techniques.

I’ve been learning Flex lately. Flex’s native language is ActionScript 3, which is like a cross between Java and Javascript – standard OO constructs, optional static typing (which is encouraged), but with a little dynamicism built in. AS3 is an OK language. Not great, has a lot of the syntactic ugliness from Javascript/Java and doesn’t really leverage too much from its dynamic roots.

But one thing did catch my eye. Actionscript allows you declare a class “dynamic.” Doing this allows you do add properties and methods on the fly. It appears you can subclass any static class and declare dynamic. This opens up tons of possibilities.

This got me wondering: is it reasonable or possible to extend Java or (more likely) Scala to support dynamic classes? Can we have the best of both worlds?

I don’t know if this is a good idea or what the implications are.  But on the surface is seems like it might be a “best of both worlds solution.”

Posted by: phil swenson | February 14, 2008

Your transaction # is 393950303005-A583895

Pet peeve of the day:

Every time I make a transaction over the phone I get a long ass transaction number.  Does anyone actually write down their transaction number?  Where did this strange practice originate?  Has anyone ever heard of looking up a transaction by identity?

 

Posted by: phil swenson | January 22, 2008

How to give the economy a pop

Congress should pass a resolution that the US vows not to invade any other countries this year.  Instantly you will see oil drop $20/barrel, world markets will soar, and people will start spending.  Not blowing shit up would be way more effective than any of the tax credits being talked about.

Posted by: phil swenson | January 18, 2008

Corporate Email Sucks

Am I the only one who finds it strange that my free private email experience is probably 100x better than my work email experience?

At work I am limited to 10 meg attachments, very slow reponse time, constant client crashes, login only via VPN (which is slow and clunky), tons of spam, 100 meg inbox limit, no cell phone integration, and can never find anything because the search is so poor.

For private email I have a fast browser client for free with 6 gigs space, virtually no spam, instant search, great calendar, 20 meg attachments, and excellent access from my phone.

As I’m sure you guessed, at work I’m using Outlook against Exchange and for private email I’m using Gmail.

So why do companies still bother with Exchange/Outlook?

Posted by: phil swenson | January 18, 2008

Productivity tip for devs

One of the most useful utilities on windows I’ve found (and used for years now) is called Clickie:  http://defoort.free.fr/clickie/.   It doesn’t do much – justs adds a “Copy Path Name” to the context menu in Windows Explorer.  Which if you are a dev you end up having to do about 10X a day.

Posted by: phil swenson | January 16, 2008

In case you are wondering….

Why did I go like 4 months w/o a blog post and all of a sudden I’m posting like crazy? Because I bought BlogJet and it’s so much easier to write posts with BlogJet than the clunky WordPress editor.

Posted by: phil swenson | January 16, 2008

WTF?

Why is it that I clicked delete on a 2KB file in Windows explorer and I’m able to write a blog post about it and publish it before it finishes deleting?

WTF?

Posted by: phil swenson | January 16, 2008

JRuby on Rails coolness

add this to your environment.rb and you add all the jars in your lib directory to your classpath.

Dir["#{RAILS_ROOT}/lib/**/*.jar"].each do |jar|
  require jar
end

Older Posts »

Categories