Skip to main content
11 events
when toggle format what by license comment
Jul 13, 2021 at 3:05 comment added User 10482 Although each individual function would take 1-4 parameters after refactoring a large function, still the parent function has to provide all of the paramaeters, and thus itself having many parameters anyway. Where does this chain stop? main()?
Sep 27, 2017 at 17:47 history edited Robert Harvey CC BY-SA 3.0
deleted 2 characters in body
Sep 13, 2016 at 19:28 comment added Bent God functions are just as big a problem as god objects.
Apr 25, 2012 at 8:24 comment added ThomasX @Evain Plaice: Since when are dynamically typed languages expressive?
Apr 19, 2012 at 15:26 vote accept Darth Egregious
Apr 18, 2012 at 20:20 comment added Evan Plaice @MichaelK If you have never used them, try googling 'object initializers'. It's a pretty novel approach that significantly reduces definition boilerplate. In theory, you could eliminate a classes constructors, parameters, and overloads all in one shot. In practice though, it's usually good to maintain one common constructor and rely on the 'object initializer' syntax for the rest of the obscure/niche properties. IMHO, it's the closest you get to the expressiveness of dynamically typed languages in a statically typed language.
Apr 18, 2012 at 19:14 comment added Michael K @EvanPlaice I'm not saying that you have to use that pattern whenever you have more than one parameter - you're absolutely correct that that becomes even nastier than the first list. There may be cases where you really do need a large number of parameters and it just doesn't work to wrap them up in an object. I've yet to meet a case in enterprise development that did not fall into one of the two buckets I mentioned in my answer - that's not saying one doesn't exist though.
Apr 18, 2012 at 19:14 comment added Evan Plaice Unless you use the Pattern Object pattern to package variables in an object instance and pass that in as a parameter. That works for packaging but it may be tempting to create classes of dissimilar variables just for the convenience of simplifying the method definition.
Apr 18, 2012 at 19:10 comment added Evan Plaice Parameter abstraction has been turned into a design pattern? What happens if you have 3 parameter classes. Do you add 9 more method overloads to handle the different possible combinations of parameters? That sounds like a nasty O(n^2) parameter declaration issue. Oh wait, you can only inherit 1 class in Java/C# so that will require some more biolerplate (maybe some more subclassing) to make it work in practice. Sorry, I'm not convinced. Ignoring the more expressive approaches a language may offer in favor of complexity just feels wrong.
Apr 18, 2012 at 18:18 history edited Michael K CC BY-SA 3.0
added 585 characters in body
Apr 18, 2012 at 18:09 history answered Michael K CC BY-SA 3.0