Jeremy Boynes skrev:
What I don't like with the arg array is the lack of context and type safety.

For example, I find

cmd.execute(new String[]{"-p", "1567", "-h", "localhost" })

less meaningful than

cmd.setPort(1567);
cmd.setHost("localhost");
cmd.execute();

and probably harder to implement when you add in error checking.

I totally agree with you. Also, if you write

  cmd.setProt(1567);
  cmd.setHots("localhost");
  cmd.execute();

you will get an error at compile time, whereas if you write

  cmd.execute(new String[] { "-P", "1567", "-H", "localhost" });

the best you can hope for is an exception at runtime.

--
Øyvind Bakksjø
Sun Microsystems, Web Services, Database Technology Group
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43419 / +47 73842119, Fax: +47 73842101

Reply via email to