tailieunhanh - The book of visual basic 2005 net insight for classic vb developers 2006 - phần 6

Trong phần trước, bạn đã thấy một lớp trừu tượng có thể cho phép bạn chia sẻ mã với các lớp khác nhau có nguồn gốc, trong khi còn lại một cách an toàn không hoạt động. Các lớp trừu tượng cũng đóng một vai trò như là các mẫu lớp học | 8 BUG PROOFING Bugs flaws in a program s logic design or syntax have crashed everything from personal computers to a 125 million Mars orbiter. This chapter examines how you can code defensively restrict possible problems and protect yourself from bugs. You ll also learn how to handle common problems by using Visual Basic 2005 s structured exception handling which replaces the well-worn On Error Goto statement of classic VB. This error-handling infrastructure allows you to filter out specific errors pass error information in exception objects and deal with exceptions in deeply nested code. Traditional VB error handling used a sort of traffic redirection to deal with problems. That made it very difficult to isolate error-handling code from application code and the resulting spaghetti-like tangle could actually make errors more likely. VB 2005 exception handling works like a handcrafted net. You design this net to catch specific error types and then handle them appropriately if they occur. Of course even the best error-handling methods won t stop every potential problem. Eventually a bug will slip into your program producing an error that you can t fix or generating results that just don t make sense. VB 2005 continues to offer the wide range of debugging tools found in earlier versions of Visual Basic with some additional refinements. In this chapter you ll learn how to use these tools to track down and exterminate any bug that s loose in your software. You ll also learn some debugging techniques that will help you peer into the low-level gears and wires of your applications and uncover what s really taking place while your code executes. New in .NET Visual Basic has always provided a rich set of debugging tools and these tools are still available in VB 2005 with a few helpful tweaks and improvements. The real story however is the error-handling syntax that modernizes VB to match other .NET languages. Some of the changes you ll see in this chapter include Structured

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.