Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# partial
Hi all!
 
Partial classes is excellent for readability, separating UI / logic, teams, etc. , but:
 
Is there any runtime benefits (i.e. memory use, loading UI (WinForms)) of saving / splitting different logical parts of a class into different files, or are me asking this question a tell-tale of poor design (my class need refactoring)?
 
Project scenario: Single developer, desktop-dev, winform displaying results of different types of filesearch (local computer). Some of the search-logic separated in a dll, rest is embedded in the winform-code. What started as a "You'll have it by the end of the week", became "Shure, I know UML" before I parted the threading logic, filtering, etc.
 
TIA
Per Rollvang
-------------
On Error Goto Hell
Posted 4-Dec-10 8:12am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

No benefits and no drawbacks whatsoever (as speed, memory and so on).
  Permalink  
Comments
Load_error at 4-Dec-10 13:39pm
   
Ok, nothing magic happening :) Thanks for answering.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you feel the need to break apart your class into different files because it has different "logical" parts, you probably need to refactor the class into multiple classes that each perform a more specific role in the project. Classes really should be treated a little along the lines of how methods should be. With methods, the name should be descriptive and the method should do exactly what it says it does and nothing more. A class should do the same. It should define an object and only do stuff that is directly relevant to itself and that it can do without knowledge of other objects in the domain. Logic that needs to have knowledge of multiple objects should be in a third class, not in one of those other objects.
  Permalink  
Comments
Load_error at 4-Dec-10 14:27pm
   
That is the concept of OO, right? Well, I more often than not end up with small pieces of crap, than real OO-classes anyhow.. ;) Guess I have to read up on design! Thanks for answering!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,569
1 Sergey Alexandrovich Kryukov 6,168
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 4 Dec 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100