On 5/26/06, Robert Klemme <shortcutter / googlemail.com> wrote: > > I am arguing against your statement that Java's design is negative > because it contains so many collection classes. And I was pointing > out that Java's multitude of collection classes is not caused by > static typing. I still don't see that static typing causes this, maybe > you can shed some more light on this. My declaration that Java's design is negative was made as compared to Ruby. After 10 years of Java development and 5 years of Ruby development here is what I feel in regards to data structures: in a situation where one might choose to code something in Ruby or Java (because their uses don't always overlap), the simpler choices Ruby provides in data structures will speed up development. There will not be a need to think about exactly what data structure you need in Ruby (beyond choosing Hash or Array) because most of the time it does not matter. Maybe this only applies to small scripts where just getting it working is the most important thing. In large scale development it may be moot, and that is probably where Ruby's simpler choice in data structures might lack (but I'd argue that is not guaranteed to happen all the time.) For the sake of bringing this discussion to a close, I will retract my statement about Java's static typing causing so many data structures. It seems it was really a design choice and the typing didn't affect it too much. Though I think the plethora of classes is a result of a certain design philosophy that comes from static typing (this may seem contradictory to the previous sentence but I think I'm just having a hard time articulating my point.) As a counterexample I would be curious to see a dynamically typed language which has such a huge variety of collection classes built into the language or standard library. > Choosing data structures is not only about performance. It's about > functionality and also documentation - if I need a set I choose Set, > if I need a map I choose Hash, if I need a stack or list I choose > Array... And it doesn't take me much "drilldown" time to determine if > I use a set or a list. In Ruby, of course it doesn't take long. And don't expect me to argue that you never need to choose between a Hash or Array or Set, that is just silly. You have to at least choose that, of course. But then in Java you need to decide if you are going to use a HashSet or a TreeSet or a LinkedHashSet or maybe an ArrayList but then there is LinkedList but of course also HashMap or TreeMap or LinkedHashMap, plus PriorityQueue. Having a lot of choices will always slow a human down. Maybe where you work speed of development does not matter, but for me it is important. > I don't think agile methodologies make the distinction between sets > and maps or sets and arrays superfluous... I never said it did. I'm mostly speaking about the second level you get in Java: ArrayList versus LinkedList, HashMap versus TreeMap, etc. But when you are coding Java I guess you are just used to that. I'd rather code Ruby. Ryan