Monthly Archives: December 2012

MODELING: AGGREGATION AND COMPOSITION

 

When you are modeling any software, these two (aggregation and composition) relationships occur  very often. I have posed this question to candidates during the interviews, to my surprise, the difference between hollow and solid diamond in UML is not well understood. I thought, I will explain that using a nice picture.

 

aggr and comp

AGILE – YOu are AS FAST AS THE SLOWEST LINK IN YOUR ORGANIZATION

Development-centric folks tend to come from a mindset where change is the thing that they are paid to accomplish. The business depends on them to respond to changing needs.

Operations folks tend to come from a mindset where change is the enemy.  The business depends on them to keep the lights on and deliver the services that make the business money today.

I have been part of many development groups. As part of the development team, you always like to use whatever is the latest (anything that shines will do). But QA and Operations look at things from a different perspective. Your Ferrari will come to a screeching halt when you arrive at the QA and OPS land (no offence meant here). But, in today’s world organizations cannot afford to operate in that mode. Many organizations are adopting the idea of DevOps in order to increase the collaboration  between development and operations group.

 

WallOfConfusion

 

dev vs ops

 

Some organizations have capability to support ten deployments per day.This daily deployment cycle would be much higher at organizations producing multi-focus or multi-function applications. How do they do it?

DevOps enables the benefits of Agile development to be felt at the organizational level. This concept revolves around the fact that “More and smaller changes–mean less risk”. This concept has introduced a new role called “Release coordinator” in the enterprise IT. The primary task of this role is to coordinate the deployments of enterprise software to pre-production environments.

Many organizations creates groups (hard line drawn between development and operations) that somehow increases this friction. Where as companies like Amazon have created groups which are completely responsible for a given service. The team is responsible for scoping out the functionality, architecting/designing, building it, and operating it. What they have done is, developers are also given operational responsibilities. According to their CTO, this has increased the overall quality of the services both from customer and technology point of view. I must agree with this mindset of You build, you run it.

At Boing ( I was told), all the design engineers are also supposed to fly during the test flights. Imagine what kind of impact this will have on the designers and who build it!. Similarly when developers are also made part of the operational experience (pagers going off in the middle of the night due to outage etc.), things will change for the better for sure.

MY BLOG VISITORS

I just started blogging to share some of things I encounter in my professional life. It is quite interesting to know that people from so many different countries are visiting this blog. Internet is amazing.

visitors - country

ISHIN SERVER–INITIAL EDI PROCESSING BENCHMARKS

 

Most of the core is built and tested. We are getting ready to release the software in Q1 2013. I had a chance to run some tests to see the performance. These results are from the debug run. Even then, results are looking very good.

835 bench marking

Every claim is made to go through a pre-defined execution pipeline. You may perform things such a NPI verification, routing based on denial amount, if the paid amount is less than some pre-set percentage  notify people etc.. At the end of all this processing, every record is stored in the database including all the operational information. This information is taken from one of our development machine (which is not one of the great machines).

More than this, we are excited about our offering which provides unprecedented horizontal scaling when it comes to EDI processing. I will write more about this in coming few days. If you are in the EDI business where you have to handle large number of records on a regular basis, please contact me at shanthu@palisha.com.

message processing

DATETIME TICKS FROM JAVASCRIPT TO MVC CONTROLLER

There are many circumstances in projects where you have to dynamically create the Uri in your JavaScript to call an action from one of the controllers. If you have to pass the date parameters using ticks, you have keep the following in mind.

tick conversion between JS and C#

Both sides (JavaScript in your browser and MVC controller’s .NET code) do now use the same frame of reference while converting to ticks.

SCOTT GUTHRIE SHOULD BE MICROSOFT CEO

 

This is one my random thoughts….

I have nothing against Steve Ballmer. In last few years, the quality of the products from Microsoft have improved to their highest level under his leadership.

Microsoft is a technology company. Having that edge about knowing technology in addition to other skills CEO’s need (just like Bill Gates/Steve Jobs did.) is an important asset IMHO. Scott, in spite of being in very senior position, he is still a very technical person. When things changed from “client server” era to “Web” era, he was there to take their company in the right path (through their asp.net initiates). Now he is going to do the same with their cloud initiatives (I hope he leads their mobile division as well!) .

EMPIRICAL PROCESS MODEL–BE AGILE

 

When the requirements are agreed upon and the technology is well understood (good examples of this categories are building a house or a bridge) the project falls under ‘Simple’ region in the Stacey’s matrix (see the picture below). In these scenarios waterfall approach will work just fine.

Process Models

However, in reality most of the projects fall under ‘complicated’ or ‘Complex’ region. In these cases, rather than laying out elaborate plans that you know will change, it is often better that you create a more fluid options. Try a little, inspect the results, and adapt the next steps based on the lessons learnt in previous cycles (sprints). Indeed, this is exactly what’s known as the empirical process model.

WINDOWS SERVICE BUS – SMART QUEUE LISTENER

 

Writing elegant software is an art. There are several ways by which you can consume the items in service bus queue. Following code shows one of the elegant ways of achieving that. When you are writing scalable server side software, WORKER-BOSS pattern comes handy.

Imagine boxes coming on a conveyer belt and worker at the end of it are responsible for taking those boxes and loading them onto a truck. If the speed of the belt is high, you need more workers to keep up with the arriving boxes.

Similarly, in the software world, if the queue items are arriving at an higher speed, you would rather prefer an option to control the number of processes (or worker threads) who will process these queue items. The following Smart queue listener class is designed to achieve this goal. Also, what you with the message varies on your context. This class takes function pointer (term used loosely). This function will be executed for every incoming message.

Also note that, this listener is asynchronous (non-blocking).

Enjoy the code and feel free to use it anywhere you want!

Code Snippet
  1. public class SmartQueueListener
  2. {
  3.     int _threadCount = 4;
  4.     BlockingCollection<Task> _dequeueTasks = null;
  5.  
  6.     Action<BrokeredMessage> _dequeAction;
  7.  
  8.     //I have several tasks created in a loop. Im going to use just one cancellation
  9.     //token so I can cancel them all at once.
  10.     CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
  11.  
  12.     public SmartQueueListener(int threadCount, Action<BrokeredMessage> dequeAction)
  13.     {
  14.         //Guard.ArgumentNotZeroOrNegativeValue(threadCount, "threadCount");
  15.  
  16.         _dequeAction = dequeAction;
  17.  
  18.         _threadCount = threadCount;
  19.         _dequeueTasks = new BlockingCollection<Task>();
  20.  
  21.         for (int i = 0; i < threadCount; i++)
  22.         {
  23.             //I am passing this to the task
  24.             int taskId = i + 1;
  25.  
  26.             // Start a new dequeue task and register it in the collection of tasks internally managed by this component.
  27.             _dequeueTasks.Add(Task.Factory.StartNew(DequeueTaskMain,
  28.                                                     taskId,
  29.                                                     _cancellationTokenSource.Token,
  30.                                                     TaskCreationOptions.LongRunning,
  31.                                                     TaskScheduler.Default));
  32.  
  33.         }
  34.  
  35.         // Mark this collection as not accepting any more additions.
  36.         this._dequeueTasks.CompleteAdding();
  37.     }
  38.  
  39.     private void DequeueTaskMain(object state)
  40.     {
  41.         //Takes most of the information from config file    
  42.         MessagingFactory messagingFactory = MessagingFactory.Create();
  43.         NamespaceManager namespaceManager = NamespaceManager.Create();
  44.  
  45.         BrokeredMessage message = null;
  46.         QueueClient myQueueClient = messagingFactory.CreateQueueClient("OrderQueue");
  47.         while ((message = myQueueClient.Receive(new TimeSpan(hours: 24 * 24, minutes: 0, seconds: 5))) != null)
  48.         {
  49.             Console.WriteLine(string.Format("Message received: {0}, {1}, {2}", message.SequenceNumber, message.Label, message.MessageId));
  50.  
  51.             try
  52.             {
  53.                 _dequeAction(message);
  54.             }
  55.             catch (Exception ex)
  56.             {
  57.  
  58.             }
  59.  
  60.             message.Complete(); //call this if the message is successfully processed
  61.             //message.Abandon(); //call this if the message still needs to available in he queue
  62.         }
  63.     }
  64.  
  65. }

 

Following code segment show how you could use this smart listener

Code Snippet
  1. class Program
  2.     {
  3.         static SmartQueueListener _listener = null;
  4.         static void Main(string[] args)
  5.         {
  6.             SmartQueueListener listener = new SmartQueueListener(5, ProcessMessage);
  7.             Console.Write("Press ENTER to exit");
  8.             Console.ReadLine();
  9.         }
  10.  
  11.         static void ProcessMessage(BrokeredMessage message)
  12.         {
  13.             int myContent = message.GetBody<int>();
  14.             Console.WriteLine(string.Format("Message received: {0}, {1}, {2}", myContent, message.Label, message.MessageId));
  15.         }
  16.     }

MVP (MINIMUM VIABLE PRODUCT)

“If You’re Not Embarrassed By The First Version Of Your Product, You’ve Launched Too Late” – Reid Hoffman, the founder of LinkedIn

It is a common tendency among many entrepreneurs to build that perfect product. In that process they miss many important things that needs to be done in order to build a successful company. Instead of validating the idea with couple of customers in real world, you lock yourself in your comfort zone (your comfortable office, using computer/software of  your choice, no-one to tell you that what you are building may be completely useless etc.). Trust me, I have been there and done that. Until you realize that, it is just an expensive hobby of yours. It is important to build MVP and get out of your office to test it in a real world,

So many articles have been written on this topic and I am not going to cut and paste all that great stuff here. If you want to be an entrepreneur, you must look into some of these concepts.

You can start here perhaps: http://www.theleanstartup.com

More on this top topic later…