Click here to Skip to main content
15,888,065 members
Home / Discussions / C#
   

C#

 
QuestionRe: Breaking Up Classes Pin
GlobX27-Jan-11 12:58
GlobX27-Jan-11 12:58 
AnswerRe: Breaking Up Classes Pin
Manfred Rudolf Bihy27-Jan-11 13:41
professionalManfred Rudolf Bihy27-Jan-11 13:41 
GeneralRe: Breaking Up Classes Pin
GlobX27-Jan-11 13:50
GlobX27-Jan-11 13:50 
GeneralRe: Breaking Up Classes Pin
Manfred Rudolf Bihy27-Jan-11 13:56
professionalManfred Rudolf Bihy27-Jan-11 13:56 
AnswerRe: Breaking Up Classes Pin
TheGreatAndPowerfulOz27-Jan-11 13:43
TheGreatAndPowerfulOz27-Jan-11 13:43 
GeneralRe: Breaking Up Classes Pin
GlobX27-Jan-11 14:03
GlobX27-Jan-11 14:03 
GeneralRe: Breaking Up Classes Pin
PIEBALDconsult27-Jan-11 14:13
mvePIEBALDconsult27-Jan-11 14:13 
AnswerRe: Breaking Up Classes PinPopular
Luc Pattyn27-Jan-11 13:07
sitebuilderLuc Pattyn27-Jan-11 13:07 
Class size doesn't really matter, well it sure isn't a primary concern. Object orientation should guide you. I'll assume it isn't a huge static class holding everything (as a VB module would).

My advice would be you ask yourself a number of questions:

1.
check the class name. Does it cover well everything inside the class? And would it be easy to come up with one or two new names that cover the content any better?

2.
check your "executive summary" comment, which is supposed to describe at a high level what your class is offering. Does it exceed 5 lines of text (excluding the petty details that aren't executive at all)? Does the text suggest a split somehow?

3.
look for inheritance. Are some parts of your class only relevant to some of its instances? If so, use inheritance.

4.
look for properties and methods that may be relevant to other objects, i.e. that would have (potential) value when applicable to other objects. If so, consider aggregation. See e.g. the decorator pattern.

5.
test yourself: without looking at the code, try and name all public properties and methods by heart. If you can't name half of them right away, you might be better of with a smaller class, if that were possible.

After looking at it from those different angles, I think you should know what to do (and if you don't, it tells you it doesn't really matter).

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Breaking Up Classes Pin
inayathussaintoori27-Jan-11 14:04
inayathussaintoori27-Jan-11 14:04 
GeneralRe: Breaking Up Classes Pin
musefan28-Jan-11 5:58
musefan28-Jan-11 5:58 
GeneralRe: Breaking Up Classes Pin
Luc Pattyn28-Jan-11 6:14
sitebuilderLuc Pattyn28-Jan-11 6:14 
AnswerRe: Breaking Up Classes Pin
PIEBALDconsult27-Jan-11 14:09
mvePIEBALDconsult27-Jan-11 14:09 
AnswerRead this ebook from los techies about the SOLID principles Pin
i.j.russell28-Jan-11 1:36
i.j.russell28-Jan-11 1:36 
AnswerRe: Breaking Up Classes Pin
Alan Balkany28-Jan-11 3:07
Alan Balkany28-Jan-11 3:07 
AnswerRe: Breaking Up Classes Pin
fjdiewornncalwe28-Jan-11 4:12
professionalfjdiewornncalwe28-Jan-11 4:12 
QuestionUSB device detection upon program startup Pin
Blubbo27-Jan-11 9:51
Blubbo27-Jan-11 9:51 
AnswerRe: USB device detection upon program startup Pin
Luc Pattyn27-Jan-11 11:02
sitebuilderLuc Pattyn27-Jan-11 11:02 
GeneralRe: USB device detection upon program startup Pin
Blubbo27-Jan-11 16:46
Blubbo27-Jan-11 16:46 
AnswerRe: USB device detection upon program startup Pin
Luc Pattyn27-Jan-11 17:25
sitebuilderLuc Pattyn27-Jan-11 17:25 
Questionproblem with dynamic ips when using sockets. Pin
prasadbuddhika27-Jan-11 6:25
prasadbuddhika27-Jan-11 6:25 
AnswerRe: problem with dynamic ips when using sockets. Pin
Yusuf27-Jan-11 6:30
Yusuf27-Jan-11 6:30 
AnswerRe: problem with dynamic ips when using sockets. Pin
Richard MacCutchan27-Jan-11 7:15
mveRichard MacCutchan27-Jan-11 7:15 
GeneralRe: problem with dynamic ips when using sockets. Pin
prasadbuddhika27-Jan-11 19:23
prasadbuddhika27-Jan-11 19:23 
GeneralRe: problem with dynamic ips when using sockets. Pin
Richard MacCutchan27-Jan-11 22:45
mveRichard MacCutchan27-Jan-11 22:45 
AnswerRe: problem with dynamic ips when using sockets. Pin
jschell27-Jan-11 8:37
jschell27-Jan-11 8:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.