Pain points when teaching lists before arrays (was: IO.println behavior on char[])
Cay Horstmann
cay.horstmann at gmail.com
Mon Jun 30 12:07:28 UTC 2025
Il 29/06/25 17:51, Brian Goetz ha scritto:
>
>
>> I agree,
>> arrays are fully weird in Java, they don't behave like proper objects (no equals/hahCode/toString), they have a weird hierarchy, they are always mutable and they do not work properly with generics too.
>>
>> So they are not simple to use, they are low level primitives, not something you do not want introduce early in the learning process.
>
> Preach it, brother!
>
> I understand the tendency to want to teach "from the ground up", but starting with arrays (like with static methods) is just teaching habits that need to be unlearned.
>
Indeed. Start with lists. Familiar method calls instead of [] notation. size() is more regular than length. No special initialization syntax to learn. No "partially filled" arrays.
A few pain points:
- new ArrayList<T>(List.of(...))
- Some [] in beginning student subset (command line args, String.split, ...)- No List<int> (yet)- List<List<T>> significantly less pleasant than T[][]
Cheers,
Cay
--
Cay S. Horstmann | https://horstmann.com
More information about the amber-dev
mailing list