Click here to Skip to main content
15,902,860 members
Home / Discussions / C#
   

C#

 
GeneralRe: Semi-crosspost: Recompiling - but the assembly isn't updated Pin
Heath Stewart23-May-04 4:01
protectorHeath Stewart23-May-04 4:01 
GeneralReturning multiple values from methods Pin
bjoernen22-May-04 12:44
bjoernen22-May-04 12:44 
GeneralRe: Returning multiple values from methods Pin
Colin Angus Mackay22-May-04 13:12
Colin Angus Mackay22-May-04 13:12 
GeneralRe: Returning multiple values from methods Pin
bjoernen22-May-04 21:53
bjoernen22-May-04 21:53 
GeneralRe: Returning multiple values from methods Pin
Marc Clifton22-May-04 15:03
mvaMarc Clifton22-May-04 15:03 
GeneralRe: Returning multiple values from methods Pin
bjoernen22-May-04 22:18
bjoernen22-May-04 22:18 
GeneralRe: Returning multiple values from methods Pin
Marc Clifton23-May-04 2:59
mvaMarc Clifton23-May-04 2:59 
GeneralRe: Returning multiple values from methods Pin
bjoernen23-May-04 5:43
bjoernen23-May-04 5:43 
Marc Clifton wrote:
Ah, but I disagree. Input structs are very useful too! For example you can have overloaded constructors that accept different parameters and types. You can set defaults, and do validation. An input struct is a very nice middle layer between the caller and the callee.

I've done projects using both designs (simple parameters vs input structs), and I can't see the advantage of input structs. Input structs are usually very specific; they are used for a specific method. Since all mechanisms you describe can be accomplished with/within methods too (overloaded methods and validation inside methods, etc), I see no use of encapsulating the call parameters, just for sake of encapsulation.

Some people argue that it is easier extend the design by adding a parameter to the struct, than it is to the method signature. Just because of this, I would say it tampers with readability. I'll have to look at both method signature and struct to understand how to call this method.

I would say that a method should accept a struct only if the struct exists on it's own merits. For instance, it makes no sense to send x, y, width and height when Rectangle exists.

Marc Clifton wrote:
If you had a tool that would automatically create the structs for you, then it would be easy and accepted practice. And then, if you needed to modify the struct, you wouldn't have to fix up 10's or 100's of callers to match the new method signature, or create an abortion of overload methods

I agree that such tool would be very valuable. But I cant see why for example adding a property to a struct (which gets a default value so it wont break 100 callers) is less work than adding an overloaded method that takes another parameter to the class. The lack of support for optional method parameters in C# is another issue.

Marc Clifton wrote:
The current state of [edit]Computer Science[/edit] is a joke, IMO, but that's another matter. It's just that your question has touched on this subject, which is something I like to get up on my soapbox and rant about.

I was pleasantly surprised with the whole .NET initiative at first, and I have to say that C# is a good improvement over Java, and a huge over C++. I will definately stick with it. But I would have liked to see a bigger "generation leap". Especially on the algorithms and patterns department. What we got is a consitent win API, fancier tools and a few new ones. We still code apps the same way.

I would like to reduce the detail work by having the development environment support many abstract concepts like Hierarchical State Machines and GOF patterns, and let me describe logic in a declarative way, much like Prolog or Lisp. The programmer should not be dealing with implementation details (unless he wants to), but just enforce architectural rules (patterns) and business rules (declarative clauses).


Regards,
Björn Morén
Stockholm, Sweden

GeneralRe: Returning multiple values from methods Pin
Heath Stewart23-May-04 3:59
protectorHeath Stewart23-May-04 3:59 
GeneralRe: Returning multiple values from methods Pin
leppie22-May-04 19:45
leppie22-May-04 19:45 
GeneralRe: Returning multiple values from methods Pin
Heath Stewart23-May-04 3:56
protectorHeath Stewart23-May-04 3:56 
GeneralRe: Returning multiple values from methods Pin
bjoernen23-May-04 6:03
bjoernen23-May-04 6:03 
GeneralRe: Returning multiple values from methods Pin
MilesAhead24-May-04 7:34
MilesAhead24-May-04 7:34 
GeneralCausing a time delay within a method Pin
Anonymous22-May-04 11:57
Anonymous22-May-04 11:57 
GeneralRe: Causing a time delay within a method Pin
bjoernen22-May-04 12:55
bjoernen22-May-04 12:55 
GeneralRe: Causing a time delay within a method Pin
Colin Angus Mackay22-May-04 12:56
Colin Angus Mackay22-May-04 12:56 
GeneralRe: Causing a time delay within a method Pin
Marc Clifton22-May-04 15:00
mvaMarc Clifton22-May-04 15:00 
GeneralStackFrame Pin
TuringTest122-May-04 11:16
TuringTest122-May-04 11:16 
GeneralRe: StackFrame Pin
Colin Angus Mackay22-May-04 13:03
Colin Angus Mackay22-May-04 13:03 
GeneralRe: StackFrame Pin
Marc Clifton22-May-04 15:11
mvaMarc Clifton22-May-04 15:11 
GeneralRe: StackFrame Pin
TuringTest122-May-04 16:33
TuringTest122-May-04 16:33 
GeneralRe: StackFrame Pin
leppie23-May-04 2:22
leppie23-May-04 2:22 
GeneralRe: StackFrame Pin
TuringTest123-May-04 10:47
TuringTest123-May-04 10:47 
GeneralRe: StackFrame Pin
Heath Stewart23-May-04 3:53
protectorHeath Stewart23-May-04 3:53 
GeneralFile size Pin
PaleyX22-May-04 8:31
PaleyX22-May-04 8:31 

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.