Archive for the ‘.NET’ Category

Third time’s a charm?
A common belief is it takes three versions before Microsoft really gets a new technology right. Now that Silverlight 3 has been announced at MIX09 it would seem a good time to take a look at this platform.

WPF, the big brother of Silverlight, has been around since Vista was released and although a critical success has only slowly gained traction in desktop development. I think this is because WinForms, despite many shortcomings, is good enough for most business focused applications. With few ‘must have’ reasons to immediately make the jump, adoption is rising but only slowing.

Silverlight adoption has the potential to happen much faster for two reasons. First is the continuing trend towards richer internet applications. Although you can create nice websites using Ajax, jQuery and HTML it takes great developers pushing the limits to achieve it. Silverlight makes it possible for average developers to do the same but in less time.

The second force is just shear weight of numbers. With about a million .NET developers in the world you are instantly opening up rich internet development for them all. Asking a C#/WinForms developer to learn all about Ajax, jQuery, CSS and so forth is a steep learning curve with no leverage of existing skills. But ask the same developer to keep using C# and much of the same base class library and it becomes much more appealing. Plus once you have mastered Silverlight you can transition that knowledge over to your desktop apps with WPF.

This entire preamble merely explains why I find Silverlight interesting as an area I should start thinking about. I would like to hear bad about others opinions and get a discussion going about this topic.

1, Should Component Factory get involved in Silverlight?

2, What type of controls/components etc would be useful?

I have started a forum thread for this discussion. This will make it easier to track the full set of responses on an ongoing basis. Thanks.

Silverlight 3 Beta Site
Silverlight Development Links

You can see a first glimpse of the new user interface for Visual Studio 2010 on the following Microsoft employee blog. Looks quite nice and makes use of WPF for the editing window.

Visual Studio 2010

When you learn a new language you tend to settle into using it in a particular way. So if you missed a little known feature it is unlikely you will suddenly find it unless someone points it out. Here are 5 of my favorite C# features that you might not already be using.

1 – ?? Operator
The ?? operator is called the null-coalescing operator and is used to define a default value for a nullable value types as well as reference types. It returns the left-hand operand if it is not null; otherwise it returns the right operand. So instead of using code like this…

if (reference == null)
   return _defaultInstance;
else
   return reference;

You can just write the following statement instead…

return reference ?? _defaultInstance;

Much cleaner and it even works for nullable value types.

 

2 - DebuggerStepThrough
This attribute can be added to a method or property accessor and used to speed up debugging. When debugging and using step-into the debugger will step past the method with this attribute. This is really useful in preventing you stepping in and out of the many one liners in the code. To apply do this…

public string Name 
{
   [DebuggerStepThrough]
   get { return _name; }
    
   [DebuggerStepThrough]
   set { _name = value; }
}
 

3 – Automatic Properties
Sick and tired of adding get/set code for simple properties? This is no longer a problem with the automatic properties added in C# 3.0. Instead of this…

private string _name;
public string Name
{
   get { return _name; }
   set { _name = value; }
}

…just do this…

public string Name { get; set; }
 

4 - Object Initializers

Also introduced in C# 3.0 are object initializers. This allows you to set property values inside the new statement. Without this you either create additional overloaded constructor with the possible set of initial values or you write the long hand like this…

Employee emp = new Employee();
emp.Name = "John Smith";
emp.Age = 10;

…but this is clearer…

Employee emp = new Employee {Name="John Smith", Age=10}

5 - Constant flags

Want to specify a float instead of a double for a constant? Most people know the ‘f’ modifier after a constant number informs the compiler to make it a single float value. But did you know the full list of others flags?

100m  (decimal)
100f  (float)
100d  (double)
100u  (uint)
100l  (long)
100ul (ulong)

Let me know if I have missed one you really like.

If you’re building an application using the Krypton controls then you need to add a final polish by using a set of professional icons. Otherwise all that hard work creating a nice looking app is going to waste.

To help make this process as easy as possible you can now buy a pack of 265 icons. As an introductory offer the price is just $79 during this month. Each icon has…

Three different sizes

Three different states

 

6 different file formats

- PNG, GIF
- ICO, PSD
- BMP (24bit & 32bit).

You can see a preview of all the icons here.

Is it my imagination or is Microsoft releasing technologies faster and faster than ever before? When I was a young developer using Visual C++ it seemed that you could easily know all the technologies at any one time. All you had to learn was a language, a framework and a library (C++, MFC and STL).

Fast forward to today and there would seem to be inflation in the number of product releases from Microsoft. From the release of Vista onwards we have the following client side technologies…

  WPF   WCF   WF   LINQ

Each of these covers a large area that would require many months to really understand well. In fact WPF alone is going to take you a year of full time use before you can say you’re truly proficient in it. If you want to include the server side then add the following into the mix…

  ASP.NET AJAX  
  ASP.NET MVC
  ASP.NET Dynamic Data
  ADO.NET Entity Framework
  Silverlight

I think I know why this rapid increase has happened and it’s all the fault of the .NET Framework. When I switched from developing applications with MFC/ATL to WinForms I noticed my productivity increased several fold. Maybe as much as a 5 fold increase in output once I was up to speed with using all the .NET goodness. Now you apply this same productivity increase to all the cubicles at the mothership and you have the above technology tsunami.

When I started as a Windows developer the only real distinction between us was the language that you used (C++ or VB). With the rise of the Internet the community split into server side and client side specialists. It was very hard to master both areas because of the sheer amount of knowledge needed although the better programmers could probably just about manage it.

Now I see the community is splitting again into even smaller groupings. Do you use WinForms or WPF? Do you use classic ASP.NET or the MVC Framework? Over time I expect to see this kind of fracturing into smaller and smaller groups to continue. Or at least that’s what I was expecting to happen. Maybe Microsoft has seen this trend and decided to try and reverse it. Is the use of XAML with WPF and Silverlight an attempt to unify your client and web developers back into one happy community again? Time will tell.

A worrying trend for Microsoft is that your average programmer is not even bothering to try and learn all the latest goodness. How many developers in your outfit actually use generics beyond List<T>? Generics have been around forever, at least compared to the above technologies, and still most developers are hardly using it. I heard a podcast where an interviewer for a .NET position found that only around 20% of the candidates actually used generics at all. Yikes.

Actually this is not really surprising as the majority of developers spend all day working on business applications that are going to generate revenue. When do you have the time to learn WPF/WCF/LINQ/etc when learning them is almost a full time job in itself? It is all very well for Scott Guthrie or Scott Hanselman to tell the world how great the new stuff is but real developers just don’t have the schedule to stop and learn for six months.

For me this is the biggest problem that Microsoft is facing. They have some great technologies but the challenge is how to get the bulk of developers, the average developer, to move forward and learn them. I expect the upcoming PDC2008 will release even more new tech but I wonder what they are going to do that makes it easier or more compelling for businesses to move forward and actually use them.