Skip to main content
22 events
when toggle format what by license comment
Mar 2, 2023 at 19:05 answer added gnasher729 timeline score: 1
Jul 26, 2017 at 7:44 history tweeted twitter.com/StackSoftEng/status/890115553255452672
Jul 23, 2017 at 19:31 vote accept Laiv
Jul 23, 2017 at 18:00 history edited Laiv CC BY-SA 3.0
deleted 76 characters in body
Jul 23, 2017 at 17:55 history edited Laiv CC BY-SA 3.0
added 167 characters in body
Jul 22, 2017 at 22:22 comment added Laiv You all are right. I have understated the relevance of the lack on meaningful param names in the former question. In consequence I rushed into a solution that in many senses is overengineering.
Jul 22, 2017 at 12:04 comment added JacquesB @Laiv: In short, an array is appropriate if all items are treated uniformly. If the method treat items differently based on the index, then an array is not appropriate. An array with givenName, surName, age etc as fields is probably wrong, since code would treat givenName differently than age, but having an array with addresses might be appropriate if all addresses are processed the same way. Without meaningful names in the example it is impossible to way whether this is the case or not.
Jul 22, 2017 at 11:06 comment added Laiv @JacquesB you are already answering my question. If meaningful names is what really matters in order to choose the strategy, then this is a useful answer. If you feel like elaborating the answer, I would apreciate It. I'm not looking for a black or white answer. Just a reasoning.
Jul 22, 2017 at 10:55 comment added JacquesB It is impossible to say anything meaningful about parameters named a, b, c or arguments. The same problem is in the question you refer to, which is the cause of the confusion in the first place. Maybe they are appropriate as individual values, maybe an array is appropriate, maybe an object or multiple objects. Without meaningful names this is all guesswork. You will not get any useful answer to the question as posed.
Jul 22, 2017 at 9:51 answer added Ewan timeline score: 1
Jul 22, 2017 at 9:50 comment added Laiv Looking for a proper title to my question. I think I failed in expressing my doubts.
Jul 22, 2017 at 9:24 answer added besc timeline score: 10
Jul 22, 2017 at 8:01 history edited Laiv CC BY-SA 3.0
added 250 characters in body; added 75 characters in body
Jul 22, 2017 at 7:53 comment added Laiv That's my question. Take a look at the link I shared in my question. The OP has an homogenous number of attributes (strings). He would like to make the constructor simpler among other things.
Jul 22, 2017 at 7:49 comment added Alexander @Laiv Why would you want to do that? Those pieces of data aren't related, why would you put them together in an array?
Jul 22, 2017 at 7:44 comment added Laiv @Alexander not exactly. Let's say we model the class Customer and we initialize it with an array which holds the name, surname, a code and some more parameters. All of them strings
Jul 21, 2017 at 22:14 review Close votes
Jul 26, 2017 at 3:02
Jul 21, 2017 at 21:45 comment added Alexander @Laiv Do you mean storing multiple, potentially heterogeneously typed, parameters into a single array, in place of a Params class?
Jul 21, 2017 at 21:28 comment added Robert Harvey As to your answer on the previous question, I find it to be a perfect example of the kind of over-engineering that seems to be so much in vogue these days.
Jul 21, 2017 at 21:25 comment added Robert Harvey C# specifically supports arrays as first-class method parameter objects. It even provides a special params keyword so that a variable number of arguments can be specified. It's hard to imagine how they would incorporate that into the language if it weren't useful. You haven't really explained why you think such practices are brittle.
Jul 21, 2017 at 21:14 answer added juhist timeline score: 9
Jul 21, 2017 at 21:01 history asked Laiv CC BY-SA 3.0