thinking in c 2nd ed volume 2 rev 20 - phần 2

Điều cần thiết là một cách để xây dựng mã chống chọi những cơn gió của sự thay đổi và thực sự cải thiện theo thời gian. Cảm nhận thực hành Nhiều nội dung [20] hỗ trợ một motif của bạn nhanh chân, trong đó Extreme Programming chỉ là một. Trong phần này chúng tôi khám phá những gì chúng ta nghĩ là chìa khóa | 53 z 516 that changes today will break what worked yesterday. What is needed is a way to build code that withstands the winds of change and actually improves over time. Comment Many practices purport to 20 pport such a quick-on-your-feet motif of which Extreme Programming is only one. In this section we explore what we think is the key to making flexible incremental development succeed a ridiculously easy-to-use automated unit test framework. Please note that we in no way mean to de-emphasize the role of testers software professionals who test others code for a living. They are indispensable. We are merely describing a way to help developers write better code. Cement Developers write unit tests to gain the confidence to say the two most important things that any developer can say 1. I understand the requirements. 2. My code meets those requirements to the best of my knowledge. There is no better way to ensure that you know what the code you re about to write should do than to write the unit tests first. This simple exercise helps focus the mind on the task ahead and will likely lead to working code faster than just jumping into coding. Or to express it in XP terms Testing Programming is faster than just Programming. Writing tests first also puts you on guard up front against boundary conditions that might cause your code to break so your code is more robust right out of the chute. Comment Once your code passes all your tests you have the peace of mind that if the system you contribute to isn t working it s not your fault. The statement All my tests pass is a powerful trump card in the workplace that cuts through any amount of politics and hand waving. Cement Automated testing So what does a unit test look like Too often developers just use some well-behaved input to produce some expected output which they inspect visually. Two dangers exist in this approach. First programs don t always receive only well-behaved input. We all know that we should test the boundaries

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
170    223    1    22-05-2024
108    168    2    22-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.