Discussion on:

Message 5 of 14
0 Votes
+ -
Take breaks on your own time
Hey man... programming can get complicated sometimes. Don't complain about that - it's your job to figure that stuff out. There's two sides to this - calling code can get really ugly without optional parameters - it is a valuable feature.

I don't find it particularly hard to maintain actually, and there's many cases where I would rather see optional parameters instead of 5040 overloads (7-factorial). Think about that possibility, where we really do need to have all seven parameters be truly optional. Would you rather maintain five thousand overloads?

That is the exact reason I'm here reading this article. Not because I want to abuse future programmers, but because I would like to create some clean, compact, readable code, but I need to handle a possible 480 million options for parameters that could be there or not.

That said - I will be solving this issue by passing an object, which is what I would usually do, but today I had some time to look into other options. There really aren't any in C# - but they are there in other languages, and they are good - not always, but usually.
Posted by jasmine2501@...
2nd Dec 2010