commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Karasulu" <>
Subject RE: [codec] Binary BIT_n and BITS question.
Date Wed, 17 Mar 2004 19:23:32 GMT

> (1) The public Binary.BITS field is not used from anywhere. How is it
> generally useful, it has no Javadoc? Should we get rid of it?

I was planning on using it later when I cleaned up this class a bit.  
If you're going for a release feel free to blow it away.  I have not 
decided yet whether to leave loops unraveled and ugly or add another 
loop to cycle through this array.  I thought it might be better to 
unravel it for speed.

> (2) The public Binary.BIT_n fields are only used from Binary. Should
> they really be public fields?

Hmmm I think this might be best kept private but I do use them else where 
in applications that depend on Binary however perhaps incorrectly.  Let me 
explain below.  

I think there really is not that much value to having these constants 
since people can just use hex masks on the fly.  But it's proper form to 
make them into a constant no?  I thought so and strive to write code 
that uses a constant every time I can regardless of data type.  The 
question is: When is too much formality too much?  Are we going to 
create 8 or 32 constants for each bit in a byte or in an integer?  Do 
you think it might be going a little overboard?  The array of masks on 
the other hand might be good to have for looping over bit ranges in 
bytes and integers.

Another concern is whether or not codec is the place for general stuff
like this.  Personally I think the constants might be better off in a 
commons-lang class like BitField or BooleanUtils but do you want 
the dependency for such a small benefit.  Are these constants worth 
it to incur the dependency?  Then again is it ok for other commons 
projects to have a dependency on something like commons-lang which 
has no other dependency.  To me commons-lang can be a universal 
dependency and get away with it.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message