Infosys Microsoft Alliance and Solutions blog

« September 2009 | Main | November 2009 »

October 30, 2009

Nano- Innovation : Is this the key to Mid-Markets?

Sometimes the inspiration for an idea is a ‘baby matter’. At least that is what inspired me for this post. There was  a post from Scott Anthony in Innovation Insights section of HBR titled Procter & Gamble and the Beauty of Small by Wins 

Today we are hearing a lot about Innovation and I do believe in the concepts around disruptive innovation and the way the industry has benefitted from the game-changing innovations. Disruptive innovations either create new markets or reshape existing markets by delivering relatively simple, convenient, low cost innovations to a set of customers who are ignored by industry leaders. However, is there a scope of little innovations bringing great benefits as well.

The essence of his post was that sometimes it is the simplest of things like altering the marketing message rather than going into innovative and path-breaking business models that are needed in business. Here is the extract from the post -


"The story dates back to the 1990s, when Healey was a brand manager in Brazil. She was responsible for growing P&G's Hipoglos brand of diaper rash ointments. The problem? The product already had 99 percent household penetration.


People claimed they used the product regularly to prevent diaper rash. If that were true, however, Healey knew consumers would buy much more Hipoglos than they did today.So, she dug deeper. By probing when consumers used the product, she found that parents applied it when early signs of rash began to appear. Of course, that's too late if you truly want to use a product for preventive purposes.


Healey had a critical insight. Consumers weren't actually realizing all of the benefits of the product, resulting in cranky babies and sleepless nights. P&G began running advertisements showing how applying the cream to an already emerging rash was too late to prevent the rash from occurring. Not surprisingly, sales soared.


Innovation doesn't always involve new features, functions, services, or business models. Sometimes it can be as seemingly simple as a new marketing message."


Even in the Information Technology sector people have been attracted toward the “bottom of the pyramid” (and have been trying hard to break the code). The essence is that there are number of small players; the market is cluttered and there are one man shops to huge firms across the world who are targeting this segment. While doing so everyone is looking at the factor of cost and seeing how they can help the SMEs to reduce their total cost of ownership (I am sorry I used this word too; which in itself is hated by few now). The line of thought is that if you are an SME you will face problems as you grow and when you have that critical mass to grow; you will need a solution. This mid-market enterprise level solutions including ERP and CRM solutions are “band-aid” solutions to the possible rashes that  you  may face.


In reality, there is never a right time to go in for this investment. That time is always when you start – “to prevent the rash from occurring”. The best-practices of some of the packaged solutions can actually help them in structuring the entire organization in such a way that these ‘rashes’ (problems) do not happen at all in the first place. This is especially true for processes which are not ‘sources of competitive advantage’ but are simply the ‘operation’ , ‘run-of-the-mill’ and ‘basis-for-survival’ processes like procurement, human resources, accounting, reporting, etc. which are necessary to optimize, manage, diagnose and control.


What it means for solution providers is that they need to bring out this message through an active recognition of the above fact and then relaying it out in a manner which is acceptable to potential customers. It is not that people are not providing these services –SaaS, Pay-as-you-use, subscription based services, etc. have been there for long; what is  missing is the convincing story behind this revolution. These are still being sold as solutions for immediate problems without a solid story of how they will relate to the long term growth of the client organization.


Do I have a perfect answer to this? No; because if I had one I would have applied that in the messaging already or is it that a revenue/margin/QoQ growth driven organizations are missing a point in the investment needed in this area which can be a long term revenue driver. I can’t say for sure, can you?

October 16, 2009

Recommendations for building Highly Available .Net application

Recently I came across a query on what does it take to build highly available .Net applications. Following are some inputs that can help. The recommendations are classified into buckets of cross cutting, presentation, business and persistence layer.

Cross cutting related
  1. Consider Vertical and Horizontal partitioning of the application logic into layers and tiers, application having independent presentation, business and data layer is essential to build highly scalable and available application
  2. Consider Internet Information Server (IIS) 7.0 and above at Web Server and app server tier,  Windows Server 2008 as Server Operating System, SQL Server 2005 or higher for Databases
  3. Take special care while selecting 3rd party components in the application architecture, usually not appropriately tested components can cause memory, security leaks leading to main application down. e.g. ODP.Net driver version 10.2.0.2.1 causes memory leak issues when used in .Net application. Check and use version which is latest and appropriately tested.
  4. Design self healing applications, applications which log data and based on type of error and knows how to recover without administrator intervention.
  5. Select logging, tracing and exception management framework which logs correct and useful information. Enterprise Library blocks can be considered for the same. Always provide graceful code exits than aborts.
  6. Ensure code review is done for the complete application and standards, best practices are adhered to. No infinite loops, and avoid recursion logic.
  7. As far as possible use the namespaces, apis, controls, components available OoB with framework than trying to implement same functionality through user defined programs
  8. Thoroughly Test application for security attacks like SQL injection, Denial of service attacks
  9. Ensure and plan for soft and hard memory growth with increase in number of users.
  10. Ensure software releases, service packs are appropriately tested before rolling out in production.
  11.  Ensure appropriate latest antivirus software's are  installed in the environment
  12. Provide appropriate page security using transport security (https), data encryption using encryption algorithms, secure user logins implement certificates using 3rd party security certificates like Verisign.
  13. Design system for least access rights, low surface area.
  14. Least access right means to run an application, it should need least amount of privileges. Low surface area means application will expose limited software surface area or endpoints which are accessible by other applications, possibly implement this by writing modular windows services.
  15. Consider software and hardware firewalls, as far as possible place database server and application server behind firewalls in the order mentioned.
  16. Conduct memory profiling, perfmon analysis for appropriate memory and security counters before releasing application into production

Presentation Layer

  1. Consider using disconnected scenarios when applicable. Use MS Smart client - Composite Application Block.
  2. While designing stateless applications, remember to disable view state of controls, pages.
  3. Plan appropriate size aspx pages and avoid too many controls on the page. Split complex functionality into multiple pages, tabs to reduce page size loads.
  4. Implement client side Java script validations and report errors at presentation layer itself for data inappropriateness without making server calls
  5. Appropriately employ Ajax behavior in the application/pages. Ajax calls leads to increase in network calls.

Business Layer

  1. Assign dedicated Application pool for application hosted in IIS
  2. Provide Caching in the middle tier and presentation layer.
  3.  For Distributed Caching, use Velocity framework. For application level caching one can use EL Caching block. Refer this for more info. State server provides reliable cache than InProc.
  4. Write deadlock free Database and Dotnet programs, use appropriate threading and monitoring, mutex mechanisms.
  5. For long running or Human workflow, consider persisting Workflows. .Net 3.5 has persistence feature which is further improved in .Net 4.0 Windows Workflow.
  6. Consider designing stateless WCF services using appropriate configuration parameters for singleton, state full, per session, etc.
  7. Use connection, session and thread pools and set respective timeouts
  8. As far as possible avoid invoking unmanaged code from .Net, if the need be ensure the unmanaged objects are released from memory
  9. Microsoft Dublin, currently in beta can be considered as part of application server for hosting Windows Workflow, WCF, Workflow Services as it provides high availability, scalability, reliability by providing features for persistence, state management, monitoring, etc.
  10. Consider .Net Configurations (xml) for driving application settings, as one doesn’t have to restart the application for changes to take place.
  11. Consider Clustering, Load balancing for presentation, business logic and Database tier
  12. If possible, consider separating stateless logic from state full and plan independent hosting for the respective ones. Consider application pool recycling for stateless sites.
  13. Consider setting web garden for multi core CPUs. Number of cores = Maximum Worker processes
  14.  Consider Caching in the middle tier and presentation layer.
  15.  For Distributed Caching, use Velocity framework. For application level caching one can use EL Caching block. Refer this for more info.
  16. Consider asynchronous communication (fire and forget) patterns for modeling  long running transactions, workflows. 
  17.  Appropriately close WCF proxy connections on client, also plan for exception conditions. Recommended practice is mentioned here 
  18. If not appropriately written, developer written threading logic can cause unexpected application behavior, hence write it only when necessary. 
  19.  Avoid using GC.collect(), as .Net automatically schedules Garbage collection(GC) when memory pressure builds up, no need to force it, as and when GC happens all other operations are suspended.

Persistence Layer

  1. Microsoft will stop supporting Oracle driver for .net from 4.0 onwards, if planning to use ODP.net, consider using driver for 11G and above.
  2. Physically separate Reporting, data warehousing from real time OLTP data
  3. Consider Partitioning (horizontal, vertical) Database.
  4.  Consider Database Replication options (transactional, merge, snapshot as applicable) for high Database availability.
  5.   Have appropriate Database archival and backup strategy

By no means this is an exhaustive list; please feel free to add points based on your experience.

October 15, 2009

Sketchflow

I have been busy with various other non-technical work for few months and hence didn't get a chance to experiment anything new Off late. I finally managed to find time and check out Sketchflow. Sketchflow is a new tool available along with Expression 3 Suite which allows quick and easy prototyping. It allows one to create prototypes that are very near real appliation like, but still retain their prototype look and feel (by using wiggly styled controls) and allow for easy feedback back and forth between you and your customers.

If you have't seen this as yet, you can get a very good idea on it by checking out the following
1. Keynote video from MIX 09, where Jon Harris showed a very interesting Sketchflow prototype. You can skip to about 1 hr 39 min into the video to directly jump to this part
2. From Concept to Production video, another session from MIX 09, by Christian Schormann, where he walks through a snowboard sketchflow prototype. This and the keynote video code comes as part of samples with Blend 3.
3. A very good step by step walkthrough of Sketchflow is available at the dynamic prototyping site.

I am enjoying working with Sketchflow.

Windows 7 Wireless networking

Atul has been regularly blogging about Windows 7 many good features and few issues. Here's something that found very good. Could not test it earlier as I was having issues with broadband connection at home. Those have been fixed now.

Good news is Wireless works seamlessly between office and home. This used to be an issue with Vista, where in i had to change the IP settings for office and home. I connected my laptop to wirless broadband at home, it automatically got the IP address. I didn't event have to change the browser proxy settings. Internet just works. Got into office, thinking I had to change the settings and enable/disable the wireless adapter. Just resumed the windows and logged onto the domain. I get a window asking me to choose which group I belong to. Selected Work and the wireless connection just works. This used to such a chore everyday morning while shuttling between home and office.

October 14, 2009

Silverlight on IE 8

My team members are working on a Silverlight based application to be deployed on Cloud. Things were going smoothly when one of us tried accessing this application via IE 8 and we were surprised to see the application not filling 100% height but taking about 25% space only. We tried various options for setting the height to 100% like setting it for body element, as well for the form element etc, but with not much luck.

Finally, found a workaround on the forum here. Setting the meta tag in the head to enable IE 7 compatibility (<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />) worked. This is surely not the preferred solution, but it got us going. Do share if there are any other options that may have worked for you.

ASP.NET MVC 2 Preview 2 Released

On October 1st Microsoft released ASP.NET MVC 2 Preview 2 for Visual Studio 2008 SP1 (and ASP.NET 3.5 SP1), which builds on top of the work they did in Preview 1 released two and a half months ago.

Some of the new features that have been added to the latest version of the framework include jQuery validation library to provide client-side validation based on the model’s validation metadata, single project areas for developers who wish to organize their application without requiring multiple projects, Model Validation Providers which allow hooking in alternative validation logic to provide validation when model binding, Metadata Providers which allow hooking in alternative sources of metadata for model objects etc.

The tools for this particular release only work in Visual Studio 2008 SP1. The version of ASP.NET MVC 2 Preview 2 for Visual Studio 2010 will be released in-the-box with Visual Studio 2010 Beta 2.

ASP.NET MVC – Understanding the Model-View-Controller (MVC) pattern

ASP.NET MVC is something that Microsoft started talking about approximately 2 years ago! In October 2007, Scott Guthrie presented the first preview of the ASP.NET MVC framework at PDC. Before ASP.NET MVC came into the picture, the .NET platform did not provide the building blocks to develop a web application which uses the Model-View-Controller architecture. This was something that the .NET developer community had been asking the ASP.NET support team for, since a very long time. Ever since the first preview of the framework was released, the interest in this framework has been growing, and a vast amount of sample applications, components, and so on have been released on the Internet by enthusiast bloggers and Microsoft employees.

For the sake of people who are not really clear as to what Model-View-Controller (MVC) pattern is, it would be better that we start off by describing what MVC is. MVC is basically a UI design pattern. The main purpose of this design pattern is to isolate business logic from the user interface, in order to focus on better maintainability, testability, and a cleaner structure to the application. The MVC pattern consists of three key parts: the model, the controller, and the view. Let’s delve a bit into these key parts.

Model
The model consists of some encapsulated data along with its processing logic. The model object knows all of the data that needs to be displayed. It can also define some operations that manipulate this encapsulated data. It knows absolutely nothing about the graphical user interface—it has no clue about how to display data or respond to actions that occur in the GUI. Often, model objects retrieve and store model state in a database. For example, a Customer object might retrieve information from a database, operate on it, and then write updated information back to a Customers table in a SQL Server database. Simply put, the model contains the business logic.

View
Views are the components that display the application's user interface (UI). The view object refers to the model. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Product object. Simply put, the presentation logic is located in the view component.

Controller
Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. Actually, the controller object is the interaction glue of the model and the view. Hence the controller object has to interact both with the model and the view. Simply put, the controller contains the input logic.

If you have now understood what exactly do we mean by terms like Model, View and Controller, you would be able to appreciate the fact that the MVC pattern ensures that there is a clean separation of different aspects of an application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic is in the view. Input logic is in the controller. Business logic is in the model. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. For example, you can focus on the view without depending on the business logic.

What this also means is that we can now think about parallel development. For example, one developer can work on the view, a second developer can work on the controller logic, and a third developer can focus on the business logic in the model.

Now the question is - how would they test these components independent of each other? This brings us to another major advantage of adopting this pattern. The MVC pattern makes it easier to test applications. The MVC framework decouples the components and makes heavy use of interfaces, which makes it possible to test individual components in isolation from the rest of the framework.

October 12, 2009

Visual State Manager feature for a WPF project – Expression Blend Based Approach

The Visual State Manager feature of Expression Blend 3 works right out of the box for Silverlight development projects. For WPF projects, the feature is not supported out of the box.  A few simple steps listed below can help you get there.

Visual State Manager was introduced in Expression 2.0 version.  WPF platform has been out much before that so the catching up was done by releasing the WPF Tool kit  The WPF Toolkit is a collection of WPF features and components that are available outside of the normal .NET Framework ship cycle. The WPF Toolkit not only allows users to get new functionality more quickly, but allows an efficient means for giving feedback to the product team.
For Expression Bled 2, the tool kit had to be separately downloaded and configured.  With Expression Blend 3, the WPFToolkit is a part of the install process.
Here is what you need to do get the Visual States Manager to work ( after WPF Toolkit is installed) inside a WPF project.

  1. Create the following registry value and make it non-zero. The value should be of type DWORD. 
    • 32 bit OS : HKLM/Software/Microsoft/Expression/Blend/EnableVSM
       
    • 64 bit OS : HKLM/Software/Wow6432Node/Microsoft/Expression/Blend/EnableVSM
       
  2. If Blend was running during the previous step then restart it.
     
  3. Create a new WPF project.
     
  4. Add %Program Files%\WPF\WPF Toolkit\...\WPFToolkit.dll to the References folder (Right-click the References node in Project, then click Add Reference…).
     
  5. Close and reopen Window1.xaml. The States pane will now appear for the project.

Built-in WPF controls (such as Button and CheckBox) weren’t designed with VSM in mind, the toolkit works some event interception magic that means your Visual States are applied provided they’re given the standard names such as Normal, MouseOver, Pressed, Disabled, Unchecked, Checked and so on. You can also use VSM-for-WPF to add interactivity to new custom controls you author yourself, although be aware that Blend will not read any default VisualState information out of the default template. And of course you can also add VSM interactivity to UserControls. An excellent resource for Visual State Manager Design and Authoring can be found here on the Expression Blend team blog site.

October 01, 2009

WCF 4.0 –Part 1

WCF 4.0 will be available with .Net framework 4.0 and builds upon the features provided by WCF 3.5 (including SP1). WCF 4.0 brings in several features to make the life of developers and application administrator easy. To enhance the support for REST Services, certain features from REST starter kit are also integrated with WCF 4.0. In this blog let’s take a look at features which simplifies things for application administrators

1) Configuration less WCF, and automatic endpoints

WCF achieved Unification of multiple distributed technologies like asmx services, msmq, remoting, COM+ by abstracting their respective protocols through bindings, while doing so it introduced additional complexity of managing it through configuration files which were nonexistent with ASMX services. Of course flexibility comes with a price.

Applying bindings and behaviors specific to different distributed scenarios needs thorough WCF understanding and once Services are deployed in production; administrators find it difficult to tweak the system.servicemodel section to maintain it.

WCF 4.0 removes the need of having configuration files. It does this by providing default endpoint and behavior. Default endpoint only kicks in when the service has not been configured with any endpoints.

Depending on .net 4 machine.config mapping, WCF picks up the binding. For Http if the binding defined is BasicHttpBinding it will use it. One can change the binding for a specific protocol like http, tcp, msmq, etc.in machine.config. e.g. change to WsHttpBinding instead of BasicHttpBinding for http.

2)  Default Behavior

Similar to default endpoint WCF also provides default behavior. Unlike 3.5 where behavior configuration needs to be specified explicitly using attribute <behaviorConfiguration>, one doesn’t need to specify the behavior explicitly in 4.0.If you don’t specify behavior in 3.5 services it will fail to compile whereas the same service will compile and work with 4.0

3)      Standard endpoints

Standard endpoints are pre bundled end points that WCF can use without developer needing to define details of it. These endpoints are defined using <Kind> attribute. Some of the standard endpoints are udpAnnouncementEndpoint, udpDiscoveryEndpoint, workflowControlEndpoint, mexEndpoint.

In the following example for mexEndPoint, note there is no mention of binding and contract

<system.serviceModel>  

   <services>      

      <service name="GreetingService">       

      <endpoint binding="basicHttpBinding" contract="IHello"/>  

      <endpoint kind="mexEndpoint" address="mex“

      </service>

   </services>

</system.serviceModel>

4)      File-less Activation (no .svc)

Http://xyz.com/abc.svc  .svc at the end of url makes it user unfriendly. It also makes it Low REST service as it donot follow the REST URI principle.

Till date developers have to overcome this limitation by implementing URLReWrite module in IIS. Writing custom code to implement this is error prone and needs maintenance over a period. WCF 4.0 has introduced a feature to access WCF services using attribute called as relativeAddress.
Following .config setting depicts how a PaymentService can be accessed using relative URL.

<system.serviceModel>

    <serviceHostingEnvironment>

      <serviceActivations>

        <add relativeAddress="/Payment" service=“PaymentService.svc"/>

      </serviceActivations>

    </serviceHostingEnvironment>

  </system.serviceModel>

5)      Simplifying IIS/ASP.NET Hosting

WCF services are now that much simpler to write as it no more mandates writing Interface definition and one can directly write class and decorate it with Service Contract, decorate Service operations with Operation Contract as shown in below example. This makes it as simple as asmx services. Top it with no configuration files and hosting in IIS gets that much easier.

[ServiceContract]
public class CalculatorService
{
    [OperationContract]
    public double AddNumber(double a, double b)
    {
        return a+b;
    }
}

All the above features in WCF 4.0 are mostly related to configuration. In the next blog we will dwell into what more WCF 4.0 has in store.

 

Subscribe to this blog's feed

Infosys on Twitter