PKG-01: Group related data structures and functionality together in a single package.
Even if you don’t take advantage of features unique to packages, such as persistent data, you can still use packages to organize—and store together—related code and data structures.
Without packages, you might end up with several hundred standalone procedures and functions and many repeated cursor, TYPE, and variable declarations.
A package gives a name to a set of program elements: procedures, functions, user-defined types, variable and constant declarations, cursors, and so on. By creating a package for each distinct area of functionality, you create intuitive containers for that functionality.
As I go about building a library management system, I quickly identify the following functional areas:
Maintain underlying table, establish rules about who is a valid borrower.
Maintain underlying table, define validation for ISBN, and so on.
Maintain underlying table that tracks who took out what and when.
Collection of all formulas and business rules for processing overdue charges.
Maintain underlying table and collect all rules governing how a borrower can reserve a book.
Maintain underlying table.
I can now create separate packages for each bunch of data or functional specification. For example, the overdue package would contain all programs related to calculating and displaying ...