TAILIEUCHUNG - SQL PROGRAMMING STYLE- P13

SQL PROGRAMMING STYLE- P13:Im mot trying to teach you to program in SQL in this book. You might want to read that again. If that is what you wanted, there are better books. This ought to be the second book you buy, not the first. I assume that you already write SQL at some level and want to get better at it. If you want to learn SQL programming tricks, get a copy of my other book, SQL for Smarties (3rd edition, 2005). | Use Classic Structured Programming 157 2. Selection. A Boolean expression determines which one of two blocks of statements is executed. In SQL PSM this is shown with the keywords IF . THEN . ELSE . END IF and in proprietary 4GLs with IF . THEN . ELSE . or IF . ELSE . but syntax is always enough alike not to be a problem. 3. Iteration. A block of statements is repeatedly executed while a Boolean expression is TRUE. In SQL PSM this is shown with the keywords WHILE . LOOP. END WHILE and you will see WHILE. DO. keywords in many products. Again various products are always enough alike not to be a problem. The important characteristic of all of these control structures is that they have one entry and one exit point. Any code written using them will also have one entry and one exit point. You do not use a GO TO statement in classic structured programming. Some languages allowed a RETURN statement to jump out of functions and set the value of the function call. Some allowed a switch or case expression as a multiway selection control statement. But by sticking as close as possible to classic structured programming your code is safe verifiable and easy to maintain. Cyclomatic Complexity So is there a heuristic for telling if I have a bad stored procedure There are a lot of metrics actually. In the 1970s we did a lot of research on software metrics and came up with some good stuff. Here is one that can be computed by hand when you have short procedures to measure. Tom McCabe 1976 invented the cyclomatic complexity metric. The score is basically the number of decision points in a module plus one or the number of execution paths through the code. Decision points are where a flow graph of the procedure would branch. In a well-structured 4GL program the keywords of the language will tell us what the decision points are. For us that means IF WHILE and each branch of a CASE or SWITCH statement if your 4GL supports that feature. If the module has a score of 1 to 5 it is a

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.