Featured Post

The great debacle of healthcare.gov

This is the first time in history when the president of the United States of America, or probably for any head of state around the world,...

Saturday, June 28, 2008

Capability Maturity Model (CMM) goals - quick reference

The goals to achieve a CMM level is summarized for quick reference:

CMM Level 2 (Repeatable)

Projects in Level-2 organizations have installed basic software management controls. Realistic project commitments are based on the results observed on projects and on the requirements of the current project. The software managers for a project track software costs, schedules, and functionality; problems in meeting commitments are identified when they arise. Software requirements and the work products developed to satisfy them are baselined, and their integrity is controlled.

Key Process Areas (KPA)

  • Requirement Management
  • Software Project Planning
  • Software Project Tracking and Oversight
  • Software Subcontract Management
  • Software Quality Assurance
  • Software Configuration Management

Goal 1: System requirements that are allocate to software are controlled to establish a baseline for software engineering and management use

Goal 2: Software plans, products, and activities are kept consistent with the system requirements allocated to software

Goal 3: Software estimates are documented for use in planning and tracking the software project

Goal 4: Software project activities and commitments are planned and documented

Goal 5: Affected groups and individuals agree to their commitments related to the software project

Goal 6: Actual results and performances are tracked against the software plans

Goal 7: Corrective actions are taken and managed to closure when actual results and performance deviate significantly from the software plans

Goal 8: Changes to software commitments are agreed to by the affected group and individuals

Goal 9: The prime contractor selects qualified software subcontractors

Goal 10: The prime contractor and the software subcontractor agree to their commitments to each other

Goal 11: The prime contractor and the software subcontractor maintain ongoing communications

Goal 12: The prime contractor tracks the software subcontractor’s actual results and performance against its commitments

Goal 13: Software quality assurance activities are planned

Goal 14: Adherence of software products and activities to the applicable standards, procedures, and requirements is verified objectively

Goal 15: Affected groups and individuals are informed of software quality assurance activities and results

Goal 16: Noncompliance issues that cannot be resolved within the software project are addressed by senior management

Goal 17: Software configuration management activities are planned

Goal 18: Selected software work products are identified, controlled, and available

Goal 19: Changes to identified software work products are controlled

Goal 20: Affected groups and individual are informed of the status and content of software baselines

Saturday, June 7, 2008

JEE software development estimation

Software estimation is one of the key as well as mystifying subject area in software engineering. There is an ongoing debate between two groups whether developing a software is an engineering discipline or a liberal science. The group that claims that software development is a science often put on the proof of it's inaccuracy in estimating a software development, consistently over the period of time.

There are several well known software estimation techniques or models like Line of Code (LOC), Function Point Analysis (FPA), COCOMO and some others. I've studied few of those estimation process but found overly complex to its value proposition or, to some extent, irrelevant to the projects that I was involved so far in my professional career. Most of my prior software development projects are based on J2EE and to develop Financial and CRM solutions. May be those estimation models are useful for many projects but at least I didn't find those very useful or cost effective in my projects. But I'm no way claiming those models or process as not useful.

In my projects I've been using some of the very straight forward and simple techniques to estimate the development effort (not the entire Software Project through) and those estimations were accepted by the project manager with very minor tweaks. The benefits that I get by using my simpler model are:
  • The ball park figure asked by the project manager (PM) can be provided with a 10-15% error margin
  • If PM asks for the base behind your estimation, you've something to defend your number
  • When your project manager pushes you to include additional feature(s) in the middle of development, you can bargain confidently that is backed by your detail estimation
  • People trust documents rather than your verbal explanation (but it may vary person to person and depends on the image in the team)
The driver behind my estimation model is experience and historical data. The factor I use in the model is mostly based on my experience and also supported by the historical data of the project. So it can't be mathematically or statistically proven but has justification. The factors I used in the model are:
  1. Complexity
  2. Familiarity
  3. Comfort level
  4. Implementation's spreading (number of places in the system the feature would've impact)
  5. New feature
  6. Modification of existing feature
  7. Up gradation of existing feature
  8. Change distribution
  9. Implementation items (e.g. Business Logic class, Data Access class, Utility class, Configuration file, Database table, Resource file, User Interface class/files etc.)
  10. Requirement stability (e.g. clarity)
  11. Unit/Integration/Functional test case development
  12. Buffer zone

Using the past experience in the project, I've given a value to each of the factors mentioned above and finally add-up the the numbers to get the time estimated to complete the feature implementation.

Here is an example of estimation calculation using the above estimation technique:

Initially it was little simpler as below:

C: Type of change (New=1/Upgrade=2/Modify=3)
D: Estimated complexity (Low=1/Medium-2/High-3)
E: Level of comfort (1 - Did similar before/2 - Didn't do but know/3 - First time doing)
F: Num of new view file
G: Num of view files to modify
H: Num of New Business methods
I: Num of Bussiness methods to modify
J: Num of new Dao methods
K: Num of Dao methods to modify
L: Num of new tables
M: Num of tables to modify
N: Change is for (e.g. how many products)

Estimation: C/1.5+F*3+G*1+H*3+I*1.5+J*2+K*1.5+L*3+M*1) *N * D/2

But later I found that the estimation that I was getting out of the formula was giving me the value with wide error margin and also didn't cover some fine aspect of estimation items. So I later refined it as below that worked for me almost with no issues for 6 releases (each release time spans 2-3 months of development and implementation) over 1 and half year

J: Type of Change (New=3/Upgrade=2/Modify=2/NoChange=0)
K: Estimated Complexity (Low=1/Medium=2/High=3)
L: Comfort Level (1 - Done similar before/2 - Have conceptual idea/3 - No idea/It can be fraction value)
M: Num of new view file
N: Num of view files to modify
O: Num of New Business methods
P: Num of Bussiness methods to modify
Q: Num of new Dao methods
R: Num of Dao methods to modify
S: Num of new utility methods
T: Num of utility methods to modify
U: Num of configuration files to modify
V: Num of new tables
W: Num of tables to modify
X: Num of places change would happen
Y: No. of Unit Test Cases
Z: Integration Testing? (1/0)
AB: Estimation without testing =(J/2*(M*3+N*1+O5*2+P*1.5+Q*1.5+R*0.75+S*0.5+T*0.25+U*0.1+V*2+W*1)*X*K/3*(L))+Y*1
AC: Estimation with testing (in hr) = =AB*1.5
AD: Estimation with testing (in day) [ceiling] =CEILING(AC/8,1)
AE: Estimation without testing (in day) = =AB/8
AF: Estimation without testing (in day) [ceiling] =CEILING(AE,1)

If a single point estimation needs to be communicated, I use the below famous formula to get a realistic estimation figure:

Estimated Day =(AC+2*(AC+AE)+AE)/6.0

It is certain that the above model would be different for other than Java based web application built for enterprises. In that case the value of factors and criteria would require to be tweaked or twisted

Resources

http://www.stellman-greene.com/aspm/images/ch03.pdf

Monday, May 26, 2008

Why development of Unit Test classes should go in parallel along with development

The question that always strikes me about the unit testing is, why people across the board give less priority on writing unit testing code over functional testing when it comes to software quality. I have been in numerous number of software development project and in most of the cases I found that trend, specially when we needed to do a trade off to hit deadline, the first thing gets under the guillotine was the unit testing. Some cases there are pure ignorance on the importance of the unit testing and in other cases where the importance of the unit testing was acknowledged, the unit testing didn't end up in a good coverage (I consider 80% to 90% as a good coverage) of the production code.

I had seen two types of practices in my projects when it comes to create unit test classes. First practice is to set aside the unit testing during the software development phase and once we've a running application in production, we put some time on code quality and maintainability. This can be defined as "After the fact Unit Testing". The management starts pushing the development team to write unit test classes to get 100% code coverage or at least close to 100%. And the second practice, let's call that as "Unit Testing in Parallel", which is kind of not so popular, is to take unit testing as part of the development from the very beginning and force developers to deliver test classes along with production code. In projects, where the unit testing is deemed as necessary but discarded for the sake of project strict deadline, they tend to follow the first practice mentioned above. I'm not considering the Test Driven Development (TDD) practices in this discussion as I believe that's too extreme and extremely rare in the current software industry.

Let's take a look into the "After the fact Unit Testing" approach. It's never gonna happen that you would be able to get a good coverage of unit test classes and even you get some, the quality of unit test code would be horrible. The reason is that you would write to get the coverage or fulfill the management needs not the developers need. There are other downside that I would discuss soon.

In the "Unit Testing in Parallel" approach: This should be the ideal approach when you start a project development. There is one downside, unit test takes extra effort on top of production code that the project management team or customer don't want to effort it initially until they start getting high number of defects production when a simple change in requirement is accepted by the project at the end of the game.

I would advocate for the second approach and explain why this is much much superior to any other approach with the way out of all short falls of this approach.

When a developer starts developing a method, he definitely has few test cases in his mind to validate his implementation. The test case can be either developed in mind before the implementation of the method has started or some time at the end of the development to check if the developed method works as expected. Lets consider the development of the below production code development:

public double convertCurrency(double foreignCurrencyAmt, double exRate) {

return baseAmt / exRate;

}

When the above method is being developed, the developer tests the code by passing sample data and validate against expected return value. Most of the time this testing is done verbally in case it straight forward like the above logic but the complex logic is tested by running the application or by some other means.

Suppose the developer validates his logic by passing foreignCurrencyAmt as 700 and exRate as 70 and expecting the converted currency amount as 10. Either he would test it inside his mind or by running the application with above mentioned data set. So, we can divide the development into two parts - logic development and logic validation. Hypothetically we can distribute 70% time to logic development and 30% time to logic validation of the entire development time of production code.

In first approach where unit testing is done after the development is finished, when the developer would do the development of unit test cases, he would have to spend at least same amount of time (i.e. 30% time) to reconstruct the validation logic. Practically this time would be more because he would need to recall the production code logic again (unless the code is very simple like the earlier example code). My point is here, this 30% time to construct the validation logic (input data set and expected return values) would be duplicated both in the development of production code and development of unit test code. And this effort duplication can be avoided if the production code and unit test code are developed in parallel (pseudo parallel is the most appropriate phrase). There are some overhead of writing formal unit testing code that takes, for example, X amount of time, that we can't avoid and would definitely impact the project time line. I don't want to stress more on the advantages of spending this overhead time in this blog as there is no debate on this. I just want to end my discussion here with this statement that we're able to save the development time (the hypothetical 30% time that is duplicated to construct validation logic) if we develop unit testing code in parallel with production code.