Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
GeneralRe: Optimization Pin
Paul Conrad27-Jan-08 7:16
professionalPaul Conrad27-Jan-08 7:16 
GeneralRe: Optimization Pin
half-life27-Jan-08 8:31
half-life27-Jan-08 8:31 
GeneralRe: Optimization Pin
Paul Conrad27-Jan-08 9:10
professionalPaul Conrad27-Jan-08 9:10 
GeneralRe: Optimization Pin
half-life27-Jan-08 9:51
half-life27-Jan-08 9:51 
GeneralRe: Optimization Pin
Paul Conrad27-Jan-08 9:56
professionalPaul Conrad27-Jan-08 9:56 
GeneralRe: Optimization Pin
Luc Pattyn27-Jan-08 6:35
sitebuilderLuc Pattyn27-Jan-08 6:35 
GeneralRe: Optimization Pin
half-life27-Jan-08 7:07
half-life27-Jan-08 7:07 
GeneralRe: Optimization Pin
Luc Pattyn27-Jan-08 7:34
sitebuilderLuc Pattyn27-Jan-08 7:34 
Hi,


half-life wrote:
it is better do define it once and use it all along the app?



in programming, most objects mimic real-life objects, so their life span should correspond.
If you replace your car by a new one, that is a new object, don't try to recycle the old object.
But if your paint handler needs a Pen to draw a line, it is a similar pen each time, so why
not keep the pen handy and continue using it, as opposed to always create a new one.

half-life wrote:
are my objects larger than necessary?


Data efficiency:
- store text in strings, rather than adding individual characters to a Collection.
- store image pixels in an image, not pixel objects in a Collection.
- don't use a two-dimensional array if a one-dimensional array can do the job.
etc etc.
Overall, don't make objects out of everything, items that belong together, have the same
life span, cannot exist without each other, should be part of a single object. It's things
like that that I meant here.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.


GeneralRe: Optimization Pin
half-life27-Jan-08 8:38
half-life27-Jan-08 8:38 
GeneralRe: Optimization Pin
Luc Pattyn27-Jan-08 8:53
sitebuilderLuc Pattyn27-Jan-08 8:53 
GeneralRe: Optimization Pin
half-life27-Jan-08 9:53
half-life27-Jan-08 9:53 
GeneralRe: Optimization Pin
PIEBALDconsult27-Jan-08 7:39
mvePIEBALDconsult27-Jan-08 7:39 
GeneralRe: Optimization Pin
half-life27-Jan-08 8:41
half-life27-Jan-08 8:41 
GeneralRe: Optimization Pin
Luc Pattyn27-Jan-08 9:21
sitebuilderLuc Pattyn27-Jan-08 9:21 
GeneralRe: Optimization Pin
half-life27-Jan-08 9:54
half-life27-Jan-08 9:54 
GeneralRe: Optimization Pin
PIEBALDconsult27-Jan-08 10:47
mvePIEBALDconsult27-Jan-08 10:47 
QuestionShare source code of C# Pin
kelary27-Jan-08 2:51
kelary27-Jan-08 2:51 
GeneralRe: Share source code of C# Pin
Giorgi Dalakishvili27-Jan-08 3:00
mentorGiorgi Dalakishvili27-Jan-08 3:00 
GeneralRe: Share source code of C# Pin
Paul Conrad27-Jan-08 5:50
professionalPaul Conrad27-Jan-08 5:50 
QuestionHow to Represent String Constants Pin
Brady Kelly27-Jan-08 0:11
Brady Kelly27-Jan-08 0:11 
AnswerRe: How to Represent String Constants Pin
PIEBALDconsult27-Jan-08 4:15
mvePIEBALDconsult27-Jan-08 4:15 
GeneralRe: How to Represent String Constants Pin
Brady Kelly27-Jan-08 4:49
Brady Kelly27-Jan-08 4:49 
GeneralRe: How to Represent String Constants Pin
PIEBALDconsult27-Jan-08 7:49
mvePIEBALDconsult27-Jan-08 7:49 
GeneralRe: How to Represent String Constants Pin
Brady Kelly27-Jan-08 8:06
Brady Kelly27-Jan-08 8:06 
GeneralResolution and Icon Layout Pin
half-life26-Jan-08 23:34
half-life26-Jan-08 23:34 

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.