Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Re-design `allergies`

Đang mở
#772 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
php
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu bằng cách xem xét bài tập allergies hiện tại, lớp trợ giúp Allergen và các bài kiểm thử sử dụng Allergen trong một dataProvider. So sánh ba đề xuất về enum và kiểu nguyên thủy, sau đó xác định bài tập đã chọn và thiết kế kiểm thử là hoàn tất khi phần triển khai không còn yêu cầu cách tiếp cận lớp trợ giúp có vấn đề.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

The current exercise design has many problems:

  • Students must implement a helper class Allergen that has no TDD style guidance
  • Allergen is used in tests, in a @dataProvider. That gives hard to understand PHP errors in tests only
  • Allergen would not be implemented that way anymore - it is a typical enum class

Problem specifications do not ask for a certain implementation. They define the problem statement as open as possible. Our design also should allow as many solutions as possible.

Suggestion 1: Strings and integers only

This leaves all possibilities open. Mentors can suggest enum or such to students. But enum is optimal for interfaces, internal enum usage just complicates things.

Suggestion 2: Provide enum stub

In addition to the tests from problem specifications we test the enum implementation first. When that is implemented, the actual problem is tested for. In these tests we must use the enum type, too (like Allergen now).

This forces students to use enum. It raises the bar for students not familiar with that. But enum would be a good choice in a real life scenario.

Suggestion 3: Provide ready-made enum

As before, this forces students to use an enum type. But the level of required knowledge is lower (only usage is required). But still, it makes no sense to work with other types internally then.

Which way to go? Other suggestions?

Ngôn ngữ chính
PHP
Star
167
Fork
150
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
7

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của exercism/php

Tất cả issue của exercism/php

Issue tương tự

Thêm issue về PHP

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.