shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kalle Korhonen <kalle.o.korho...@gmail.com>
Subject Re: Crypto hierarchy is a *good thing*
Date Mon, 25 Oct 2010 19:58:12 GMT
On Mon, Oct 25, 2010 at 12:08 PM, Les Hazlewood <lhazlewood@apache.org> wrote:
> We can remove the concrete Hash implementations, but I don't agree
> that we should.   Without question, the number one design goal of
> Shiro is ease-of-use, even if it means maintaining a little more code
> by the dev team. A lot of people are using code like this:
> new Sha1Hash(blah).toBase64()
> new Md5Hash(foo).toHex()
> which is a just a joy to use as an end-user and more readable compared
> to anything the JDK provides.

It's probably just the weight of the history. Type safety is certainly
a good thing but inheritance is still not the only option. I suppose a
modern implementation would use a single Hash class possibly with
generics and an enum to denote the type of the hash. At the time the
hierarchy was written neither of the more modern option was probably
not available. Looking at it now though the concrete classes for each
hash type don't seem all that necessary but it still doesn't have to
be a choice between String and a concrete class.

Kalle

Mime
View raw message