Thread View: borland.public.csharpbuilder.oodesign
4 messages
4 total messages
Started by Gerrit Beuze
Tue, 12 Oct 2004 09:29
How do you organize (sort) you classes?
Author: Gerrit Beuze
Date: Tue, 12 Oct 2004 09:29
Date: Tue, 12 Oct 2004 09:29
23 lines
1666 bytes
1666 bytes
Hi all, I'm wondering if you how you organize your class code: Do you sort/ group by member type: fields, methods, properties etc.? If yes: what ordering scheme do yo use? Do you group members by visibility - and how does that relate to grouping by type? Where do you insert (nested) types such as enums and delegates in classes and namespaces? any order?, top, bottom grouped by type? The reason I ask is that I'm implementing a sorting / rearrange algorithm in ModelMaker Code Explorer for C# classes and namespaces. Check for details on ModelMaker Code Explorer: http://www.modelmakertools.com Thanks for your feedback, Gerrit Beuze ModelMaker Tools
Re: How do you organize (sort) you classes?
Author: David Clegg
Date: Tue, 12 Oct 2004 22:50
Date: Tue, 12 Oct 2004 22:50
49 lines
2257 bytes
2257 bytes
Gerrit Beuze wrote:
> Do you group members by visibility - and how does that relate to
> grouping by type?
Visiblility and ordered by Fields, Methods then Properties.
Constructors are always at the top.
I also enclose each in #region directives e.g.
class SomeClass {
#region Public Constructors
public SomeClass(){}
#endregion
#region Private Members
private string mSomeStr;
#endregion
#region Public Methods
public void DoSomething(){}
#endregion
#region Public Properties
public string SomeStr {get {return mSomeStr;} set {mSomeStr = value;}}
#endregion
}
>
> Where do you insert (nested) types such as enums and delegates in
> classes and namespaces? any order?, top, bottom grouped by type?
At the top of the relative visibility section.
--
Cheers,
David Clegg
dclegg_at_ebetonline_dot_com
Vote 1 http://cc.borland.com/codecentral/ccweb.exe/listing?id=21489 :-)
Now supports Google Groups searching with Dyna-extend(tm) technology!
QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com
"Ahhh... sweet pity. Where would my love life be without it?" - Homer
Simpson
Re: How do you organize (sort) you classes?
Author: David Clegg
Date: Wed, 13 Oct 2004 03:06
Date: Wed, 13 Oct 2004 03:06
19 lines
1637 bytes
1637 bytes
David Clegg wrote: > Visiblility and ordered by Fields, Methods then Properties. Oops, I tell a lie. The ordering is fields, properties then methods. -- Cheers, David Clegg dclegg_at_ebetonline_dot_com Vote 1 http://cc.borland.com/codecentral/ccweb.exe/listing?id=21489 :-) Now supports Google Groups searching with Dyna-extend(tm) technology! QualityCentral. The best way to bug Borland about bugs. http://qc.borland.com "You couldn't fool me on the foolingest day of the year with an electrified fooling machine." - Homer Simpson
Re: How do you organize (sort) you classes?
Author: Jim Cooper
Date: Wed, 13 Oct 2004 10:36
Date: Wed, 13 Oct 2004 10:36
29 lines
1653 bytes
1653 bytes
I tend to use the same sorts of groupings as I'm comfortable with in Delphi > Do you sort/ group by member type: fields, methods, properties etc.? Fields, properties, methods (constructors are the first methods), organised within each visibility level. And I never use alphabetical order for anything. Related properties are grouped together, same for methods. > Where do you insert (nested) types such as enums and delegates in classes > and namespaces? any order?, top, bottom grouped by type? Top Cheers, Jim Cooper _______________________________________________ Jim Cooper jim@falafelsoft.com Falafel Software http://www.falafelsoft.co.uk _______________________________________________
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads