Who Wins ? Java v/s .NET – Clash of the Titans !

Well, this blog is not about which technology is better nor about listing the advantages / dis-advantages of each one.

More often we face situations where we have to propose solutions to our clients and during that time we have to decide on the technology platform for our solution. How do we determine whether it’s Java or Microsoft .NET? What are some of the critical factors which will make us lean either way?

Below are few factors which will influence our decision:

1. Total Cost of Ownership [TCO]

The total cost of ownership of the product should take into account the licensing cost of the Operating system, tools, frameworks and any other 3rd party software you are going to use in building the product. As we know, Java is free and has a rich set of open source tools / libraries.

On the other hand .Net applications run on Windows platform. There is a licensing cost involved in using Windows & any of the tools like Visual studio etc.

So if the client is tight on budget then Java will score over .Net.

 2. Integration with Microsoft Products

The solution you are proposing, if it requires any integration with Microsoft products like Exchange server, Active Directory [ADS] or Biz talk servers etc. then the choice of technology could be .Net. It is easier to integrate .Net application with other Microsoft products.

On the other hand Java can be integrated with Microsoft products but we may have to rely on 3rd party libraries and we may run into many issues during integration.

So if the solution requires integration with Microsoft products then .NET scores over Java.

 3. Vendor Lock-in

As we know, .Net runs on Microsoft Windows platform and Java is platform agnostic. Java applications can run Windows, Linux or UNIX as well as different application servers like JBoss, WebLogic, and WebSphere etc.

There will be a vendor lock-in to Microsoft for .Net applications and the future direction of .Net will be determined by Microsoft. On the other hand Java is defined through a community process and the same application can be ported to different platforms with minimal effort.

So, if the client does not have issues with vendor lock-in then both Java & .Net will score but vendor lock-in is an issue then Java will score over .Net.

Apart from the above factors, there are other factors like customer preference, skill set of our development team etc. needs to be considered. Properly weighing all these factors will enable us to choose either Java or .Net.

Who Am I? – A Software Tester or a Software Developer or Both !!

No. I am not talking about philosophy here but as a software developer, I am asking this question to myself. Who am I? Am I a software developer or a tester?

In software development process, quite often we hear such things as application works on my machine but I don’t know why it’s not working on testing machine? Or this requirement was not mentioned in the specification? Or the testing team is not providing correct values or it works with my data etc…

I bet as a project manager you would have come across these issues within your team or as a developer you would have said such things.

How do we minimize these kind of issues? The quest to find the answer to this question gave me the answer to my original question: Who Am I? I realized that no matter how strong your software development process is, no matter how good your agile QA process is, these issues will crop up unless the developer changes his mind set and realizes that he is a tester first than a developer. So the answer to the question “Who Am I?” is: you are neither a developer nor a tester but a combination of both. I would say you should be more of a tester than a developer. You are a “Test-O-Developer”.

Now the developer ego in me is yelling at me what the heck? I am a developer. My job is to write code. I am not a tester. There is a testing team and let them do bug fixes. I will fix it. I don’t have time to code & test. –

Hey! You are writing the code. That’s cool but think about this. If you don’t act as a tester in finding out the ways of breaking your own code, if you don’t wear the tester hat & understand all the boundary conditions of your code then what happens. Well somebody will break your code. I am emphasizing: somebody will break your code.

In real life, we all don’t want somebody to point finger at us. Why the same can’t be applied when I am writing my code. It’s my code. Why do I want some 3rd person to find bugs in my code? Why should I just write code (with a minimal level of my so-called unit testing) & leave it to the testing team to do bug fixes? Why can’t I be a tester myself & find bugs in my code before I write it? Only then I can safe-guard my code from failing.

I don’t want somebody to say the tab order on the page is not working. I don’t want any specification to say the field length is 10 characters & users should not be able to enter more than that. I don’t want somebody to say my code fails when tested with production data or in testing environment etc…

These things are possible only when you think & realize that you should be a tester first then a developer.

No. I am not telling the testing team is not required. They are very much required. All I am advocating is as a developer bring in the acumen of the tester, cultivate the habit of finding issues with your code, think of ways to break the code before you code. As a developer aims for zero bugs in your code, as a tester aims to find more & more bugs. All I am conveying is to be a true developer or a “Test-O-Developer”.

Must-have Productive tools in a Developer’s Armoury

As a developer our majority of concentration lay around implementing the functional requirements of the product. But as an Architect, I need to take care of the non-functional requirements like how well the application performs? Can the application scale up?etc. besides ensuring functional requirements are met.

Is there a way for an Architect to find out the performance bottlenecks in the application without getting too much involved into the nitty-gritty of the low level code? Are there any tools which we can use to know the details of the application performance?


Let’s take a typical web application as an example and see what we can do to improve the performance without getting too much involved into the code. In our example, there is a page which is taking too much of time to load when a user requests the page.

As a developer I have coded this page & it works perfectly according to the requirements. But it is taking too much of time to show up in the client browser. So what is wrong?


So, let’s start our investigation & better understand what’s happening when a user requests the page. But the bigger question is how do we go ahead? How do I know what is going as an HTTP request & what is coming back as an HTTP response without going into the code?

The answer lies in using some of the tools which provide these details. Couple of tools which I use are:

  1. Fiddler from http://www.telerik.com/fiddler
  2. HttpWatch from http://www.httpwatch.com/

These tools are HTTP sniffers / proxy for majority of the browsers & they provide more insights into how your web page is loading & performing. They log all the requests / responses to your web site. Now that I have this tool & I can see the requests / responses logged, the next question is where do we go from here?

Ask Yourself

I use these tools to get answers for some of my questions. Below are the questions:

  1. How many HTTP requests are sent to the server when the user requested that one page? Well, you may say it as one request? But the answer is NO. Although, the user requested a page, but internally browser will make many requests to get all the resources referenced in that page. The resources could be style sheet (CSS) files, images, java script files etc.
  2. Are we leveraging caching of the HTTP requests?
  3. How much of response data sent to the browser?
  4. Is the HTTP response compressed?
  5. How much time the browser waited to get the response back from the server?

Depending on the answers I get for these questions from the tool, below are some of the performance tuning we can do to improve the response time of the page:

  1. If there are many HTTP requests executed internally by the browser then use “minify” to combine many requests to CSS & JS files into single downloads. This will reduce the bandwidth required to get these files.
  2. It’s best to cache images as they may not change regularly. Implement caching filters to cache different types of images the web site may have.
  3. Look at the response data sent from the server and see whether the data is compressed. Most of the browsers supports gzip compression. So the browser can automatically un-zip the contents sent by the server. Gzip can be enabled at the web server level without writing any piece of code. Most of the web servers supports this. In Jboss it can be configured in the server.xml. Refer your web server manual for more details.
  4. If your server is taking more time to send back the response then comes the need to look at the application code. But wait. Before I get into the code, I need to know the time taken by the application to get the data from the database. How do I get the timings of the database calls?


I use tools like:

  1. log4jdbc from https://code.google.com/p/log4jdbc/
  2. P6Spy from https://github.com/p6spy/p6spy

These tools enable database calls to be intercepted and logged without any change in the application code.  I use these tools to get answers for some of my questions. Below are the questions:

How many database calls are executed to render our example page?

  1. Which calls taking more time?
  2. Are there any duplicate calls to fetch the same set of data?

Depending on the answers I get for these questions from the tool, below are some of the performance tuning we do to improve the response time of the page:

  1. Analyze the query which is taking more time. Check with database administrator to tune this query in terms of creating new indexes or new table space etc.
  2. If there are duplicate calls then check with the developer why duplicate calls required in the same transaction? Can we get data once and use it in multiple places instead of making same calls again.
  3. Out of the database calls made for the page, see whether any data that can be cached instead of loading from the database always. If so, implement a caching strategy.

These tools enables me to do some amount of performance tuning without getting too much involved at the code level. Of course in some cases it will be imperative to get to the lower levels but not without implementing the first level of performance optimization as mentioned above.

Addressing time difference issue in Onsite / Offshore development model

Having handled complex Java projects at our offshore development center at Trigent’s Bangalore Office, here’s my take on the oft-discussed topic on time difference issue attached with onsite/offshore development models. For sake of readers convenience, I have also included some key collaborative steps that can be put into practice for making smooth progress towards meeting timelines.

Addressing Time Zone Difference with Offshore Software Development Partners

Below are some of the steps to be taken to make sure collaborative development work is smooth & successful in an onsite / offshore product development:

  1. Know your team – This is the most important first step in any collaborative development. This can be achieved in many ways.
    • Have onsite team members visit offshore facility or vice versa
    • Have video conferencing calls
    • Share photos / pictures of the team members
  2. Have daily meetings – Meetings with onsite team daily will make the team understand what each member is doing
  3. Collaborative design – Offshore team work together with onsite team members in designing the application. To beat the time difference the offshore team can work extended hours during design phase
  4. Pair programming – This can be achieved by having an offshore team member & an onsite team member both work on the same module.
  5. Peer review – Have offshore team member’s code reviewed by on-site team member & vice versa. This can help in achieving on-site team’s expectations
  6. Continuous build & integration – Have a CI system in place which will make sure that clean code is checked-in at any time.  The following steps can be implemented:
    • Automatic build will happen whenever code is checked-in
    • The CI system executes the regression test suites to make sure nothing breaks
    • Notify the team on any failures so that team can act on it
    • Make sure the team runs the complete build before their EOD. This will ensure that the onsite team gets clean code to work on.
  7. Regression test suites – Build regression test cases & integrate it with continuous build. This will make sure that the checked-in code has not broken somebody else code.
  8. Disciplined code check-in – The following can be enforced:
    • Have visibility into what each member is working on, which files etc.
    • Make sure that one does not override somebody else code.
    • Always see the repository changes before check-in.
    • Periodically check-in smaller logical changes
    • Don’t check-in partially completed code
  9. Communicate – This is an important step. Following options can be implemented for effective communication:
    • Create a group e-mail account which will include on-site team members
    • Use Skype or other IMs and communicate daily
    • Exchange each other’s alternate communication details like phone, mobile etc.
    • Have contact details of all the team members in common central place & accessible to all.
    • Identify offshore team member who can be contacted during emergency

Handling CSV files Using HSQL Text Tables

As programmers, we all know what a CSV file is all about. For novice, a CSV file is a “Comma Separated Values” files having some kind of data. Each line represents a record while each value is separated by a comma “,”.

Let’s take a simple example:

Say the CSV file contains order data. Each order record contains data about a particular order like order number, product code, quantity, ordered by, date etc. Now lets take a hypothetical requirement which says, the user needs to know how many orders were ordered per product.

Well given this requirement, as a programmer what are our options?
Option 1]  At the basic level, read the order file, parse each line and write the logic to get count of orders per product.
Option 2] Load this CSV file into a database like MySQL and write database queries to get the orders per product.
Option 1 is good if the file size is small and when we have to deal with less number of orders. If the file size is big then we will get into other issues like performance, memory etc.

Option 2 is good but it requires database administrative capabilities to load the data into database. Of course we can use in-memory database but still we may need to use database utilities to load the files into the database. This will lead to duplication of data that is data in CSV file as well as same data loaded to database table.

So where does this leave us? Have we run out of options? I am sure we would have tried & used the above two options . But I wanted a different approach. Following questions were lingering in my mind:
1] Why can’t I write SQL queries against the CSV file itself. After all it’s like any RDBMS table.
2] Why should I load the CSV file into some database before I query it?
3] Why can’t I create a database table & attach the CSV file to it?
Well my quest for the answers led me to “HSQL Text tables”. HSQL is a database which can run in-memory. No pre-installation, configuration is required to use this database. It has a feature to create a “Text” table and attach the CSV file as a source to that table. No need of manually loading the data into this table.

So for our requirement, we used HSQL Text tables. Below are the steps to use Text tables:
1] Set the system property:
System.setProperty(“textdb.allow_full_path”, “true”);
This will enable HSQL to load the CSV file from any path. In our case, we wanted to load the file from network path.
2] Create Text table using the below command:
“CREATE TEXT TABLE tbl_Order ord_no varchar(30), prod_code varchar(30)…..”;
3] Create any indexes, if required.
4] Attach the CSV file as a source to the table using the below command:
SET TABLE tbl_Order SOURCE “x:\server\order.csv”;

Voila. That’s it. Once the above steps are done, we can execute SQL queries as if its a normal table.

In a nut shell, HSQL Text tables are powerful & easy to use. It eliminated the lower level of file reading & parsing the file as well duplication of data and still met the requirement.