Wednesday, September 16, 2009

Gone with the wind…

Recently, I drove almost 85 miles for an interview. When I entered into the office, I was greeted by a very enthusiastic developer. And then came the moment of truth – he walked me into a room and told me to take a hands-on programming test. OK. The test was on VB6 programming. Well, what happened next is a very funny story, but it kept me nagging that I haven’t thought about VB environment for long time…with all this .NET code around, I just forgot about my old pal VB. Yes – it’s been almost a decade for me when I wrote any code in VB. And then while talking to somebody on COM/DCOM horror stories – I was told that the official support for VB development environment is gone. I found following post on VB resource center

“The Visual Basic 6.0 IDE will be supported on Windows Vista and Windows Server 2008 as part of the Visual Basic 6.0 Extended Support policy until April 8, 2008… ”
From http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx

Yes – VB runtime will be supported till 2019, but support for Visual Studio 6 is gone. Well, everyone using VB 6 is aware of this fact, but for me, on personnel note – it is a weird feeling...

"I have forgot much, Cynara! gone with the wind."

Friday, August 21, 2009

Graph of diminishing questions

How do you feel if somebody asks too many questions?

Well, whenever we have a new team member joining our group – we all go through the same experience. I call it - graph of diminishing questions [as shown below]



We see one of the following reactions or some combination of it

1. why s/he is asking so many questions - come-on it’s a simple business application - and you are hired to work on it - go figure it out - we gave him / her access to all the systems, code, database - what more can we do - I mean put some break points - run some queries - go figure it out on your own - that’s why you are hired - don’t ask me all these stupid questions?

2. I am not sure why s/he is not asking any questions. If you don’t understand then just ask us. But please don’t say yes when you don’t get it. You know - just yesterday, I was at his/her desk, and by looking at the screen, I can tell you s/he is lost, I don’t think s/he knows anything about the system - and I am not sure why s/he is not asking any questions?

3. Well s/he is a smart person but I think – I don’t know - s/he might have over promised in the interview and now struggling - I think s/he is not that smart as was told to us [by somebody – may be our boss…]

4. We don’t do too much training here - we throw the baby in the water and if she can swim - she can stay

5. We do work with new people and explain them the system and also help them understand the real challenge

I can go on and on and on, but I guess the point is simple - what do you do? I am sure almost everybody wants to opt for no 5, but in reality we are somewhere between 1 and 4. Challenge is to change our culture and look back at our own experience, and remember the day when we were new. When everything looked like a big mystery and intimidating nightmare. We had no clue where to start and what to do. This will force us to help others in understanding the mess [sorry software] that we help [or were paid] to build...



Thursday, June 11, 2009

How many CPUs your operating system can handle?

How many CPUs your operating system can handle? 2 / 4 / 8 – many a times ans is very simple – I don’t know? How to find the answer? Here is one easy way to get to the bottom of this issue. Go to the Task Manager and right click on any process , and then click on the set affinity option as shown below. You will get the answer. Note: this is the number – how many CPUs can be managed by your OS and not the underlying hardware.






And here are the specs for a machine I used in this excercise


Sunday, May 3, 2009

Multiplexing strategy for reducing software licensing cost

Software licensing is a complex and confusing topic. Most of us know how to use and master any given software like SQL Server, Oracle, or Crystal Report etc. But purchasing a software and figuring out the real cost is a challenge. Questions like do you want to go with named-users or per core licensing or on the basis of number of processors or total number of CPU’s are confusing. For example, Microsoft will charge you based on the number of processors in your server irrespective of number of CPUs / core per processor and Oracle will treat each core as half the processor. For example, on 4 quad core server [4 processors with 4 CPUs on each processor = 16 CPUs or cores], SQL server will cost you for 4 licenses and Oracle will result in 8 licensees [16 * 0.5 =8] [1]

Now this might be acceptable for enterprise grade tools like RDBMS or reporting solution. But many a time we end up buying 8 or 10 copies of small commodity software used by a department or a group of users working on a special project. Most of these tools are sold on per instance basis. So we end up paying for 10 copies and installing it on individual desktops. This also results in maintenance nightmare.

There is a better way to deal with such commodity tools – strategy known as multiplexing. It’s very straight forward – all you have to do is to install one instance of the commodity software on your central server and write a wrapper around it. The wrapper can be exposed over the network [LAN / WAN / Internet] using http, https etc. Yes, you will have to write a web application that will expose the interface for the commodity tool. Many a times, this strategy will work like a charm [except if licensing agreement for the commodity tool explicitly deny the permission for any such exercise]. Note – this does not involve changing any of the bits / code in the commodity software – all you are doing is to expose its public interface over the network. Threading and deadlocks might pose some challenge when shared resources are simultaneously utilized by many users. But this can be avoided by placing an explicit lock on shared resources like file folders. Additionally, this public interface can be modified to accept the inputs from internal resources like local databases, file system etc.

If used judiciously, multiplexing can deliver a great business value.

Reference:

1.http://www.microsoft.com/Sqlserver/2005/en/us/special-considerations.aspx

Monday, April 20, 2009

Web 2.0 and Cloud Computing

It is always good to compare different technologies. That way we can see whether the technology is maturing with time and is worth considering it for real. But the challenge is to find a tool that would help in this endeavor. I found “Gartner Hype Cycle” [GHC] really effective in comparing different technologies and their evolution.

So I wanted to see how web 2.0 is doing over last three years and where does cloud computing stand on this technology curve. I always believed that image is worth thousand blogs…so here you go – GHC for 2006, 07 and 2008 and the evolution of web 2.0 vs. cloud computing. ..







Reference
for 2006
http://www.saastream.com/my_weblog/images/2007/10/02/gartner_hype_cycle_emerging_techn_4.jpg
for 2007
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKRtg86I2SFDcA_IyZK3lG8u5d7KOpX0eEQAaPqmLqlT7k9wLr61vlCbEYmruMdU__jyGJBIBN-scyV7gkIi21CZGD91Bzhlu2XlQ1LKZV58qpTUe39xP7PpJLC1RNEuayK-Latvy45mTF/s400/hype-cycle-for-emerging-technologies-2008-400.jpg
for 2008
http://www.flickr.com/photos/lafabriquedeblogs/2796357787/

Sunday, April 19, 2009

Virtualization : as experienced from ground zero

Virtualization is a big theme in the contemporary enterprise architecture. Many documented case studies highlights the virtualization benefits including better hardware utilization, grater ROI and lower TCO. This deal is so great that you can’t overlook this option…




But, and this but is a big one. But the reality is not that green. From software point of view, it is not able to utilize 100% of the physical infrastructure. Like in our example, we have 8 CPUs and 128 GB of RAM, but each virtual machine can only use up to 4 CPUs and 64 GB of RAM. Systems like RDBMS thrive in many-core / multi-processor environment. So by limiting the number of CPUs or memory, we are minimizing its capacity. This is what we experienced when we decided to use a hypervisor [and this is mostly true for any hypervisor].

In future version of hypervisors, this limitation will be fixed. Based on the processing load, each VM will be able to optimize the physical resource utilization. But as of today, there are some hard limits on no of CPUs and RAM each VM can use.

So to conclude, in our test case – let’s compare machine A with 8 CPUs and 16 GB of RAM with machine B with 8 CPUs and 128 GB of RAM. Machine B is virtualized and is used to run 2 VMs with 4 CPUs each and 64 GB of RAM. Both the VM’s on machine B are operating in parallel and are used for running an instance of SQL Server 2005 and a file server. Which SQL Server instance will run fast – one that is running on machine A or on machine B? What if we bump up the RAM in machine B up to 256 GB? These are some solid question one should consider seriously before jumping on the virtualization bandwagon. Yes, all these issues will be fixed in the future versions and all vendors are working on it. But from pure architecture point of view, as of today, one should consider these limitations seriously.

A lot will depend on the processing load and type of applications running on these virtual machines. For busts and spikes – you need a ton load of RAM and huge processing for a while but after that all that capacity is just idling around. What if that bust or spike is the reason for provisioning such a huge hardware capacity? Can we run this busty system in a virtualized environment and let it suffer because of VM’s limit on no of CPU it can handle and maximize our hardware utilization or go the traditional way and provision a big machine just to handle this one mission critical load efficiently and effectively? These are some critical questions one would face while moving the production applications in a virtualized environment. There are no easy answers and the only way to insure the success is by doing as much testing as possible.

Sunday, February 1, 2009

On the Benefits of Learning Multiple Languages

Finally, I got to the pile of magazines I wanted to read for long time. I found this article in Visual Studio magazine. I liked the title and started reading it. The basic premise is – “Learning other programming languages can make you more fluent and give you a better understanding of the language you depend on primarily.”

So I started coding in the language I know the best – C# and wrote some code


using System;

namespace demo
{
internal class Test
{
public static void Main()
{
const int i = 2;

//static method call
Console.WriteLine(IsEven(i));

//generic delegate
Func<int, bool> f = IsEven;
Console.WriteLine(f(2));

//anonmous method + lambda
Func<int, bool> f1 = j => j%2 == 0;
Console.WriteLine(f1(2));

Console.ReadLine();
}

public static bool IsEven(int number)
{
return number > 0 ? number%2 == 0 : false;
}
}
}

Now, I wanted to convert this code to visual basic. Interestingly, I found a decent conversion method to get this thing done. I used .NET reflector. I used reflector to disassemble C# .exe and then to convert the code to VB. Reflector did a good job and produced following VB code


Friend Class Test
' Methods
Public Shared Function IsEven(ByVal number As Integer) As Boolean
Return IIf((number > 0), ((number Mod 2) = 0), False)
End Function

Public Shared Sub Main()
Console.WriteLine(Test.IsEven(2))
Dim f As Func(Of Integer, Boolean) = New Func(Of Integer, Boolean)(AddressOf Test.IsEven)
Console.WriteLine(f.Invoke(2))
Dim f1 As Func(Of Integer, Boolean) = j => ((j Mod 2) = 0)
Console.WriteLine(f1.Invoke(2))
Console.ReadLine
End Sub

End Class

The only point it tripped is on the lambda expression syntax =>. So, I had to do a little bit of Googling to find the correct VB syntax. And, finally got the VB code like


Friend Class Test
' Methods
Public Shared Function IsEven(ByVal number As Integer) As Boolean
Return IIf((number > 0), ((number Mod 2) = 0), False)
End Function

Public Shared Sub Main()

Console.WriteLine(IsEven(2))
Dim f As Func(Of Integer, Boolean) = New Func(Of Integer, Boolean)(AddressOf IsEven)
Console.WriteLine(f.Invoke(2))
Dim f1 As Func(Of Integer, Boolean) = Function(j) j Mod 2 = 0
Console.WriteLine(f1.Invoke(3))
Console.ReadLine()

End Sub
End Class

I enjoyed this exercise. In fact, in the same edition of the VS magazine, I found couple of interesting articles - What VB Devs Should Know About C# and What C# Devs Should Know About VB.

If you are involved in any migration effort from VB to C# or vice versa, or work in the mix environment with a lot of VB and C# code co-existing peacefully , then you will find these articles really useful.