[jdom-interest] Bit masks in ContentFilter

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Apr 12 12:28:32 PDT 2002

The bitmasking approach of ContentFilter strikes me as very un-OO. Even 
if we use it internally for performance, I'd prefer it to be completely 
private. i.e. all the details of the masking would be completely private 
or at worst package-private. The clean method interfaces should be 
enough. Bitmasking and the like is an implementation detail the client 
programmer should not concern themselves with.

As a side note, I've been seeing in my classes lately that my students 
are less and less likely to be familiar with bitwise operators of all 
kinds. This was important stuff in the C-centric world of a decade ago, 
but now it's mostly arcana familar only to old farts like me. Yes, it 
exists in some classes in the JDK such as ImageObserver, but these are 
all old classes written way back in Java 1.0 before the programmers at 
Sun had fuly transitioned to the Java way of doing things. I classify 
this stuff along with named constants in lower case as vestigial relics 
of C.

Since the ContentFilter class is very new, we probably wouldn't hurt 
anyone too badly by removing public access to these fields, and we'd 
simplify its API considerably going forward without losing any 
functionality. Indeed, we'd be opening up the possibility to discover 
newer, faster implementations in the future.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|           The XML Bible, 2nd Edition (IDG Books, 2001)             |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:   http://www.cafeaulait.org/     | 
|  Read Cafe con Leche for XML News:  http://www.cafeconleche.org/   |

More information about the jdom-interest mailing list