Jun 6, 2009

Software Engineering ≠ Computer Science [Source: DDJ.COM]

Giving The Signal! (Rubik's Cube)Image by Gojca via Flickr

A great post on practical issues surrounding Software Engineering and why Software Engineering is different from Computer Science. The author points out the human factor as the key to all issues and why Software Engineering will never be as rigorous and predictable as Computer Science.

The complete article at Dr.Dobb's journal here.
Must Read!

Reblog this post [with Zemanta]

Jun 2, 2009

The Rise of China

Territories currently administered by two stat...Image via Wikipedia

The Rise of China has been astounding since the dawn of new millenium. Considering the number of years since China has taken center stage, it's growth and rise to power is unimaginable for any other country on earth. Historically, China is probably the only country after the western powers to grow economically and militarily. With the world split into American and Anti-American, Chinese are finding friends around the world in the Anti-American camps. A notable achievement though is to not only militarily surpass USA, but also financially with China's investment of trillions of dollars in US Fed thereby virtually controlling the American economy. With huge exposure to China in terms of investments in Fed and dependency on cheap Chinese exports, US is historically in a tight corner to support its arch rival's growth to sustain its own.

Taking advantage of this situation, China has expanded their clout around the world funding every Anti-American country into its way. Chinese funding of South American countries, Africa and the Asian countries such as Pakistan, Burma, Srilanka has followed the strategy of US in the post-world war era. China has heavily invested in these countries to gain clout over the natural resources as well as military positions across the globe, the same way the US did in the post- world war era building military bases around the world and gaining clout as the super power. China is building ports in major countries surrounding India to establish its clout in South Asia.

Also, China has grown into the largest consumer of cars supassing US for the first time in the history, as Chinese government has been pushing to create China into a consumer market propelling growth domestically than reliance on the US exports. China mustered its clout recently by demanding an alternative global currency to US dollar and providing Chinese currency as mode of funding to promote its currency globally.

On the controversial side, China is known for notorious human rights abuses, stealing intellectual property from global in Chinese soil, tight control over media and the list continues.

Reblog this post [with Zemanta]

Jun 1, 2009

Switching Silverlight 2 and 3 development

Image representing Microsoft Silverlight as de...Image via CrunchBase

For all those developers writing code on Silverlight 2 and 3 at the same time, Visual Studio 2010 IDE will allow development using both versions. For those who can't wait, here is a quick fix to switch between Silverlight 2 and 3 environments quickly. Checkout the link below.

http://blogs.msdn.com/amyd/archive/2009/03/18/switching-from-silverlight-3-tools-to-silverlight-2-tools.aspx
Reblog this post [with Zemanta]

May 28, 2009

History erased in the most cruel manner in China

Uighurs represent a minority islamic community in China with life as simple and ancient as their ancestors. The city has houses that are hundreds of years old. With the Chinese government stating the risk of impending earthquake catastrophe, has initiated complete demolition of the entire city of Kashgar and rebuilding modern structures. The government can relocate them tomore safer structures, but should preserve the old city as a heritage center instead of demolishing it. The NY times article presents more detailed picture of the situation. 


Here is the audio presentation about the same.
http://www.nytimes.com/interactive/2009/05/28/world/asia/20090528-kashgar-audioss/index.html

May 9, 2009

See what happens when you put off or stop caring about…

  • Checking your email every ten minutes.
  • Having everything finished on your to do list.
  • Having an immaculately clean house.
  • Trying to please everyone.
  • Seeking praise and popularity.


May 6, 2009

composite application guidance framework - building modular systems

Loading modules based on rules. This allows you to only load modules that are applicable for a specific role. An application might retrieve from a service the list of modules to load.

Loading modules from different locations. A Windows Presentation Foundation (WPF) application might retrieve modules from the Web, from the file system and/or from a database. A Silverlight application might load modules from different XAP files. However, most of the time, the modules come from one location; for example, there is a specific folder that contains the modules or they are in the same XAP file.

guidelines for developing a modular system:
- should be opaque to the rest of the system and initialized through a well known interface
- modules should not directly reference one another or the application that loaded them
- should use loosely coupled techniques such as shared services to communicate to each other or to the application that loaded them instead of communicating directly
- modules should not be responsible for managing dependencies. should be managed externally through dependency injection
- should not rely on static methods, which inhibits testability
- modules should support being added and removed from the system in a pluggable fashion

design a modular system:
- define module's responsibilities
- module to have distinct set of responsibilities
- each module consists of its own presentation layer, business layer and resource access layer

communication patterns between modules:
- loosely coupled events: publish and subscribe to events for communciation between modules. pattern works when the number of events required to fulfill a task is small. otherwise, overheads happen due to wait time for the event triggers.
- shared services: a class that can be accessed through a common interface. a shared assembly containing common functions such as authentication, logging, configuration is an example.
- shared resources: modules can communicate indirectly through a database or web service instead of communication directly

team development using modules:
- infrastructure team: cross module interfaces and functionality such as logging, authentication
- ui team: shell and visual components design
- operations team: managing deployment of modules

UI composition:
views from multiple modules have to be displayed at run time in specific locations within an application's UI
developer defines layout with named locations within which the views will be displayed at run time
layout can evolve independently wihtout affecting the modules that are adding views to the layout
shell of the application defines the layout at the highest level
the module that defines the view and the view being displayed doesn't have knowledge of how it be displayed in the named location

view discovery approach for composite ui design:
modules can register views against a particular location
when that location is displayed at run time, the registered view will be automatically created and displayed
modules register views with the registry
parent view queries the registry for views registered with a particular location
displays views in the named location control
after the application is loaded, the composite view is notified to handle the placement of views that are added to the registry
composiste application library defines a standard registry called RegionViewRegistry to register views for named locations

view injection approach to composite ui design:
views are programmatically added or removed from a named location by the modules that manage them
application contains a registry of named locations
module can lookup locations in the registry and programmatically inject views into it
the locations adhere to a common interface to inject views
composiste application libarary defines a standard registry called RegionManager and an interface called IRegion for view injection

--> when to use view discovery versus view injection, see the UI Composition technical concept.


May 4, 2009

way to get my silverlight application talking to the COM port on my local computer

There's no access to computer resources, but you can communicate with sockets. So it's possible to have your users install an application which listens on a port and communicates with a COM port. You can do this by opening a socket connection from your Silverlight control to a local socket which intern have the COM port access

Use a XBAP (Browser Deployed WPF) that requests some extra permissions. Would live inside the browser, but only run on Windows machines with .NET 3.0 / 3.5 installed

Write an ActiveX control that talks to the local device and expose an API. Then use JavaScript to consume this API and interact with the JavaScript code from Silverlight. This would give you a in-browser application, but your users would have to install an additional device  ActiveX component.

SL and Javascript two way connectivity sample:
http://blogs.msdn.com/salvapatuel/archive/2008/05/01/build-interaction-between-javascript-and-silverlight-2.aspx

Calling ActiveX from Javascript
http://www.coderanch.com/t/121777/HTML-JavaScript/Editing-Excel-Sheet-using-javascript

Sample code to connect SL, Javascript and ActiveX
SL Mainpage.xaml:
<UserControl x:Class="JavascriptTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300"
             Name="Xaml1">
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel>
        <TextBox Name="NameTxt" Width="500" Height="20"></TextBox>
        <Button Name="NameBtn" Content="Send to JS"></Button>
        </StackPanel>
    </Grid>
</UserControl>

SL Mainpage.xaml.cs:
namespace JavascriptTest
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            NameBtn.Click += new RoutedEventHandler(NameBtn_Click);
            HtmlPage.RegisterScriptableObject("navObj", this);
        }

        void NameBtn_Click(object sender, RoutedEventArgs e)
        {
            HtmlPage.Window.Invoke("ExecuteAnimation", NameTxt.Text);
        }

        [ScriptableMember()]
        public void SendMessage(string state)
        {
            MessageBox.Show("Message reached SL");
        }
    }
}

test.html:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>JavascriptTest</title>
    <script type="text/javascript">
        function ExecuteAnimation(params) {
            loadexcel(params);
            alert("Hello, World");
        }
        function load() {
            var ctrl = $get("Silverlight1");
            ctrl.Content.navObj.SendMessage('Hello');
        }
        function loadexcel(params) {
            var ExcelSheet;
            ExcelSheet = new ActiveXObject("Excel.Application");
            ExcelSheet.Workbooks.Open(params);
            //ExcelSheet.Visible = true;
            // Place some text in the first cell of the sheet.
            ExcelSheet.ActiveSheet.Cells(1, 1).Value = "This is column A, row 1";
            // Save the sheet.
            ExcelSheet.SaveAs("C:\\TEST.XLS");
            // Close Excel with the Quit method on the Application object.
            ExcelSheet.Quit();
            // Release the object variable.
            ExcelSheet = "";
        }
        </script>
    <style type="text/css">
    html, body {
        height: 100%;
        overflow: auto;
    }
    body {
        padding: 0;
        margin: 0;
    }
    </style>
</head>
<body >
    <form id="form1" runat="server" style="height:100%;">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div  style="height:90%;">
            <asp:Silverlight ID="Silverlight1" runat="server" Source="~/ClientBin/JavascriptTest.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" />
        </div>
        <input type="submit" onclick="load()" />
        <input type="submit" onclick="loadexcel()" />
    </form>
   
</body>
</html>