Re: Packages - for real or just gimmick?
- From: "Barry" <bbulsara23@xxxxxxxxxxx>
- Date: 4 Jun 2006 23:44:03 -0700
DA Morgan wrote:
Steve Howard wrote:
ds_lewis@xxxxxxxxxxx wrote:
I'm a newbie to Oracle. I walked onto a contract job where they are
just switching to Oracle and I'd like to help them get started off in
the right direction.
Do packages really provide something valuable from a design
perspective? I've seen some example code but the descriptions have
been somewhat vague as any actual benefits from using packages.
Thanks,
Targus
The biggest benefits to me are the following:
1) Data/method hiding. It allows you to hide data (variables) and
methods (procedures/functions) that are only needed by something else
in the same package. You don't have to expose them to the world if it
doesn't make sense to do so.
2) You can recompile the body of the package, and not invalidate
objects that depend on the package specifcation. The only time you
invalidate dependent objects (requires recompilation) is when you
recompile the specification.
HTH,
Steve
When I think of packages there are a lot of things I think of but the
two items you list are the minor ones. When I think of the real value
of packages it is:
1. All related code in a single object
2. All related code loaded into memory simultaneously
3. Session global variables and types
4. Single object compilation
5. Variables persist for term of session
6. Initialization section
7. Overloading
8. Fewer objects to manage and grant/revoke privileges
--
Daniel A. Morgan
University of Washington
damorgan@xxxxxxxxxxxxxxxx
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Very well put Daniel. When I think of package, in my minds eye view I
also think of a "namespace", eg schemaname.packagename.methodname. As
you point out, methodname in a package (namespace) can be overloaded,
something you just can't do with a proc/function outside a package, and
the same methodname can exist in multiple packages, also something you
just can't do by creating a proc/function outside a package. So very
much like a class hierarchy/namespace metaphor to me.
Barry
.
- References:
- Packages - for real or just gimmick?
- From: ds_lewis
- Re: Packages - for real or just gimmick?
- From: Steve Howard
- Re: Packages - for real or just gimmick?
- From: DA Morgan
- Packages - for real or just gimmick?
- Prev by Date: Re: getting backup job status in 9i
- Next by Date: Re: getting backup job status in 9i
- Previous by thread: Re: Packages - for real or just gimmick?
- Next by thread: Re: Packages - for real or just gimmick?
- Index(es):
Relevant Pages
|