[Mono-list] .NET C# LDAP Libraray.

Jason Raneses jason@raneses.com
Thu, 13 Nov 2003 23:07:07 -0800

Regarding the parameter names, I'll get back to you tomorrow when I've got
the code in front of me.  I'll be happy to provide pointers to the
files/line numbers that I noticed it.

In response to your comments regarding the static constants, if you re-read
my statement, you'll notice that I recommended the use of enumerations
instead of static constants which is a much better way of handing parameters
such as search scope, LDAP version number, etc.  For sample:

public enum SearchScope

Instead of:

public const int SCOPE_BASE = 0;
public const int SCOPE_ONE = 1;
public const int SCOPE_SUB = 2;

Clients would pass in a parameter of type SearchScope instead of an int as
with the public int consts.

-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Sunil Kumar
Sent: Thursday, November 13, 2003 9:15 PM
To: Matt Ryan; jason@raneses.com; bmaurer@users.sourceforge.net
Cc: mono-list@lists.ximian.com
Subject: RE: [Mono-list] .NET C# LDAP Libraray.

     Thanks for all your feedback and comments.Since this was the
intial release and we expected to receive a lots  of feedback and
comments so that we can make improvemets in the C# LDAP Libraries. 

My response to your comments below:-

Q1. Just to add my 2 cents...I know while it was easier to run the Java
Conversion Assistant on the existing Novell Java LDAP source code, what
end up with leaves a lot to be desired.  I see a number of places where
converter mangled parameter names.

Response:- Let me know exactly where have you seen such kind of mangled
parameter names?

Q2. Also, there's a plethora of static const integers exposed in a
number of
classes, namely LDAPConnection and LDAPException.  To truly comply with
conventions, these should be replaced with standard enumerations.

Response:-  The static const integers you are talking about are 
constants which will be used by application  using C# LDAP libararies
and the LDAP Libraray both . Constants like :

public const int SCOPE_BASE = 0;
public const int SCOPE_ONE = 1;
public const int SCOPE_SUB = 2;
public const int LDAP_V3 = 3;
public const int DEFAULT_PORT = 389;
public const int DEFAULT_SSL_PORT = 636;

Instead of application defining these constants themselves everywhere,
we have included this as part of the Library itself . I donn see any
harm in defining these constants and exposing them outside, Insted I see
it will be lot more useful in most of the cases. e.g see a sample
example of C# apllication  which will be  using this:-

LDAPConnection ldapconn;
int    ldapVersion  =  LDAPConnection.LDAP_V3;
int    ldapPort = LDAPConnection.DEFAULT_PORT;
            // connect to the server
ldapconn.connect( ldapHost, ldapPort );
            // bind to the server
ldapconn.bind( ldapVersion, loginDN, password );

Q3. In a lot of ways, it's a tough call as whether it's best to stick
with the
existing API used in the Java code when porting it to C#.  On one hand,
you just mirror the Java API in C#, it's much easier to port existing
client classes over to C#.  But I don't think that should be the only
when porting com.novell.ldap.*.  I think it's important to make the C#
as true to Microsoft's guidelines as possible.  Classes like
LDAPSearchResults should implement the appropriate collection
interfaces so
foreach and indexers can be used, etc.

Response:- As far as  using collection interfaces in LDAPSearchResults
and other classes are considered. Instaed of implementing those
interfaces we have used already implemented collection objects. e.g In
LDAPSearchResults class ,If you see we have used 
System.Collections.ArrayList at many places like for storing
searchresults and references:-

private System.Collections.ArrayList references; // Search Result
private System.Collections.ArrayList entries; // Search entries
private System.Collections.ArrayList referralConn = null; // Referral


Sunil Kumar

-----Original Message-----
From: mono-list-admin@lists.ximian.com 
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Ben Maurer
Sent: Thursday, November 13, 2003 4:18 PM
To: Matt Ryan
Cc: mono-list@lists.ximian.com 
Subject: Re: [Mono-list] .NET C# LDAP Libraray.

Hello Matt,

I was taking a quick look at your sources, they look great! One thing
did notice, however, is that you guys are naming your classes things

However, in c# the guidelines for when you have a situation like that:

1) if the first part is two letters, keep it uppercase (eg, IPAddress)
2) otherwise, only have the first letter uppercase (XmlTextWriter,

Right now, you are early enough in the design process that this can
easily be fixed with a tad of grep magic (no need to worry about
history-- there is nothing to loose).

I would highly advise running FxCop (i realize it only runs in
some day I think we should make something like it for mono).

Better to catch stuff like this early when you dont have to take
cvs history etc into account.

-- Ben

Mono-list maillist  -  Mono-list@lists.ximian.com 

Mono-list maillist  -  Mono-list@lists.ximian.com 
Mono-list maillist  -  Mono-list@lists.ximian.com