[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
{
	Base,
	OneLevel,
	SubTree
}

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.

Jason
 
-----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.

Jason,
     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
Language
Conversion Assistant on the existing Novell Java LDAP source code, what
you
end up with leaves a lot to be desired.  I see a number of places where
the
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
C#
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,
if
you just mirror the Java API in C#, it's much easier to port existing
Java
client classes over to C#.  But I don't think that should be the only
goal
when porting com.novell.ldap.*.  I think it's important to make the C#
API
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
References
private System.Collections.ArrayList entries; // Search entries
private System.Collections.ArrayList referralConn = null; // Referral
Connections



Regards,

Sunil Kumar
Novell,bangalore
www.novell.com

-----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
I
did notice, however, is that you guys are naming your classes things
like:
	LDAPFoobar

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,
LdapFoobar)

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
Windows,
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
compat,
cvs history etc into account.

-- Ben

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com 
http://lists.ximian.com/mailman/listinfo/mono-list 


_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com 
http://lists.ximian.com/mailman/listinfo/mono-list
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list