Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • 4
    How did you come to that understanding? Commented Dec 4, 2019 at 10:35
  • 40
    Addresses are complex—have you ever seen some from dramatically foreign countries? How can you assume there won’t be multiple ZipCode implementations? Commented Dec 4, 2019 at 13:23
  • 23
    Somewhere you must use concrete types, otherwise nothing would run. It all depends on where and how you use them. For example: every object is just a bunch of bytes containing data and instructions... nothing stops you from using a plain java.lang.String in place of all the objects! Your functions will just interpret the String to obtain the information and the instructions to execute and you wont need any other type than String! That's clearly going too far in using concrete types. Commented Dec 4, 2019 at 18:30
  • 20
    You should read more about addresses and how little you know: mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses Commented Dec 4, 2019 at 18:32
  • 15
    @D.BenKnoble exactly due to variety of formats in zip codes - or, more in general, in addresses - about which you don't know (and don't want to know) a thing, in 99.9% of applications you aren't going to need a complex class hierarchy for zipcodes, but you are best served by the exact opposite choice, i.e. a plain string without particular constraints. Commented Dec 5, 2019 at 0:19