Extreme Programming in Perl Robert Nagler phần 6

Tham khảo tài liệu 'extreme programming in perl robert nagler phần 6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | checking and printing are contained in separate routines. Each routine is responsible for one and only one behavior. The localtime and gmtime calls are now in the correct order. This defect in the original version only became apparent to me when I separated the two output lines. Argument type validation is consistent because it has been isolated into a single routine _plan_arg_assert that is used for all three parameters. Several new cases are caught. For example passing undef to tests or passing both tests and test deprecated form is not allowed. Carp croak unrecognized directive warning is printed once instead of a warning per unrecognized directive. The check for unrecognized directives still does not fail fast croak or die . I would have liked to correct this because passing an invalid directives to plan probably indicates a broken test. However the broad user base of Test makes this change infeasible. Somebody may be depending on the behavior that this is only a warning. Two temporary variables @todo and x were eliminated by using a functional programming style. By avoiding temporary variables we simplify algorithms and eliminate ordering dependencies. See the It s a SMOP chapter for a longer example of functional programming. planned was eliminated after _TODO was converted to a reference. planned is known as a denormalization because it can be computed from another value _TODO in this case . Normal form is when data structures and databases store the sources of all information once and only once. _plan_print writes a single string. The seven calls print were unnecessary duplication. I often use logical operators instead of imperative statements to avoid the use of temporary variables which are another form of duplication denormalization . The return value from plan is better represented as an empty return because it handles list and scalar return contexts correctly. This is a subtle point about return and it actually involves an interface change. The .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
84    197    1    21-05-2024
389    178    1    21-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.