directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [CONSTANSTS] Conventions and Update
Date Sat, 14 Apr 2007 23:47:49 GMT

> May be because "top" is not an attribute type, but an object class :)
> 
> There is a TOP_OC = "top" in SchemaConstants.

Oooops :-) I was adding it to an Attribute and
my mind played tricks with me.  Bad Mind!  Very very very Bad (With a 
twitching of the finger)!

> Yes, foloowing one of your suggestion to gather all the constants 
> somwhere. It's currently in the shared-constants project

Oh Cool - I need to checkout the trunk again and have a look.

> I buy this idea. Even if the name are a little bit long, there is a 
> clear advantage to use them : AT and OC does not immediatly seems to be 
> associated with AttributeType and ObjectClass. Can you create a JIRA 
> with this suggestion ?

Done.  I'll have a look at the Constants we have so far and
suggest conventions for naming various members.  Once we agree
I'll go ahead and update.

Incidentally I think we should apply this type of convention
to all java members and variables.

When creating an Attribute like this for instance;

Attribute objectClass = new BasicAttribute();

Some call it Attribute oc...

I call it

objectClassAttribute

That way a little further down in the code it's easy to see
exactly what the member or variable refers to.

Also, if it were called just objectClass...I might just wonder
whether it's an ObjectClass or Attribute...so by postfixing the
Type we avoid the "What is that thing again?" scenario.

As a rule this convention could be expressed as "Append the Type to the 
end of a member".  Sometimes it's really really obvious, but as the code
base grows and more gets added to the file, it becomes less obvious.

I may be pushing it (Real Goood) now :-) but I thought I'd throw it in 
the mix :-)

When everyone follows conventions like this, it makes it a lot
easier to read code, because we know what the conventions are,
and thus we can immediately identify what someone is referring to...

Cheers,
- Ole


Mime
View raw message