exercism / exercism/javascript

Windowing System: Improvement Ideas

Đang mở
#1,600 4 bình luận 0 reaction 1 người được giao Được @SleeplessByte nhận Xem trên GitHub
discussion :speech_balloon:
Ngôn ngữ chính
JavaScript
Star
652
Fork
657
Merge trung bình
19 giờ 37 phút
Pull request đã merge (30 ngày)
6

Mô tả

After seeing a couple of solutions to "Windowing System" during mentoring, I think the exercise could need some changes to better achieve it's learning objectives.

* For `Position` and `Size`, the constructor and the method have the same implementation. I saw a solution that used the method in the constructor which is not a very typical example.
* There is no reason to use the methods to update values so students often just set the property values directly.
* The calculation for the window resize and move is rather involved which does not add value for the actual learning objectives but it seems students spend quite some time finding creative solutions there, e.g.
![image](https://user-images.githubusercontent.com/12543047/147859416-62818b06-71c5-4558-ba1e-d08cbda753d8.png)

Some ideas how to improve the exercise:
* Maybe we should expect some/all properties to be marked as private with the underscore to discourage the direct assignment. That might also make it easier to pick up unwanted code with the analyzer later. (Not sure how to best test in this case though. Either the test disrespects the underscore which is not a good example or the test needs to fall back on some user-implemented serialization function. But if that function is wrong all the tests will fail which is also annoying as everything else the user did could be correct.)
* The methods on `Position` and `Size` could change the values by some amount instead of just setting a value. That would make them distinct from the constructor. (Probably only needed if we stick with "public properties".)
* Simplify the window resize/move method e.g. by saying some lower bound is always respected

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.