Paul Doyle - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Paul Doyle

Description:

Import The package user imports security, so classes in users may use public ... Import Package Example. Systems Analysis. Users ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 18
Provided by: Pau8172
Category:
Tags: doyle | paul | reimport

less

Transcript and Presenter's Notes

Title: Paul Doyle


1
Paul Doyle April 2008 DT211 Year 3
2
Package Design Diagram Techniques
3
What is a Package
  • Classes are not sufficient to group code
  • Some classes collaborate, implying dependencies
  • Some don't know each other
  • A package is a group of classes
  • Classes in a package are often compiled together
    into a library, but unit of compilation is mostly
    individualclass
  • A package is a unit for testing
  • A package can be a releasable component

4
Dependencies in Packages
  • Dependencies between elements are an important
    aspect of any system design result in coupling
    between elements and determine the scope of the
    impact of the changes
  • Reasons for existence of dependencies
  • Elements in packages send messages to elements in
    other packages
  • Class in a package may have another class in a
    different package as part of its data
  • Class in a package may mention another class in a
    different package as a parameter to an operation

5
What is a Package
  • Security
  • Utils
  • Search
  • Account

Utils
Security
Search
Account
6
Package Notation
  • Different ways to show the same thing
  • Classes within packages

Security
Security
Credentials
IdentifyVerify

Credentials
IdentifyVerify
7
Package Notation
  • Packages can contain other packages
  • They can be deeply nested

acme
Search
Indexing
8
Package Notation
  • Nested packages imply inheritance
  • Not always implemented in reality

acme
Search
Indexing
9
Package Notation
  • Element visibility
  • MD5Crypt is a private class in security

Users
Security
visible
Credentials
User
visible
IdentifyVerify
- MD5Crypt
NOT visible
10
Package Dependencies
  • Package A depends on Package B
  • Class in one package used class in another
  • Element in A uses element in B

A
B
11
Packages in Software
  • Dont need them in small programs
  • Larger projects can assign owners to packages
  • Can help understand impact of changes
  • Provides levels of independence
  • Helps provide a high level view of systems

12
Package Example
Search
Indexing
Utils
GUI
Account
Security
Users
13
Package Example
The package user imports security, so classes in
users may use public classes in security without
having to specifiy the package name
ltltImportgtgt
Security
Users
14
Package Example
The users package imports only the credentials
elements from the security package
Security
Credentials
ltltImportgtgt
Users
IdentifyVerify
- MD5Crypt
15
Package Example
Private visability causes a class not to be seen
even through Its package is imported
Security
Credentials
ltltImportgtgt
Users
IdentifyVerify
- MD5Crypt
16
Package Example
  • Package B imports C and access D
  • B can see public elements in C and D
  • A Imports B so A can see public elements in B
  • A Can also see public elements in C because C is
    publicly imported into B
  • A cannot see anything in D because D is privately
    imported into B

ltltImportgtgt
C
A
ltltImportgtgt
B
D
ltltAccessgtgt
17
Package Example
  • Highly dependant indicates poor structure and
    brittle software

A
B
D
C
Write a Comment
User Comments (0)
About PowerShow.com