Several changes to comply with MS C# and .NET class
guidelines. I record here some important guidelines,
and reml-ref already complies in many cases. These
should be checked in the source, and any needed
changes should be made:
- Use [assembly: CLSCompliantAttribute(true)] if
possible. This could help if the implementation is
restructured as a DLL.
- Use PascalCase for everything except parameters
(fields of classes, and args of methods/functions). Use
Reml or reml (rather than the camlCase REML), except
maybe in the namespace.
- Change the namespace, probably to:
GocekDotCom.REML.ReferenceImplementation
- Noun-ify class names and property names as needed.
- Avoid abbreviations, no underscores in class names.
- Verb-ify method names.
- Check enumeration types. Dont use Enum suffix on
name. Use Int32 for the underlying type. Check for out-
of-range with Enum.IsDefined, see "Enum Usage
Guidelines".
- Don't capitalize constants, use PascalCase or
camelCase.
- Use static properties instead of public static fields (I
used a couple of static variables, those should probably
be cleaned up).
- Don't use misleading names. For example, don't
name a parameter "Color" if its type is integer.
- Events should always have a sender named "sender"
of type object. The event "e" can be more specific, but
it's probably not worth changing if generic.
- Preserve property values in set accessors in case the
set accessor throws an exception. See Property Usage
Guidelines.
- Use a method (not a property) when the task is
expensive, when the task depends on the state of
something else, or when returning an array. Use a
property (not a method) for simple, atomic tasks that
can be executed in any order. A developer using a
class will assume that properties are cheap and fast.
- Use method overloading instead of default arguments.
Default args do not version well.
I.e., specify
int Method(int x) and
int Method(int x, int y)
Rather than
int Method(int x, int y) where y is somehow
defaulted or exceptioned if y is not specified.
- For methods that, by definition, have a variable number
of args, use params keyword.
- Dont use public fields in classes, use private fields
with public properties instead (except for constants for
constants, just make the field public).
- Cant have too much error checking against arguments
to methods/properties.
- Consider creating an exception for a file that is not a
REML file instead of leaving the name as null and having
the caller check the name.
- throw exceptions instead of returning error codes.
- See Programming for Garbage Collection.
- Support threading, such as in the Write methods,
since the whole file is re-written. This might improve the
listbox redisplay, although it might delay the ability of
the user to click the arrow button until the background
operation is complete.
Logged In: YES
user_id=1239827
Changed the namespace of all files to Gocek.REML. I
thought about using a different namespace for each file, but
then each file has to have using statements for each file it
uses. Realistically, no one cares about REML but me, so
it's not worth the hassle even if it would be a better design.
Logged In: YES
user_id=1239827
No class names have underscores.