by mindhunter on 6/5/12, 2:28 PM with 4 comments
by lnanek2 on 6/5/12, 3:06 PM
package blah1.blah2; class Blah3 { private static final String BLAH_KEY = "blah1.blah2.Blah3.BLAH_KEY"
Which helps a lot when you see the value somewhere else as well. Often if you are told to put some String keyed values into a general purpose message container going to another program, the string keys you use again use values to look like that to avoid collision, as recommended by the Android documentation itself. Similarly used for persisting application values to a single XML file. Then of course we also have technologies like GWT, where programmers write in Java, and it is compiled to JavaScript. I could easily see that generating property names with packages in them.
So anyway, you see dots for sub-objects, but you also see dots simply as part of a way to avoid name collisions, as in Java package naming and sharing String key namespace best practices. Just because it isn't used for sub-objects or method calls or properties doesn't mean it is wrong or bad.
by KyleHill on 6/5/12, 3:04 PM
for(i in x){ console.log(i, "_"); }
as well. That said, this is the worst idea.
by jQueryIsAwesome on 6/5/12, 5:18 PM
x = {}
x[String.fromCharCode(1)] = "1"
x[String.fromCharCode(2)] = "2"
x[String.fromCharCode(3)] = "3"
And obligatory reference to namespace function (to easily create namespaced modules): http://www.codeproject.com/Articles/19030/Namespaces-in-Java...