Timeline for Variable name which sometimes refers to an object and sometimes to a string
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 21, 2017 at 19:37 | history | tweeted | twitter.com/StackSoftEng/status/822890949206544385 | ||
Jan 18, 2017 at 7:48 | comment | added | Martin Maat | Your zipcode class is a processor-analyser, not a zipcode. So you should call it ZipCodeAnalyser, -Validator, -Monkey, -Scrutinizer or whatever feels right, as long as it expresses the fact that it is a thingy that does something with your zipcode. | |
Jan 17, 2017 at 23:24 | comment | added | tofro | I'm fearing your chosen example doesn't illustrate your point well, as it escapes me atm why a zip code should hold more data than the string version (and it's the data that matters, not the methods). As such I'm missing the "excessive" in that example. | |
Jan 17, 2017 at 22:41 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 18, 2016 at 22:03 | answer | added | Turnkey | timeline score: 3 | |
Dec 18, 2016 at 19:08 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Nov 19, 2016 at 23:07 | comment | added | Greg Burghardt | I feel like there is an answerable question here, but it's not about the name of a variable. What should you do in an application when data can be represented as a string or complex type? That's the question. | |
Nov 19, 2016 at 23:04 | comment | added | Greg Burghardt | Some languages allow you to specify a method on a class that converts it to another type without an explicit cast. Maybe add such behavior to the ZipCode class to implicitly convert it to a string so you can pass it to any method that accepts a zip code as a string. Then it doesn't matter. | |
Nov 18, 2016 at 18:09 | history | edited | Tulains Córdova | CC BY-SA 3.0 |
edited title
|
Nov 18, 2016 at 17:58 | answer | added | utnapistim | timeline score: 3 | |
Nov 18, 2016 at 17:13 | answer | added | David Arno | timeline score: 1 | |
Nov 18, 2016 at 16:30 | review | Close votes | |||
Nov 26, 2016 at 3:03 | |||||
Nov 18, 2016 at 16:26 | answer | added | Jon Raynor | timeline score: -2 | |
Nov 18, 2016 at 15:56 | comment | added | Pieter B | Using a Zipcode object where you use Zipcode.AsString where you need strings is not an option? | |
Nov 18, 2016 at 15:55 | comment | added | Vincent Savard | "I could [...] use only ZipCode objects everywhere, but that seems excessive [...]" It doesn't seem excessive to me. Your value has a specific semantic and requires specific validation. You can't pass the string "foobar" to a function which expects a zip code. | |
Nov 18, 2016 at 15:50 | history | asked | Andy | CC BY-SA 3.0 |