Description
Initially suggested in #117, we've been adding these stub lib.rs
files to most of our recent exercises. I'm still not sold on them, and I wanted to see what other people think.
In the current Maintaining a Language Track document it is suggested that we:
improve the test suites to avoid pushing people towards specific solutions
Which I fully agree with. And I think that stub files also push people towards specific solutions.
Take, for example, Space Age. The test API is generic enough
let duration = Duration::from(1_000_000_000);
Earth::years_during(&duration)
There's more than one way to solve this.
But then the stub file tells students to use Traits. Which they do. I don't think I've seen a solution that removed the Trait.
In Triangle, a possible stub file would be:
pub struct Triangle;
impl Triangle {
pub fn build(sides: [u16; 3]) -> Result<Self, ()> {
unimplemented!()
}
pub fn is_equilateral(&self) -> bool {
unimplemented!()
}
pub fn is_isosceles(&self) -> bool {
unimplemented!()
}
pub fn is_scalene(&self) -> bool {
unimplemented!()
}
}
Which leaves the student with very little to do. The design of the code has already been done. Students are not likely to take this stub and write a solution that uses Enums, Traits or Boxes. Solutions using those approaches are interesting to write and discuss.