Mohsen Vakilian's Blog

June 25, 2007

Active Documentation

Filed under: architecture — mohsenvakilian @ 7:48 pm

Documentation can become a risk in a software project!
If you don’t know the real benefit of the document, or if its contents aren’t useful for anybody, then what is the value of that document?
Software Architecture in Practice
I have read more than one third of SAIP. Now, if somebody asks me about the most interesting concept I have got from it, I would say Software Architecture Evaluation!

Assume an active discussion between the architect and stakeholders in ATAM or CBAM methods. Everybody announces his expectations from the software. Then, a list of quality attributes comes out by stakeholders’ votes based on the cost and priorities of quality attributes. Finally, a report of the whole session comes out. This is the result of an active discussion. This is the kind of documentation that will talk lively to its future readers.


June 18, 2007

Hierarchical Tagging

Filed under: technology — mohsenvakilian @ 1:11 pm

Do you usually tag your data (bookmarks, emails, …) with multiple labels?
Sometimes, it’s because of the different aspects of the contents.
However, there are cases where some labels are redundant as they all can be inferred from a single label.

An Example: When I was looking for some RSS reader applications, I used Google Bookmarks (which I call “GMark”) to bookmark the applications I found. I wanted to have distinct labels for web-based and rich client applications. So, I tagged them with the labels “Web.RSS Reader” and “Rich Client.RSS Reader”. But, this way, I won’t be able to get a list of all RSS reader applications by clicking a single label!

In the following, I will present two solutions I could think of:

Hierarchy of Labels for RSS Reader Applications

Solution 1: A Bookmarking application can allow creation of hierarchical labels. That is, creating a label like “Web.RSS Reader” which is inherited from another label named “RSS Reader”. This way, tagging an item by “Web.RSS Reader” will tag it implicitly by “RSS Reader”.

Solution 2: A Bookmarking application could let users make a query based on labels. That is, to ask for all items tagged with labels of the form “*.RSS Reader”.

Now, let’s compare these two solutions. There is a subtle point in the second solution and that is the careful use of dot notation in naming labels. This notation carries the concept of inheritance implicitly, doesn’t it?
I myself prefer the second solution because of its simplicity. Hierarchies, inheritance and abstractions are more complex concepts attractive to mathematically biased minds such as mine—the engineers’ minds! Therefore, I believe, it would be better to provide people with simple solutions though they might not be elegant from a mathematical point of view.
Although abstraction plays an important role in computer science, I believe it doesn’t have to play such a big role in our everyday lives. Anyway, I don’t want to talk philosophically. But, I might write about abstraction later!

June 15, 2007

Performance Test Scripts

Filed under: performance — mohsenvakilian @ 3:09 pm

Performance Analysis for Java Web Sites

Have you ever had to write test scripts for performance testing your web application?
If so, I recommend you to read the seventh chapter of the book entitled “Performance Analysis for Java Web Sites“.

What do we mean by a good test script?
A test script results in a valuable performance test when it models the real users’ behavior correctly.

In the chapter entitled “Test Scripts”, the authors explain how to develop flexible and dynamic test scripts. Then, they talk about building test scenarios out of test scripts using weights to better model the usage pattern. At the end, they list some of the common pitfalls many test scripts suffer from.

In my opinion, the most challenging part of developing a performance test script is adding the dynamicty of real users to our virtual users. This dynamicity requires an intelligent performance tool which can dynamically decide what to do in each state. Several performance tools such as LoadRunner and SilkPerformer have tried to provide this dynamicity and parameterization by modifying the generated test scripts. But, it seems that they are far from a mature, easy to use, and intelligent performance test tool.

A Good Example of friend!

Filed under: design — mohsenvakilian @ 2:47 pm

What do you say if somebody comes to you and says: “What’s this ugly friend keyword in C++ for?” or “What is the real use of Java’s package access?”

Here is an elegant example: The State Design Pattern! You may take a look at the class diagram of its structure in my previous post.

If you want to distribute the state transition logic among State subclasses, you have to define a “changeState()” method in Context.
This method has to be private in C++ and Statehas to be declared as a friend of Context. Also, in Java, you can put the State and the Context classes in the same package to use the package access.

The Similarity Between State and Strategy Design Patterns

Filed under: design — mohsenvakilian @ 11:48 am

They are quite similar! Just take a look at the class diagrams of Strategy and State design patterns, below.

Class Diagrams of Strategy and State Design Patterns

So, why have GoF separated them as two distinct design patterns?

First, let’s explore the similarities a bit more. Both have a concept of delegation to an abstract class which is an interface to a hierarchy of different subclasses.

I think the main difference among these patterns is the different contexts in which they are used. Even though the class diagrams of these patterns resemble a lot, their intents are completely different. The State design pattern is used for objects having different states in their lifetime where the objects exhibits different behaviors in different states. On, the other hand, the Strategy design pattern is used for customizing an algorithm by passing an object as a part of it.

Another difference is the lack of the concept of transitions in the Strategy design pattern. In fact, Strategy is not as dynamic as State. So, the need to change the reference to its object isn’t strong.

In spite of the similarities between several design patterns, I believe that drawing such relationships and abstractions among these patterns is quite useless! In fact, nobody sees any strong similarity between Strategy and State design patterns normally.

June 10, 2007

Grady Booch—The Promise, The limits, The Beauty of Software

Filed under: architecture — mohsenvakilian @ 11:08 am

I’m sure no body needs introducing Grady Booch.

Here is an interesting talk by Grady. I strongly recommend all those interested in software to watch this video.

It’s interesting that he several times mentions the fact that the code doesn’t necessarily reflect some of the design decisions that shaped that code. In fact, it’s one the most important motivations to go through the process of software architecture documentation.

He talks about the declining number of people graduating in computer science and asks how to express an excitement for the people who follow us the beauty and elegance of what we have done. Somehow, he answers this at the end of his talk by saying “What other industry can you think of that has transformed civilization as much as ours has?”

Afterwards, his talk evolves around the contradictions of our software world. The following is the contradiction which attracted me the most:

“Email and other software-intensive mechanisms increase the velocity of communication. But, on the other hand, email and the aging of digital archives threatens the preservation of history”

Then, he explains his fundamental questions from software organizations when he has to get a smell of them:

  1. Do you have a release plan?
  2. How frequent are your releases?
  3. Do you have an architect?
  4. Do you have a culture of patterns?

Grady points out the importance of organization and recommends the book: Organizational Patterns of Agile Development

Organizational Patterns of Agile Development

At last, he mentions the characteristics of hypo productive architectures:

  1. Crafting crisp and resilient abstractions
  2. Maintaining a good separation of concerns
  3. Creating a balance distribution of responsibilities

June 7, 2007


Filed under: performance — mohsenvakilian @ 4:50 pm

As my BS project is about performance analysis of Web based applications, I have become too curious about performance stuff these days.

Recently, I watched a video interviewing Jim Kelly about “performance monitoring”. Here, I have brought the points interesting to me in his talk.

Glassbox is an Open Source project for diagnosis of performance problems built on aspect-oriented programming that interfaces with your JVM and looks for commonly occurring problems. The tool instruments the Java Code to look for precisely top ten things that break most applications. The main advantage of Glassbox is eliminating the burden of examining horrible log files generated by most performance diagnosis tools.

“There is a rule that the person who wrote the code should not be the one to test the code because you tend not to see it very objectively, and I think the same thing is true of cracking down performance problems that even if you are aware of problems at some level, you may not be able to call those out.”, said Jim Kelly.

I quite agree with Jim on the psychological block he points out. I have felt the same in several of my debugging experiences.

At last, Jim gives some advice to those facing performance problems at the time. It’s interesting that his advice is somehow psychological, too. The following is the advice:

“Don’t panic because I think all the problems get harder as soon as you get a lot of people involved and as soon as you lose your ability to think very carefully about the data you are seeing.”

June 5, 2007

Hello world!

Filed under: general — mohsenvakilian @ 2:55 pm

Welcome to my first experience of blogging!

I hope to make this blog as useful as possible for all people interested in software engineering stuff.

Blog at