72Miles

Recent News

Archives

May 15, 2008 @ 9:18 pm

Squash those Cyles

Two packages are said to be involved in a cyclic dependency when package A depends on package B and package B depends on package A. This is called a direct cyclic dependency. Cyclic dependencies are created in various ways at different layers within a software system. It’s also possible for a cyclic relationship in one layer to cause cycles in another.

cycles

Cyclic dependencies hurt a software system’s goals:

  • Understandability Understandable software is critical in managing complex systems. Software that is easily understood acts like a bridge between the problem and its solution.
  • Flexibility
  • Modularity An approach to developing software that breaks projects into smaller units designed so that they can work with other sections of the program. Modifying the way that modules work will have no adverse affects on the other components of a program
  • Modifiability Modifiability is controlled change to the system in which some parts are altered without increasing the complexity or obscuring the logic of the original structure.
  • Reliability Reliability is the extent to which a software yields consistent, stable, and uniform without any human intervention and is crucial for any software system that must operate for long periods.
  • Maintainability The ease with which a software system can be modified to change or add capabilities, improve performance, or correct defects.
  • Testability The degree to which a system or component facilitates the establishment of test criteria and the performance of tests to determine whether those criteria have been met.
  • Reusability
  • Clarity

By using Architecture Rules to Assert your Architecture, you are taking the first step in developing a strong architecture by actively managing package relationships.

Aside from the adverse affects on the software development goals, cyclic dependencies create these negative consequences for the system:

  • Diminish the ability to determine a package’s purpose.
  • Changes impact seemingly unrelated components of the architecture.
  • Separation of layers.
  • Packages cooperating in a cycle must be released as an atomic unit.

Determine a Package’s Purpose

When future developers come along to maintain the software the presence of cycles can diminish the ability for that developer to determine a package’s purpose. This hurts the software’s clarity and understandability. The end result will be the introduction of bugs, or an increase in the amount of time required to modify the software.

Changes Impact Unrelated Components

When a class involved in a cycle is modified, it could change the bahavior of the other class involved in the cycle. This makes it difficult to accurately assess and manage the impact of changes to the system. This directly hinders the modifiability of your software. Reliability is also attacked since changing the behavior of an unrelated class could introduce a bug.

Affecting other components also introduces a maintenance and testing issue, since you can’t do anything to either class without possibly affecting the other. A situation exists where class A needs to compile against class B, but class B needs to compile against class A.

Separation of Layers

Most architectural approaches recognize the advantages of layered architectures. For example, if you develop a presentation layer, a business or logic layer, and a database access layer, you are able to swap out one implementation of a layer for another. Such as replacing a JDBC data access layer with one that utilizes Hibernate, or a JSP presentation layer for a Flash or PHP presentation layer.

Cyclic dependencies across layers couple the layers, defeating the purpose of layering. If a cycle exists between the service layer and the data access layer, then those two layers are no longer interchangeable. Thus, modifiability of the software is lowered. The layers are no longer encapsulated.

Packages Must be Released as an Atomic Unit

The Spring Framework is inspiring when it comes to its modular design. The Spring Framework can be considered as a collection of smaller frameworks. Most of these frameworks are designed to work independently of each other yet provide better functionalities when used together.

This modularity by design, allows the Spring Framework to released as a full framework (spring.jar) or modularly, so that the users can use the features that they are interested, and nothing more (spring-core, spring-ldap, spring-orm, spring-aop, spring-beans, spring-mock, and on and on…). See all of the modules here.

When cyclic dependencies exist, your ability to make and release independent modules is removed. Packages that may not be related must be released as a single jar, or module.

ArchitectureRules wraps JDepend, a java library which is able to identify these cyclic dependencies. Upon detecting a cyclic dependency, a CyclicDependencyException is thrown, a RuntimeException whose message notifies you of which packages are involved in a cyclic dependency:

...architecturerules.exceptions.CyclicRedundancyException:

cyclic dependencies found:
-- test.com.seventytwomiles.services
| |
| |-- test.com.seventytwomiles.dao.hibernate
|
-- test.com.seventytwomiles.dao.hibernate
|
|-- test.com.seventytwomiles.services

When are Cycles Acceptable

Generally speaking, cycles are most always accepted when in the same package. For example two domain objects in the same package, such as User and Account. A User has Accounts, and an Account has a User. Since these two classes are in the same package, the package remains encapsulated.

Filed under Architecture, Architecture-Rules, Open Source, Software Development · No Comments »

April 16, 2008 @ 9:49 pm

Gumby and Architecture Rules

I keep my desk pretty minimal. Its pretty big, but the desktop is usually about 80% cleaned. The few things that I keep on it, other than a notebook and pen, are strategically placed and are designed to be conversation pieces. These items include a 2 gallon fish tank, with a Tiger Barb and plant, a poseable Gumby figure, and the latest addition, my Architecture Rules mug.

Now, the whole reason for these artifacts is to draw those two pass by my desk into a conversation – this offers a break in the day and a chance to get to know the people around me better.

The fish tank has been very popular, a lot of people can relate, or have a story, or just like to look at the fish. Gumby is a lot of fun. Its fun to see those who recognizes him, and those who don’t even know who Gumby is. I wanna order a couple of Blockhead figures to go along side him.

tigerbarb gumby mug

So the new one is the Architecture Rules mug that I designed and put up on CafePress. This has been a great way for me to get the people around me to talk about software, and specifically, about software architecture. I highly recommend that, if you use Architecture Rules, you pick up one of these mugs, put it on your desk, and start telling the world that you are actively mitigating architecture risk everyday. Hey, thats something you, your coworkers, your customers, and your bosses can get behind.

Or, if you’re just looking for a new trinket to put on your desk, this mug is a lot cheaper and easier to maintain than a fish tank is. I have personally tested the mug and had successfully results with coffee, water, various teas, apple cider, and soup.

I have to be honest, the price that CafePress charges, of $13.99, is rather steep for a mug, but it is a tall mug with a capacity of 15 oz., and a buck or so goes to supporting Architecture Rules. Right now we are trying to raise funds to snag the domain architecturerules.com. Your purchase would go a long way in helping to secure that domain.

Here you can check out the upclose graphic. And if you can’t afford the mug, but you wanna help us get the domain or help us towards our current fund raising goal, you might be able to donate some change to the project.

So, what toys do you keep on your desk? What are the best conversation starters? Do you keep any trinkets branded with a tool or technology (my pen branded with Sun Java)?

Filed under Architecture-Rules, Open Source · No Comments »

April 13, 2008 @ 8:35 pm

What is “Architecture”?

The term “software architecture” is really hard to nail down. Different people have been defining it differently since we began writing software. I am not going to be able to tell you exactly what it is, but I can give you an idea as to what people are saying. By understanding that no one agrees on what architecture means, you can throw out the term more carefully as you talk with other developers.

First, I want to share one my favorite “white papers.” I, for many years, didn’t know what people meant when they said architecture (actually, they probably didn’t either) but after reading this 3 page paper by Martin Fowler, I finally wrapped my head around it. The document is titled “Who Needs an Architect” and can be downloaded from the author’s site. The light bulb when on for me when I read these lines…

“Remember Johnson’s secondary definition: “Architecture is the decisions that you wish you could get right early in a project.” Why do people feel the need to get some things right early in the project? The answer, of course, is because they perceive those things as hard hard to change. So you might end up defining architecture as “things that people perceive as hard to change”

“There is no theoretical reason that anything is hard to change about software. If you pick any one aspect of software then you can make it easy to change, but we don’t know how to make everything easy to change. Making something easy to change makes the overall system a little more complex, and making everything easy to change makes the entire system very complex. Complexity is what makes software hard to change. That, and duplication.”

Finally, now that makes sense to me. I’d paraphrase it as “The parts of a software system that you need to get right, the first time.” In the article, there is a discussion about a building. They mention the basement. When you have a home, you can change the interior around, add new paint, take down a wall, put up a wall, even build a new addition. However, the basement is the foundation. It’s not going anywhere. You can modify a house, but you can’t modify the basement. The basement makes up the home’s “architecture,” (but don’t confuse the basement with a database.)

Different people have been defining it differently since we began writing software.

I made this pretty bold statement to start off this explanation. Well, I have the proof to back it up. The Software Engineering Institute has a website. At it, they bring together published Modern, Classic, and Bibliographic Definitions of architecture. They also allow the “community” to submit their own definitions. They have one to two hundred definitions from senior analysts, project managers, software architects, doctors, and other “really important people.” These definitions follow many different themes, from definitions around concrete software, to definitions based on only the concepts of the software. Check out this list of Community Software Architecture Definitions for yourself.

We’ll finish this off by sharing some content off of page 13 of a white paper titled Building Enterprise Architecture from Endava.com

Architecture is defined as a subset of the design. While it is difficult
to define which subset, the following definitions help:

“The highest-level concept of a system in its environment.”
(IEEE)

The organization or structure of significant components, and
their interactions.

An abstraction of a system’s implementation.
The parts or aspects of the design that are considered
important.

The parts or aspects of the design that need to be
understood by many people, the shared understanding of
the system design

The decisions that are (or are thought to be) hard to change.

Another shining example of how many different definitions for Architecture there is.

Want to share your definition? What did you learn architecture to be?

Filed under Architecture, Software Development · 5 Comments »

About

72 Miles Software - open source software, search engine optimization analytics, and software startup information. Software by design. Read More

Categories

Links

Sitemap