Wednesday, November 27, 2013

.net 4.5 Data Parallelism vs Task Parallelism

If you have come across TPL task parallel library of .net 4.5 its important that you also have focus on below new library.

  • Task parallelism is the simultaneous execution on multiple cores of many different functions across the same or different datasets.
  • Data parallelism (aka SIMD) is the simultaneous execution on multiple cores of the same function across the elements of a dataset.

    Data parallelism is pretty simple. It is the concept that you have a lot of data that you want to process — perhaps a lot of pixels in an image, perhaps you have a whole lot of payroll cheques to update. Taking that data and dividing it up among multiple processors is a method of getting data parallelism. This is an area that supercomputers have excelled at for years. It is a type of problem that is pretty well understood and more emphasis has been put on data parallelism in the past than on task parallelism.
    Task parallelism, on the other hand, is where you have multiple tasks that need to be done. So perhaps you have a large data set and you want to know the minimum value and you want to know the maximum and you want to know the average. This is a rather trivial example but you could have different processors each look at the same data set and compute different answers. So task parallelism is a different way of looking at things. Instead of dividing up the data and doing the same work on different processors, in task parallelism what you're doing is dividing up the task to apply.
    The most common task parallelism is something called "pipelining

    Data Parallelism



    Task Parallelism


    void Main(string[] args)


    Task[] tasks = new Task[2]


    Task.Factory.StartNew(() => {

    TaskA objTaskA=new TaskA();

    // objTaskA.MessageSent += MessageSent;

    // objTaskA.TaskCompleted += TaskCompleted;



    Task.Factory.StartNew(() => {

    TaskB objTaskB=new TaskB();







    Tuesday, November 26, 2013

    VS2012 IDE Issue No exports were found that match the constraint contract name

    Today I tried to add new project in VS2012 IDE for development it didn't allow me to proceed as it popup an error stating this
    VS2012 IDE Issue No exports were found that match the constraint contract name

    I got the workaround in Stackoverflow-

    Step 1: Close VS2012
    Step 2:
    Just delete or rename this folder:

    Step 3:
    Restart VS2012

    The probable reason would be VS2012 had not been closed for longer period of time therefore resulting in above error.

    Technical Design - Application Architecture These Terms does matters.

    At application architecture level, we come across layers and tiers terminology.I will not delve much into these terms now but would rather focus on the details of it.  Yes we know presentation , business, service , data access layer and many such stacks that defines application architecture at logical level. We then built solution taking these layers pointers into consideration. Then comes what the code files where we have domain entities, utilities , classes, interface and so on..

    Well, sometimes it becomes non trivial to appropiately name such source code files unders these layers.

    To complete these blogs actually I need an expert advice to make this meaningful and comprehensive. I'm sure there is no such reference atleast available online. Everyone has their own theisis of explanation and fundamentals behind.

    Most common suffix ending list of file name.

    1. Manager
    2. Provider
    3. Handler
    4. Helper
    5. Factory
    6. Services
    7. Extender
    8. Contract

    So On

    The point is as naive architecture I may put them wrongly and may latter refractor based on review. I'm sure there can be rule book across but fail to find one.

    Need help.

    Thursday, November 14, 2013

    Predefined type 'System.Object' is not defined or imported

    This is rarest of the rare error that comes when we build/debug solution in Visual Studio for .net . The problem is the missing MSCORLIB dll system.core which somehow not exists in .csproj file. The developer resort this by recreating new solution or clean the folder, get the latest code from TFS and then build it. But the problem sometimes lies as-is. One can take this to next level by locating this tag . if this is not present Add this. Forgot to mention, open this file in notepad rather VS IDE.

    Then you rebuild the solution once again to get your ANIMAL(I mean your solution-which may have large number of class library in it) run.
    Do post your comment if run into similar problem or please let me know the best way to get away with this one.

    Tuesday, November 12, 2013

    Design Pattern and Most general Software Terminology

    Its long time in my career and sometimes we flumble with the basics, concepts and fundamentals.
    Here is the list of few design patterns or terminology where we come across during day to day SDLC life cycle. I will try updating this particular post in future to include the most favourable one.

    Facade: It provides simplied interface to a larger body of code-class library. In simple terms a group of class library or dll referenced in single interface and this later expose to calling events or client.
    Purpose - It wraps poorly designed collections of API into or with single well designed API.

    Adapter : Is also called Wrapper pattern or Decorative pattern (GOF ). The actual usuage or orgin, when one should coin this- This is to be used when we have module which is to be used but incompatible with other module. At such places we create interface out of the class and create compatible bridge to use across.

    Boiler Plate  Code- Is a section of code that can be included in many place with no or minimal changes.

    • Shotgun Debugging- To apply too many solution at a time to solve issue.Troubleshoot.
    • Spaghetti Code- To many branching of code, difficult to read and understand
    • Smoke Testing- To do high level testing to ensure system do not break. This ignores finer level of testing. Imagine a smoke pass into pipe to check leak
    • Regression Testing-Testing to ensure new changes do not break existing functionality.
    • Write Only Code- Difficult to read
    • Runtime-
    • Break Fix-
    • Service Pack
    • Drivers
    • HotFix-
    • Refactoring- Change system internally without affecting functionality.
    • Pilot
    • Prototype
    • Proof of Concept
    • Psuedo Code- Code that is written in user readable format unlike programming language.
    • Peer Review
    • Patch
    • Plumbing work
    • Legacy System
    • Gold Code- Code that is live and burn in disc. Final release product.
    • Gap Analysis
    • Impact Analysis
    • Evaluation
    • Feasibility Check
    • AntiPattern- In appropiate solution for a problem but still used as temporary setup.