java
java copied to clipboard
Karls Language introduces multiple concepts
Currently the concept exercise Karls language introduces to the concepts Generics and Lists .
But in the actual exercise you do not have a task regarding the generic concept, it's all focused on lists.
I was thinking that we should create a separate exercise for the concept Generics or add a couple of new tasks to the exercise regarding generics.
Well there are generics in this exercise: the List type has a type argument.
One thing I do agree with is that the exercise could be expand on the generics part a bit, as it currently only works on List<String>. If it also required the student to work lists containing other types, like List<Integer>, it might teach the concept a bit better.
On an unrelated note: I'm not sure why the solution stub already has the private field hard-coded. It isn't required at compile time so it might be giving too much away already.
I was thinking that instead of giving the methods straight away to the student, to have them implement them, and to have them build, expecting that the list is generic. For example:
// instead of giving this
public boolean isEmpty() {
return languages.isEmpty();
}
// make them build this
public boolean isEmpty(List<?> list) {
return list.isEmpty();
}