Archive for January, 2006

Expression – Separation of Church and State

January 24, 2006

Having the ability to separate UI designers from developers has always been the holy grail of software development.

The technology has finally evolved to a point where it is not only possible but necessary for high quality user experiences.

A pre-beta version of a product called Expression Interactive Designer, formerly know as Sparkle, was made available today. Sparkle is a member of the Expression family of products.

I have no doubt that Expression will rock the industry.

The Expression Tools provide an exciting way for left brained and right brained people to collaborate and flourish.

The key underlying technology here is XAML (Extensible Application Markup Language).

Some FYI on Microsoft’s XAML:

  1. Microsoft’s XAML solution (formerly Avalon) is now called WPF/E (Windows Presentation Foundation/Everywhere)
  2. WPF/E has origins in a project called Glade.
  3. North Face Demo here uses XAML to provide a 3D shopping experience.
  4. Microsoft Max – http://www.microsoft.com/max/

Microsoft’s Max offers a glimpse of what will be easier to build next year using XAML with Peer to Peer file sharing.

Advertisements

2005 Worldwide PC Market

January 20, 2006

2005 was another record breaking year for PC sales.

In July 2004, the forecast was to see 1 Billion Windows PCs by 2010. It looks like we’ll see that number by May 2009.

By the end of 2005, there was approximately 650 million Windows PCs. 230 million PCs are expected to be sold in 2006. I’ll write more about this in another blog entry but the sales projection should look something like this.

 
Worldwide PC Sales Projection
# Date Total Windows PCs Linux/Apple PCs
1. 2004 : July-04 600,000,000 540,000,000 60,000,000
2. 2005 : Jan-05 640,071,631 576,064,468 64,007,163
3. 2006 : Jan-06 728,422,307 655,580,076 72,842,231
4. 2007 : Jan-07 828,968,246 746,071,421 82,896,825
5. 2008 : Jan-08 943,392,790 849,053,511 94,339,279
6. 2009 : Jan-09 1,073,611,638 966,250,474 107,361,164
7. 2009 : May-09 1,120,896,285 1,008,806,657 112,089,629

Before I get carried away with the future, here are my estimated worldwide sales numbers by vendor for the past year. These numbers were derived from IDC reports.

 
2005 Worldwide PC Sales by Vendor
# Vendor Units Sold %
1. Dell 37,754,066 18.1%
2. HP 32,539,416 15.6%
3. Lenovo-IBM 12,932,332 6.2%
4. Acer (mostly Europe) 9,803,542 4.7%
5. Fujitsu/Fujitsu Siemens 8,552,026 4.1%
6. Gateway 7,926,268 3.8%
7. Toshiba 7,509,096 3.6%
8. Apple 5,840,408 2.8%
9. Sony 4,588,892 2.2%
10. Alienware 4,171,720 2.0%
11. Other 76,968,234 36.9%
  Total 208,586,000 100.0%

200 Million PCs

January 19, 2006

200 Million PCs were sold worldwide in 2005!

According to IDC, a market intelligence company, the actual number is 208.6 million.

200 million is an interesting number. It’s even more interesting when you consider a 15% per year growth rate. If we assume a steady 15% growth then in 12 years, in 2017, we will see 1 billion PCs sold in 1 year.

Here’s the breakdown.

 
# Year Units Sold
1. 2006 230,000,000
2. 2007 264,500,000
3. 2008 304,175,000
4. 2009 349,801,250
5. 2010 402,271,438
6. 2011 462,612,153
7. 2012 532,003,976
8. 2013 611,804,573
9. 2014 703,575,258
10. 2015 809,111,547
11. 2016 930,478,279
12. 2017 1,070,050,021

Bill G Interview

January 10, 2006

Engadget did it again.

Interesting Bill G interview here.

Bill G shows that a grass roots media channel like Engadget may be
more effective than old school mainstream media (MSM).

Behemoth Mobile PC

January 6, 2006

I’m a sucker for the behemoth mobile category.

The bigger the better. I figure it’s good exercise when traveling.

Dell showed a mobile concept that had a 20 inch screen yesterday.

The system is called the Dell XPS Mobile Concept PC.

It’s probably a 10 pounder.

I hope they build it. Gotta have one!

MacWorld Keynote

January 5, 2006
 
They whole industry will be tuning to Steve Jobs MacWorld keynote on Tuesday, 1/10/2006.

Things I’ll be looking for:

 
There’s a funny Steve Jobs Saturday Night Live skit here.
 

Subversion Shelving

January 4, 2006
A previous post touted Team Foundation’s new Version Control shelve feature.
 
Michael Flanakin has a great post on how to do shelving with subversion here.
 
More info on Subversion:
 
  1. Tortoise is a great subversion client program: http://tortoisesvn.tigris.org/
  2. Subversion server software is here: http://subversion.tigris.org/
  3. A recommended subversion hosting provider is Wush.net. They are offering a deal for $6.67 per month.
 

Lambda Expressions

January 3, 2006

The origins of the term Lambda Expression can be traced to an American mathematician Alonzo Church. He published a paper in 1936 that introduced Lambda Calculus.

Lambda Calculus is used to investigate:

  • function definition
  • function application (implementation)
  • recursion

Lambda Calculus was influential in the design of LISP and eventually all functional programming languages.

You can find more info on LISP here.

The key capability of a lambda expression is that it provides a concise natural way to pass a code block as a parameter.

In C#, a lambda expression is implemented as an anonymous method.

Before we go further it is important to know about delegates.

A delegate is a data structure that refers to one or more methods, and for instance methods, it also refers to the corresponding object instance. The closest equivalent of a delegate in C/C++ is a function pointer. However, a C/C++ function pointer can only reference static functions. A delegate can reference both static and instance methods.


Simple C# Delegate Example: (20 lines of code)

using System;

class DelegateTest
{
  delegate void DelegateType();  // delegate method declaration

  static DelegateType GetMethod()
  {
    return new DelegateType(MethodBody);
  }

  static void MethodBody()       // method definition
  {
    Console.WriteLine("Hello");
  }

  static void Main()
  {
    DelegateType delegateInstance = GetMethod();

    delegateInstance();  // invokes method
    delegateInstance();  // invokes method again

    Console.ReadKey();
  }
}

C# 2.0 introduces anonymous methods, which allow code blocks to be written ‘inline’ where delegate values are expected.

using System;
 
class Program 
{ 
  delegate void DelegateType();  // delegate method declaration
 
  static DelegateType GetMethod() 
  { 
    return delegate() { Console.WriteLine("Hello");};
                                 // anonymous method
  }
 
  static void Main() 
  { 
    DelegateType delegateInstance = GetMethod();
 
    delegateInstance();  // invokes method
    delegateInstance();  // invokes method again
 
    Console.ReadKey(); 
  } 
}

Example of Anonymous Method with two parameters.

using System; 

class Program
{
  // delegate method declaration
  delegate void DelegateType(string name, int val);

  static DelegateType GetMethod()
  {
    // anonymous method with parameters
    return delegate(string name, int val)
      { Console.WriteLine(
           "Hello name:{0} - value:{1}", name, val
                         );};
  }

  static void Main()
  {
    DelegateType delegateInstance = GetMethod();

    delegateInstance("Henry David Thoreau", 44);
                            // invokes method

    delegateInstance("Sandra Day O’Connor", 23);
                            // invokes method again

    Console.ReadKey();
  }
}

The Anonymous Method feature is unique to C#. Don Box refers to it as closure.

Java’s equivalent is inner classes and anonymous inner classes.

Java Anonymous Inner Class Example

public class MyClass extends Applet 
{ 
  ... 
  someObject.addMouseListener(new MouseAdapter()  
  {  // anonymous class definition and
     // instantiation here
     public void mouseClicked(MouseEvent e)  
     {  
       ...//Event listener code here...
     }  
  }  ); 
  ... 
}

C# Lambda Expression

C# 3.0 introduces lambda expressions, to provide a more concise way to write anonymous methods.

To illustrate, let’s see an anonymous method sample and then compare it to a lambda expression version.

Another C# Anonymous Method Example

class Lambda
{
  static void TestLambdaExpression()
  {
    List list = new List();
    list.Add(1);
    list.Add(2);
    list.Add(3);
    list.Add(4);
 
    // FindAll() calls an anonymous method
    List evenNumbers =
      list.FindAll(delegate(int i) { return (i % 2) == 0; } );
 
    foreach (int evenNumber in evenNumbers)
    {
      Console.WriteLine(evenNumber);
    }
  }
 
  static void Main(string[] args)
  {
    TestLambdaExpression();
  }
}

C# Lambda Expression Example

class Lambda 
{ 
  static void TestLambdaExpression() 
  { 
    var list = new List();
 
    list.Add(1); 
    list.Add(2); 
    list.Add(3); 
    list.Add(4);
 
    // FindAll() contains a Lambda Expression =>
    var evenNumbers = list.FindAll(i => (i % 2) == 0);
 
    foreach (int evenNumber in evenNumbers) 
    { 
      Console.WriteLine(evenNumber); 
    } 
  }
 
  static void Main(string[] args) 
  { 
    TestLambdaExpression(); 
  } 
}

So we see that a lambda expression is written as a parameter list, followed by the => token, followed by an expression.

Examples:

  (int x) => x + 1         // parameter list, expression
  (int i) => (i % 2) == 0  // parameter list, expression

Please note that the parameter list can be explicitly typed or implicitly typed.

For an implicitly typed parameter list, the parameter type is inferred from the context in which the lambda expression is used. Also, if a lambda expression has a single, implicitly typed parameter, then the parentheses can be omitted. So this works too.

   x => x + 1         // parameter list, expression
   i => (i % 2) == 0  // parameter list, expression

Here is a case with multiple parameters:

   (x,y) => return x * y;  // parameter list, expression

Well that’s enough intro to Lambda Expressions.

I will follow up with a part 2 to show Expression Trees and how LINQ uses it to pass code as parameters.

If interested in LISP, you can find examples of LISP Lambda Expressions here.