Oracle PL/SQL for dummies phần 6

Tham khảo tài liệu 'oracle pl/sql for dummies phần 6', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 202 Part III Standards and Structures__ many years in a system. In the Y2K year 2000 crises that hit the software industry in the late 1990s millions of lines of COBOL code used a 2digit field for the year. When the calendar rolled around to 2000 all that code was going to stop working. No one worried about this problem when the code was written in the 1960s and 1970s up to 40 years previously . Count on the fact that the code you write will still be in production long after you retire. Standards can decrease the cost of the initial code development. Well designed code is easier to write and debug. When programmers follow standards they can more easily find errors debug code while testing and maintain code by quickly zeroing in on the problem spots. Universal Truths Developers can disagree about the right way to do things. However the following guidelines are well accepted as good coding practices by most senior developers even though many of these guidelines might not be very carefully followed . These standards aren t unique to PL SQL. Any programming language code should also follow these rules. Don t hard-code any constant value Never reference a constant in your code. This is especially true if the value is already stored in the database. For example if you have special code that you need to execute for employees who live outside the United States and you have a column called country_cd that refers to the country USA in your EMPLOYEE table you could create a constant that could be referenced throughout the application. As a result it might be reasonable to consider these as global constants. Without the idea of such global constants your code will look something like the examples in Listings 9-1 and 9-2. Listing 9-1 Hard-Coded Data Value declare cursor c_employee is select emp_id name from employee where country_cd USA 6 begin Chapter 9 Creating Coding Standards 203 for r_employee in c_employee loop -- process .

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