I think this is a neat way of encoding things. But this also has a lot of shortcomings that existing mailing addresses don't have; it's really only useful for identifying a physical spot, which is what a lat/long and geocodings of mailing addresses will do anyway.
Additionally: * What if you live at an apartment? * What if your address doesn't correspond to a fixed physical location, like an APO? * Aren't the city and country redundant if you have a physical lat/long location? Still, we need to look at how we send information to our fellow humans. Addresses are important and I'm glad folks like the OP are taking a closer look.
I think a couple changes would be required to address the shortcomings:
apartments need a z value as you already have a x and y - of course you need to account for height above sea level if you keep to the same type of measurement as lat and long (rather than just saying floor 2). It could be tricky for someone to sort that out for themselves. I'd think a prefix on the address could indicate a special case that needs to be handled differently to fix APO etc. I played with the demo, it seemed like the city/county operate as a checksum so you can verify the location you've decoded. Its not needed but nice to have
Thanks, yes, I'm ashamed of my code, this is my first project in ruby , my last programming work was 15 years ago, (Foxpro for DOS) so this is my comeback to programming.
I hope that being opensource will help it to improve.
No sweat, man. You are new to the language and you're putting yourself out there. Major kudos for that.
Now, for some low hanging fruits / pointers: - $name is a global variable. Virtually unused in idiomatic Ruby. - @name is an instance variable. So it's perfectly ok to use it... within a class. - You should omit the 'then' after each if. - I'd use find_words rather than busca_palabras. - Except for rare edge cases, you can drop the .nil? from if my_var.nil?. If my_var is nil it will on its own make the condition false. - I would use more spaces. 'a = 1' instead of 'a=1', 'b == 0' rather than 'b==0'. - Use indentation consistently. 2 spaces. - The else clause is indented at the same level as the leading if. - Use && instead of 'and' in conditionals. Likewise || instead of 'or'. These short circuit the evaluation for you. So if the first argument is false && won't bother evaluating the second argument. Likewise, if the first argument is true
|| won't bother executing the second argument as it doesn't matter. - Ruby is an Object-Oriented programming language. I would look into modules and classes to restructure the code in a less procedural way.
I realised when I was living in Japan recently how much I miss the UK postcode system. When I'm in the UK I can give anyone a short alphanumeric string and they can find me. A global coordinate system like this is really useful. I hope you can get some traction with it.
Mine is SUPERMAN KRYPTON which I rather like. I could also go with EMERGENCY REBEL, DOUGLAS PHOTOS (I live in an area with lots of Douglas trees), CATATONIC TYRANNOSAURUS, etc.
IMHO the Maidenhead Locator System [1] solves this problem very nicely. Locations are concise and can be specified with arbitrary precision. And the encoding scheme makes vocal transmission quite robust.
Comments (199) 48 threads
Earlier commentsAdditionally:
* What if you live at an apartment?
* What if your address doesn't correspond to a fixed physical location, like an APO?
* Aren't the city and country redundant if you have a physical lat/long location?
Still, we need to look at how we send information to our fellow humans. Addresses are important and I'm glad folks like the OP are taking a closer look.
apartments need a z value as you already have a x and y - of course you need to account for height above sea level if you keep to the same type of measurement as lat and long (rather than just saying floor 2). It could be tricky for someone to sort that out for themselves.
I'd think a prefix on the address could indicate a special case that needs to be handled differently to fix APO etc.
I played with the demo, it seemed like the city/county operate as a checksum so you can verify the location you've decoded. Its not needed but nice to have
I hope that being opensource will help it to improve.
Now, for some low hanging fruits / pointers:
- $name is a global variable. Virtually unused in idiomatic Ruby.
- @name is an instance variable. So it's perfectly ok to use it... within a class.
- You should omit the 'then' after each if.
- I'd use find_words rather than busca_palabras.
- Except for rare edge cases, you can drop the .nil? from if my_var.nil?. If my_var is nil it will on its own make the condition false.
- I would use more spaces. 'a = 1' instead of 'a=1', 'b == 0' rather than 'b==0'.
- Use indentation consistently. 2 spaces.
- The else clause is indented at the same level as the leading if.
- Use && instead of 'and' in conditionals. Likewise || instead of 'or'. These short circuit the evaluation for you. So if the first argument is false && won't bother evaluating the second argument. Likewise, if the first argument is true || won't bother executing the second argument as it doesn't matter.
- Ruby is an Object-Oriented programming language. I would look into modules and classes to restructure the code in a less procedural way.
I realised when I was living in Japan recently how much I miss the UK postcode system. When I'm in the UK I can give anyone a short alphanumeric string and they can find me. A global coordinate system like this is really useful. I hope you can get some traction with it.
More serioulsy. I think there are curated word lists out there without swear words.
Jee, thanks.
ANUS CUFFLINK GRETNA EMPT WAIFS UNAS FUMOTO GUIDOS ASUN GOOFER GANTER ACKNOWLEDGMENTS YOCHEVED OVERCOMETH WIFIE USAN EDICIONES UNDERPOWERED CALIFIORNIA DESPRES
grin
8529 WANT FILTHY
8529 WANT EXPLOSIONS
1: https://en.wikipedia.org/wiki/Maidenhead_Locator_System
All comments shown.
Couldn't load more comments. Check your connection and try again.