Archive for April, 2007

Juicy Code with Google Guice - Part 3

In the previous part, I created a sample application to test-drive Google Guice. I used the factory functionality of the framework. Now, let’s extend our example to include a few dependency injections! Let’s see how this works in Google Guice!
Continue reading ‘Juicy Code with Google Guice - Part 3′

Technorati Tags: ,

What sets DSI apart? A political slant.

What sets DSI apart? At the outset it seems a straightforward concept - we have 100+ highly qualified technical resources. We have worked for many of the world’s leading brand names - Expedia, Amazon, Avon, Mastercard. We are very active and successful in the US dental insurance industry. We constantly work with and promote the use of the best of breed technologies (with the skill set to match) - The Spring Framework, Hibernate. We have recently acquired Microsoft certification status. We work closely with the major names in the software sector - i21, Quest, Amazon.

So where does the challenge lie? The software development space is extremely competitive. There are an unlimited number of ‘brand name’ firms out there competing in the same space, firms from seemingly every corner of the globe offering their services. So how do we differentiate ourselves? What sets us apart? Why would someone choose DSI over others? What is the unique DSI message?

Continue reading ‘What sets DSI apart? A political slant.’

ISNULL() What Really Happens

T-SQL ISNULL() function: ISNULL ( check_expression , replacement_value )

This is just ensure that we are all aware of exactly how the ISNULL() function in T-SQL works….this may be known to most of you already but for those like myself who didn’t its worth knowing. I always believed that if the check_expression  was NULL then we simply compared against the replacement_value,this isn’t quite the case, the replacement_value is in fact converted to the type of the check_expression.
Continue reading ‘ISNULL() What Really Happens’

Technorati Tags: ,

Database Indexing 101 Part 1

Indexing is a means of increasing the performance of your database queries. It’s amazing how many people are unaware of the basic principals of good indexing.

What an index does is provide a shortcut for the database, when it’s trying to find records matching some search criteria. A simple search requirement is to return values from records, where one or more fields match a particular value.

SELECT bar FROM foo WHERE item = ‘TEST’

If an index exists for the table foo with item as the indexed field, then the database optimizer will recognise this when the SQL statement is parsed, and use this index when executing the query. This results in an overall performance gain. How significant this performance gain is depends on how many records are present in the table, what the cardinality of the field is and how much variation is present in the field’s values.

If a field has a unique value per record, then the cardinality is high for that field. If the field has only one or two possible values, then the cardinality is low. Most types of index perform better with a high cardinality.

So what happens when the index is not so good? Let’s look at a slightly different query and see how the same index behaves.

SELECT bar FROM foo WHERE item = ‘TEST’ AND value = ‘SNAFU’

In this case only one of the fields used in the WHERE clause is present in the index. That means that further examination of all the records returned from the index will need to be done, to isolate those records that meet the second criteria, which isn’t supported by the index. This is referred to as an index range scan. This situation is not as bad as not having any index but not as good as having a completely appropriate index. With a little work we can implement a simple optimization of the index that will yield a solution which is suitable for both queries.

If the index is recreated indexing both the item field and value field (in that order), then the index will be applicable for both queries. This is a property of the structure of table indexes. Interestingly, if the table is indexed by the same fields in the opposite order, it’s only useful for the second query. Even then it may not be as efficient.
A second simple optimisation is to add the bar field to the index. While the bar field is not used in the search criteria, if all of the fields required to be returned exist within the field structure, no secondary search for the row data is required in order to meet the requirements of the query.

This fact gives us a little insight into how an index works. An index is essentially a sorted list of pointers to groups of rows that match the different values within the fields that are indexed. When each group is made up of only a single row we say this is a unique index. Unique indexes are often the most efficient form of index.

Simple Index

Critical to the performance of an index is the sorting of the index. Just as with the telephone book it’s quicker to look up records when the field you are searching by is sorted. Of course, if what you are searching for is not indexed, then the index is useless for that query.

This is a very simplistic overview of how an index behaves. As you can see, for some operations a second seek for the individual rows that match the search criteria is required. Each of these seek operations against unsorted data is relatively costly.
In later posts I hope to go into greater detail of how a typical database index behaves.

VM Tuning with Quest’s PerformaSure and the Java Hotspot VM Options

In this blog entry I am going to speak about a recent tuning exercise on an application running on the Java Hotspot VM 1.4.2. It’s great that developers are adopting and using the latest versions of the JVMs but there are still a hell of a lot of applications out in the wild running on older versions of the JVM.

The application in question is a CRM type application, serving about 200 concurrent users, increasing in bursts to 300+ users, processing approximately 4.5 million customer contacts per year. Do the math, and considering the application is running on a single JVM, the application is processing quite an amount of consistent load over the course of a working day.

Recently it was decided to determine the capacity of the current production application server. The rollout of another considerable application is imminent and the customer felt that it was prudent to determine whether or not the current infrastructure had sufficient capacity to run the new system.

Continue reading ‘VM Tuning with Quest’s PerformaSure and the Java Hotspot VM Options’

Technorati Tags:

More Limitations of TFS Branching

Recently I pointed out some of the ways in which TFS’s source code control tied our hands - at least compared to CVS. I repeat that TFS is a good product and very stable. But it is young and therefore incomplete. Be aware of the following fact: When you branch a file, the branched copy of that file loses its memory. The history of that file begins at the point of branching. Try it out - branch a directory and commit the resulting new directory. Take a look at the history of any file in the branch. It’s newborn - it doesn’t remember of any of the changesets that were made on it before the point of branching.

This isn’t very nice. For example, if you are on a release branch, and you want to roll back a changeset that was made on Main, well, you can’t. You have to roll back (using Power Tools) on the Main, merge the resulting changeset to the release branch, and then on the Main roll back the rollback! In CVS you can see the combined history of a file including all its branches, and merge (a rollback is effectively a reverse merge) in any way you see fit.

I don’t know (yet) if this is an unavoidable consequence of directory space branching (if it is, it’ll be a long time before I’m convinced to switch from CVS to Subversion for our Java projects), or whether it’s just limitations of TFS. Anyone else out there suffering in a similar way with their source code control system?

Technorati Tags: , ,

Juicy Code with Google Guice - Part 2

- “Google Guice… Google Guice… Google Guice…”
Let’s see some magic in action, shall we?

As part of this article, I’m going to create some code using Google Guice. As I like RPGs (Role-Playing Games), I’m going to code something related to an RPG. It’s going to be a very simplified version of a gladiator fight with different types of characters. The characters can attack, defend and cause damage. They all have hit points (life points). When a character is attacked, if the attacker’s attack point is greater than the defender’s defense point attack succeeds and the attacker causes some damage. The amount of damage is then deduced from the defender’s hit points. Whoever can bring his opponent’s hit points to zero or below wins. I hope this all makes sense. Please keep in mind that this example may not represent the best design in order to achieve the intended result. However, I’m intentionally making the design as it is in order to play around with Google Guice. Obviously, please let me know if you have any comments as I have to say that I’m far from being an expert on Google Guice.
Continue reading ‘Juicy Code with Google Guice - Part 2′

Technorati Tags:

Spring Batch

As part of my yearly holy pilgrimage, next month I will be attending JavaOne in San Francisco. So, yesterday I took some time to create my JavaOne 2007 schedule (By the way, the schedule builder is an ugly piece of application. Now it’s using a little bit of AJAX but this doesn’t make the whole thing look nicer… Anyway, I’m not writing to complain about this). When I was going through the Friday sessions, I came across a Rod Johnson session (co-presented with W.Lund and S.Wintermute from Accenture). The name of their session is “Taking Java Technology to New Frontiers: Enterprise Batch Processing with Spring Batch. I remember having read about Rod Johnson mentioning some sort of batch support in Spring in JavaPolis however I didn’t know that some kind of project was in place.

This is something important for us, as it would be for anyone involved in application development in the enterprise domain. Most of the time, large-scale enterprise applications, like the ones that we develop, require automated and often complex processing of bulky data. And this is most efficiently done without user interaction.

So what is Spring Batch? Here’s an excerpt from the session description:
“Spring Batch is the only comprehensive lightweight batch framework designed to enable batch development for enterprise systems of varying complexity. Simple as well as complex, high-volume batch jobs can leverage this framework in a highly scalable manner.”

That sounds perfect! Unfortunately there is no information on Spring Batch yet (I mean googling around doesn’t reveal anything). And it may well be that they want the first official talk to happen in JavaOne. However, in the meantime, I’m going to try to find some more information about it. Please drop me a line if you can point me to the right direction! I’ll write about it if I can find anything significant.

- Yagiz Erkan -

Technorati Tags: , , , , ,

Windows Server 2003 (X64) & .NET Applications

Are we looking at the first generation of legacy .Net applications ?

Recently (i.e. today), I had the task of getting a .NET 1.1 App up and running on an X64 box running Windows server 2003(x64)… and with the deployment  came the realisation that we are now heading towards the next generation of software architecture.

That’s not to say that I’m shocked & horrified - it was more of a “ah, it’s that time again…”. Having experienced the torture of working with 16-bit and 32-bit technologies in an application before, I vowed never to work on such a solution again.

Looking ahead, it’s becoming apparent that your .NET 1.1 apps are about to turn into legacy systems - There isn’t a ’.NET 1.1 Framework (x64) Redistributable’… and there won’t be !

Continue reading ‘Windows Server 2003 (X64) & .NET Applications’

Jacobson gives us the opportunity to grow up.

I checked the date. It was two days too late to be an April 1st stunt. So then I read the article title again, to see if I was misreading it: Enough of Processes: Let’s Do Practices (Part I), by Ivar Jacobson. Those who never had to work alongside an army of overpaid Rational Unified Process (RUP) consultants may not be aware that this last great heavyweight process was the brainchild of Ivan Jacobson, Grady Booch and Jim Rumbaugh - collectively known as the Three Amigos.
Continue reading ‘Jacobson gives us the opportunity to grow up.’

Technorati Tags: ,