EntropySink
Technical & Scientific => Programming => Topic started by: ober on August 15, 2011, 04:42:18 PM
-
Lists can only have integer keys? Fo reals? So I have to use a Map instead?? Who designed these objects??
-
the integer key is the position (index) in the list... any other type and it's not a list, it's a map.
-
Yeah... as a C++ programmer my first reaction was what the hell is PHP doing allowing non-integer keys to a list. (And why is it called a list anyway, isn't that an array?)
-
That's my point. Java has like 3 or 4 objects where PHP uses one object to do all of them. You can do all of that stuff with an array in PHP.
-
Sorry but the best reason PHP > Java is multi-line string literals.
-
Aren't you guys using Groovy yet? It's time to give it a shot if you're not. JVM life has never been as wonderful.
Join the cool kids.
-
That's not exactly an easy change, unless I'm misunderstanding it. We're not even running the latest version of Java (that's currently on our roadmap).
-
Just started learning Groovy, so far I am a big fan.
-
But, does it have multiline string literals?
-
http://groovy.codehaus.org/Strings+and+GString
-
So kinda, but in a really lame ass way
-
Ober, you might be able to hook in Groovy classes to your project since they get compiled down to class files and are able to be called from regular Java files without impedance.
You can gradually move over without changing the whole codebase. That's the way I started to go with my old Spring/Hibernate projects. Some classes were much easier to write and maintain in Groovy.
And then you get hooked on Grails...
-
I'll certainly bring it up to see if anyone else on the team knows much about it.
-
Lists can only have integer keys? Fo reals? So I have to use a Map instead?? Who designed these objects??
computer scientists! hahahaha...
In PHP you basically have one data structure available: an ordered Hash Map. They term it an array, which can be confusing for people who expect arrays to behave a certain way, since it's not really an array at all.
Java gives you a diverse set of containers to address a diverse set of problems efficiently.
I agree that the syntax for a lot of Java data structure allocation and initialization sucks compared to php (even more so to python, ruby, etc), but that's a different issue...or is it?