advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Tutorials : Designing Packages for Stability :

Stable Dependencies Principle (SDP)

The dependencies between packages should be designed always with stability in mind. A package should only depend on packages that are more stable than itself.

It is impossible to come up with a design that is static and unlikely to change. All the software modules undergo changes. The aim is to create scopes for these changes without causing the existing clients to break. When you decide to place a class within a certain package, the question you need to ask is if this class will need some change and how the change is going to impact the whole system. Another good question is if this class depends on other classes from other packages? If yes, then how it will be affected by changes in those packages.

With the idea of stability and the change-impact relationship factors in mind, we can conclude the following:

Packages that may undergo changes frequently should be less stable packages. This means that fewer packages (ideally none) should depend on these packages. Packages that are not likely to change very often should be designed as more stable packages. This implies that other packages can safely depend on these stable packages.

Consider an example package dependency depicted in Figure 2.

Figure 2. The Stable Package Concept

In this case, the package "parser" contains classes implementing the parsing of different data formats such as XML data etc. In most cases, the parsing implementations are likely to be stable. Thus other packages such as "trader" and "registration" can depend on "parser" package, which is more stable.

The Stability Metric

The question is how do we know that we have arrived to the correct package design that is compliant with SDP? One way to measure the stability factor of any package is based on the incoming and outgoing dependencies for a particular package. Consider this example of package dependency in Figure 3.

Figure 3. Package Dependency Diagram

In this diagram, package A, B and C has outgoing dependencies on package D. The package D has outgoing dependency on package E.

The formula for calculating the stability factor is:

I = Ce/(Ce +Ca)

Where

Ca is the number of incoming dependencies for a particular package.

Ce is the number of outgoing dependencies for a particular package.

I is the stability factor.

As I approaches 0 the package becomes more stable because this implies that Ce is 0 and there is no outgoing dependency at all. On the other hand, if I approaches 1, the package becomes more unstable.

In our example, for package D:

Ca = 3, the number of incoming dependencies

Ce=1, the number of outgoing dependencies

So I = 1/(1+3) = 0.25.

Whereas for package A,

Ca = 0, the number of incoming dependencies

Ce = 1, the number of outgoing dependencies

So I = 1/(1+0) = 1

This result implies that package D is more stable than package A. This also implies that package A is easier to change than package D.

The SDP says that packages with less stability should depend upon the packages with more stability. In other words, if package X has stability factor s1 and package Y has stability factor s2, then package X should depend on package Y if s1>s2.

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 Microsoft Visual Studio 2010 Showcase
 Avaya Developer Showcase
 MSDN Spotlight
 PHP for Windows Showcase
XML error: undefined entity at line 39
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Windows 7: From Beta to Final Code in One Year
Google Shows Off Chrome OS, Releases Source
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?
Fedora 12 Takes Aim at Linux Networking
Top Supercomputer Nearly Doubles in Speed
Fedora 12 Linux Tackles Virtualization
Apple Gives iPhone Developers App Status Tracker
Novell Sets OpenSUSE 11.2 Free

Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Exploring HTML 5's Audio/Video Multimedia Support
Overriding Virtual Functions? Use C++0x Attributes to Avoid Bugs.
Understanding the Cloud Computing Security Vulnerabilities
Cisco and IBM Target a Greener World
Upgrade to Visual Studio 2010 with the Ultimate Offer

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs