objectfactory@wordpress

Entries from September 2008

That Use Case ate my credit card

September 25, 2008 · 1 Comment

Another example of someone not reviewing the use case.

Arrived back at the train station late in the evening following my trip to the Rational Software Development Conference UK 2008. I decided to pay my parking at an automated machine with a new credit card which I had not yet changed the PIN number on. Put the card in the machine and entered what was obviously the incorrect PIN number, tried the same thing a second time (with a slight alteration of the still incorrect PIN number) at which point the machine correctly told me I had one attempt left. Rather than risk getting my card locked out I decided to pay on a card which I thought I did know the PIN number of, duly pressed cancel to get the original card returned, put a different card in and entered yet another incorrect PIN number. You can imagine my surprise when the machine told me the card had been locked (remember this was a different card to which I had only attempted a single incorrect PIN number). Now whilst I have to shoulder some of the blame for putting in the wrong PIN for two different cards. I can’t help but think that someone either didn’t properly detail that use case or failed to test sufficiently!

I ended up paying on a third card…. grrrr

Categories: Requirements
Tagged: ,

Rational Software Development Conference UK 2008

September 24, 2008 · Leave a Comment

I have just returned from attending the Rational Software Development Conference UK 2008 held at the Royal College of Physicians in London. This was once again a very interesting two day event with a packed schedule of interesting keynote speeches, presentations and labs tackling various aspects from the IBM Rational products themselves to process, methods and practices (the new buzzword) and a whole slew of other related stuff. I tried to spread myself as thinly as possible (no mean feat these days) to try and attend as many tracks and presentations as possible but mainly focused on those related to the Jazz platform and the new products either already released such as Rational Team Concert (RTC), or those in the pipeline. I will write further about RTC later this week as it is the most exciting product to be released for quite some time!

Categories: Rational
Tagged: , , ,

Amy MacDonald – This Is The Life

September 24, 2008 · 2 Comments

Heard this on the Chris Evans show tonight on Radio 2…. quite good really. You don’t tend to come across this kind of thing when listening to ‘Today‘ on Radio 4

Categories: Leisure
Tagged: , ,

iTunes sharing – the highs and not so highs…

September 18, 2008 · Leave a Comment

Having switched last year from a combination of Debian GNU/Linux as my primary and Windows XP as my secondary operating system on a dual-boot PC to solely using Mac OS X on an 20″ iMac; I can honestly say I have been absolutely delighted with the overall experience. To my mind Mac OS X has the strength and stability of Unix as the underlying core with the advantages of a superb UI built on top.

As part of this transition, I have also ripped all the CDs in my collection to the hard drive and stored these as ‘higher-quality’ AAC (.m4a) files within my iTunes library. This has all been working fine for me and I have been more than happy with the outcome. However when it comes to sharing this media with other members of my family things start to become a little less perfect.

iTunes seems to have the concept of the ‘media’ and the library which references it and these are potentially separate. As this was originally done under my personal account with the default locations the iTunes library is stored under the following folder (where ~ represents the user account path)

~/Music/iTunes/

and the actual media by default is stored under

~/Music/iTunes/iTunes Music

all sorted by Artist and Album. By default this is private to the individual user, to make this accessible to other accounts on the same machine without fiddling with ACLs the recommended way is to either copy this to the default public folder under your account or better still to copy one or more aspects to a shared folder, typically /Users/Shared.

Having done a certain amount of investigation and a fair amount of ‘googling’ on this topic the two recommendations seem to be variations on the above. Either copy both the media and the library to the shared user folder or alternatively copy the media to the shared user folder and then maintain individual libraries to reference this within each individual default location (~/Music/iTunes/).

To my mind both of these approaches have their own drawbacks. My requirements would be (at a very high level obviously) for each user to share the media but for each to possess their own library, in this way each user could have their own individual playlists etc. but reference a common set of media files. However when a user rips a CD and this media is added to the media folder and also their library file, for the other user(s) to automatically ‘detect’ when iTunes next starts that new media is present in the folder and for this to be automatically added to their own library and made accessible.

What seems to happen currently is that if each account owns their own library, whilst this allows them to have their own playlists, if new media is created by another account then this is not detected and this has to be manually added by the other accounts which wish to access this. Not difficult to imagine that in general this would be an unusable situation in the medium term. Alternatively if a common library and media folder is used across accounts then not only is everyones library shared (by definition) and therefore playlists etc. but only one person can access the library at any one time as iTunes insists on gaining a lock on the file.

Hmmmmphh! I wonder who captured the requirements for that one then ?

Categories: Apple
Tagged: ,

Architectural Requirements

September 17, 2008 · Leave a Comment

Within my role, and due to my keen interest in requirements management, I am often asked for advice on what constitutes a non-functional requirement and what these typically contain or define. It seems to me that the art of defining requirements has, in some cases, been lost and people all too easily blur the lines between the problem space and the solution space leading to unnecessarily constrained solutions to problems.

When eliciting the requirements it is imperative that all the stakeholders are identified and not just those who are immediately apparent; additionally those involved in the process maintain a clear separation between the requirements and design aspects.

The following is a good introductory post by a gentleman called Peter Eeles to what he terms ‘Architectural Requirements’ but which to my mind covers functional and non-functional requirements; I believe his classification is due to these being requirements which have a significant bearing on the architecture.

http://www.ibm.com/developerworks/rational/library/4706.html

Whilst these are often ignored early on in the project due to the focus on what are commonly referred to as ‘business requirements’, you do this at your peril as in my experience these can significantly affect the costs of delivering the solution and thus the viability of the overall project.

Categories: Requirements
Tagged: ,

Avoid duplicate results when using a SQL Self-Join

September 11, 2008 · Leave a Comment

I’ve spent a fair amount of time today scratching my head trying to work out how to avoid what are ‘logically’ duplicate results being returned when using a self-join in a database query and thought it best to quickly document what my solution was before I forget it.

This is probably case-specific and may not work in other environments depending on the data being used.  It is also going to seem somewhat contrived as I have deliberately tried to keep this as simple as possible and avoided all the supporting tables and also details as to why this is necessary to support the user scenario.

In this example I have a table of name details associated with people which I have created in MySQL 5.0.67 as follows:

DROP TABLE IF EXISTS `schema`.`person`;
CREATE TABLE `schema`.`person` (
`id` int(10) unsigned NOT NULL auto_increment,
`forename` varchar(30) default NULL,
`surname` varchar(30) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

and this is populated with the following five records

1, 'Arthur', 'Dent'
2, 'Albert', 'Einstein'
3, 'Alfred', 'Hitchcock'
4, 'Albus', 'Dumbledore'
5, 'Ethelred', 'The Unready'

If I wish to find all records in this table associated with two people using wildcards (one whose forename begins with ‘A’ and the other whose forename begins with ‘Al’), I ended up using a self-join and two table aliases, e.g. P1 = Person 1 and P2 = Person 2 as follows:

select p1.id, p1.forename, p1.surname, p2.id, p2.forename, p2.surname
from person p1, person p2
where p1.forename like 'A%' and p2.forename like 'Al%';

Now, unfortunately when this is executed this results in all the matching permutations being returned as follows:

1, 'Arthur', 'Dent', 2, 'Albert', 'Einstein'
2, 'Albert', 'Einstein', 2, 'Albert', 'Einstein'
3, 'Alfred', 'Hitchcock', 2, 'Albert', 'Einstein'
4, 'Albus', 'Dumbledore', 2, 'Albert', 'Einstein'
1, 'Arthur', 'Dent', 3, 'Alfred', 'Hitchcock'
2, 'Albert', 'Einstein', 3, 'Alfred', 'Hitchcock'
3, 'Alfred', 'Hitchcock', 3, 'Alfred', 'Hitchcock'
4, 'Albus', 'Dumbledore', 3, 'Alfred', 'Hitchcock'
1, 'Arthur', 'Dent', 4, 'Albus', 'Dumbledore'
2, 'Albert', 'Einstein', 4, 'Albus', 'Dumbledore'
3, 'Alfred', 'Hitchcock', 4, 'Albus', 'Dumbledore'
4, 'Albus', 'Dumbledore', 4, 'Albus', 'Dumbledore'

Not only has this returned duplicates for the individual themselves (e.g. Albert Einstein for both person 1 and person 2) but also the same combinations in a different order (e.g ID 3,2 and 2,3). The first one of these is easy to remove from the result set when an ‘id’ field is present by adding the following criteria in the query

and p1.id != p2.id;

i.e.
select p1.id, p1.forename, p1.surname, p2.id, p2.forename, p2.surname
from person p1, person p2
where p1.forename like 'A%' and p2.forename like 'Al%'
and p1.id != p2.id;

this results in the following result set:

1, 'Arthur', 'Dent', 2, 'Albert', 'Einstein'
3, 'Alfred', 'Hitchcock', 2, 'Albert', 'Einstein'
4, 'Albus', 'Dumbledore', 2, 'Albert', 'Einstein'
1, 'Arthur', 'Dent', 3, 'Alfred', 'Hitchcock'
2, 'Albert', 'Einstein', 3, 'Alfred', 'Hitchcock'
4, 'Albus', 'Dumbledore', 3, 'Alfred', 'Hitchcock'
1, 'Arthur', 'Dent', 4, 'Albus', 'Dumbledore'
2, 'Albert', 'Einstein', 4, 'Albus', 'Dumbledore'
3, 'Alfred', 'Hitchcock', 4, 'Albus', 'Dumbledore'

As can be seen however, this still has the same logical combinations duplicated (order not withstanding). The removal of these records is significantly harder to do. I initially wrongly thought that I would be able to remove this through the addition of a ‘distinct’ keyword to the query but this only operates across all columns in the record and therefore doesn’t deliver the required result.

I resolved this by the inclusion of a combination of the ‘if’ and ‘concat’ functions that I was not aware of in SQL and a ‘group by’ clause (the ‘if’ function may not in fact be part of the ANSI standard yet). The following was the result:

select p1.id, p1.forename, p1.surname, p2.id, p2.forename, p2.surname,
if (p1.id<p2.id,CONCAT(p1.id,p2.id),CONCAT(p2.id,p1.id)) as pid_concat
from person p1, person p2
where p1.forename like 'A%' and p2.forename like 'Al%'
and p1.id != p2.id
group by pid_concat;


1, 'Arthur', 'Dent', 2, 'Albert', 'Einstein', '12'
1, 'Arthur', 'Dent', 3, 'Alfred', 'Hitchcock', '13'
1, 'Arthur', 'Dent', 4, 'Albus', 'Dumbledore', '14'
3, 'Alfred', 'Hitchcock', 2, 'Albert', 'Einstein', '23'
4, 'Albus', 'Dumbledore', 2, 'Albert', 'Einstein', '24'
4, 'Albus', 'Dumbledore', 3, 'Alfred', 'Hitchcock', '34'

Now whilst the ‘if’ function may or may not be widely implemented, it seems from the quick look I had that there is typically an equivalent function in most of the widely used databases in use. I found an Oracle function called ‘decode’ which would seem to deliver the same functionality. Result!

Categories: Technical
Tagged: , , ,