incubator-directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Manzke <daniel.man...@googlemail.com>
Subject Objects instead of String Parameters
Date Fri, 14 Oct 2011 08:23:11 GMT
Hi guys,

I just wanted to take the chance to discuss one thing with you.

(similar to the Getter- and Setter-Hell)

In the last years, I saw several APIs (like you guys too). In my Company we
started one year ago, to use speaking Classes for Parameters.
This means if I have a Method with 3 String Parameters, I only know what
they mean, if I have the JavaDoc. I really had this case. That's why we
started to use small (no getter and setter beans) classes. Like for the our
login-Method we we are using login(Username, Password) or known from others
login(Credentials).

We don't try to force it, because it doesn't make sense in every situation.
;)

Another one is the using of One Object as a Parameter. (like the
login(Credentials)) This allows you to evolve your API without breaking the
Compatibility, because you could add now Parameters, define them with
Default-Values, so every body can use them, if needed, but old
Implementations are also working.

What do you think? What's your way?

Bye,
Daniel

-- 
Viele Grüße/Best Regards

Daniel Manzke

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message