O'Reilly logo

Oracle® Web Application Programming for PL/SQL® Developers by Benjamin Rosenzweig, Solomon Morse, Melanie Caffrey, Susan Boardman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit 20.1. Designing Code Structures

Reusing Code

You should be thinking as you design your code architecture of how to avoid code duplication. A good example of code reuse is discussed in Chapter 18, “Web Tips and Techniques.” The HTML form code for inserting and updating a student, as well as the JavaScript form validation code, is exactly the same. For insert, the form is empty and the student ID is unknown, while for update, the form fields are prepopulated for the selected student. If the form needs to be changed, then only one procedure has to be changed, in only one place. Whereas, if two separate procedures were created (one for insert and one for update), then the form would have to be revised in two procedures. This increases the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required