Click here to Skip to main content
15,892,480 members
Home / Discussions / C#
   

C#

 
GeneralRe: Character "space" in a textbox -- same space used for upper and lower case? Pin
Eric Dahlvang26-Oct-06 5:36
Eric Dahlvang26-Oct-06 5:36 
Questionstring method Pin
rzvme26-Oct-06 3:52
rzvme26-Oct-06 3:52 
AnswerRe: string method Pin
shultas26-Oct-06 4:05
shultas26-Oct-06 4:05 
GeneralRe: string method Pin
rzvme26-Oct-06 8:54
rzvme26-Oct-06 8:54 
QuestionWhich is better? (Communications between classes) Pin
Muntyness26-Oct-06 3:42
Muntyness26-Oct-06 3:42 
AnswerRe: Which is better? (Communications between classes) Pin
Guffa26-Oct-06 4:11
Guffa26-Oct-06 4:11 
AnswerRe: Which is better? (Communications between classes) Pin
ednrgc26-Oct-06 4:16
ednrgc26-Oct-06 4:16 
AnswerRe: Which is better? (Communications between classes) Pin
Pete O'Hanlon26-Oct-06 4:33
mvePete O'Hanlon26-Oct-06 4:33 
Munty

What you are stumbling towards is a controller class, which is commonly used as part of an MVC (Model/View/Controller) pattern. This means that whenever you need to do something, you call the controller and let it decide how to accomplish the task.

Suppose, for instance, that class A is responsible for writing to a file and that class B can only read from the file when it is closed. Now, you could end up coding this so that you write to the file and then, when you need to read the file, you will have to check to see if the file is closed or not. This is fairly simple, and you could place the code to check the file handle in class B or in the code that is calling class A.

Unfortunately, this means that you have an implicit dependency in class A on class B, which means that every time that you want to change the behaviour of B, you have to change the behaviour of A. This is OK(ish) if you have the code to both A and B, but if somebody else has coded them, this is not great.

A better method is to move the controlling logic into the controller class C. This way, you have decoupled the dependencies.

In short - read up about patterns. They will serve you well.

Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."

Deja View - the feeling that you've seen this post before.

GeneralRe: Which is better? (Communications between classes) [modified] Pin
Muntyness26-Oct-06 5:17
Muntyness26-Oct-06 5:17 
GeneralRe: Which is better? (Communications between classes) Pin
Pete O'Hanlon26-Oct-06 5:21
mvePete O'Hanlon26-Oct-06 5:21 
GeneralRe: Which is better? (Communications between classes) Pin
Muntyness26-Oct-06 5:39
Muntyness26-Oct-06 5:39 
GeneralRe: Which is better? (Communications between classes) Pin
Pete O'Hanlon26-Oct-06 6:41
mvePete O'Hanlon26-Oct-06 6:41 
GeneralRe: Which is better? (Communications between classes) Pin
Muntyness26-Oct-06 7:02
Muntyness26-Oct-06 7:02 
GeneralRe: Which is better? (Communications between classes) Pin
led mike26-Oct-06 6:49
led mike26-Oct-06 6:49 
GeneralRe: Which is better? (Communications between classes) Pin
led mike26-Oct-06 5:58
led mike26-Oct-06 5:58 
GeneralRe: Which is better? (Communications between classes) Pin
Pete O'Hanlon26-Oct-06 6:39
mvePete O'Hanlon26-Oct-06 6:39 
QuestionHow to do https request and get correct Response using MSXML dll? Pin
pubududilena26-Oct-06 3:41
pubududilena26-Oct-06 3:41 
AnswerRe: How to do https request and get correct Response using MSXML dll? Pin
led mike26-Oct-06 6:18
led mike26-Oct-06 6:18 
GeneralRe: How to do https request and get correct Response using MSXML dll? Pin
pubududilena13-Nov-06 1:56
pubududilena13-Nov-06 1:56 
GeneralRe: How to do https request and get correct Response using MSXML dll? Pin
led mike13-Nov-06 7:23
led mike13-Nov-06 7:23 
QuestionAnonymous Methods Pin
mohanlon26-Oct-06 3:23
mohanlon26-Oct-06 3:23 
AnswerRe: Anonymous Methods Pin
ednrgc26-Oct-06 4:24
ednrgc26-Oct-06 4:24 
GeneralRe: Anonymous Methods Pin
mohanlon26-Oct-06 5:32
mohanlon26-Oct-06 5:32 
GeneralRe: Anonymous Methods Pin
Pete O'Hanlon26-Oct-06 6:42
mvePete O'Hanlon26-Oct-06 6:42 
GeneralRe: Anonymous Methods Pin
ednrgc26-Oct-06 6:58
ednrgc26-Oct-06 6:58 

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.