The mysteries of software development and networking... RSS 2.0



 Tuesday, February 21, 2006

Today I had a discussion about coding guidelines and in particular about the size of a class, the number of methods in a class and the number of lines of code per class. What is right?

Ofcourse a little search on Google revealed millions of hits. Some of the more useful ones were:

Most standards don't say much about the size of a class, the number of methods in a class and the number of lines of code per class. The few that do say something come fairly close.

Here's the sum of guidelines that I think I'll stick by:

  1. A source file should only contain one class
  2. A method should be no more than 30 lines of code, excluding blank lines and comments
  3. A source file should contain no more than 1000 lines, including blanks and comments
  4. An interface should have no more than 10 methods, excluding overloads, ie. the combination of overloads counts as one methods
  5. C# 2.0 allows partial classes:
    • a source file should only contain one partial class
    • don't split the implementation of an interface across multiple files
    • for large classes split the implementation of interfaces and implement one interface per file
      • Filename:  <classname>.<interfacename>.cs
    • if you have a class which implements one interace, but has a lot of private methods, then create a partial class with just the private methods:
      • Filename: <classname>.private.cs

Ad 2.
This is the average I found and seems to make sense, since this means that with one look at the screen your brain can absorb the whole method.

Ad 3.
I'm not convinced this is a very important rule. Having 2000 lines of code in one file or spread across two classes in two files doesn't really make that big a difference to me. See also ad 5.

Ad 4.
This is mainly because of Intellisense. Ten methods will provide optimum use of Intellisense.

Ad 5.
Partial classes are great!

Tuesday, February 21, 2006 6:15:16 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2] -
C# | General
 Monday, February 20, 2006


I'll be speaking at the Software Developer Conference 2006. The biggest software developer usergroup meeting in The Netherlands and probably Europe. Are you going? If not, why not?

Ten reasons for coming to SDC 2006:

- The schedule: 90+ sessions about software development, software development and more software development, and to sum it up: more software development.
- The speakers: the best of best, the cream of the crop from all over the world!
- The sessions: educational, in depth, fun and repeated so you don't have to miss any.
- The evenings: the monday nights at SDC are always great, for now still a suprise but it will be very amusing!
- The Internet Cafe: there will be Wi-Fi at the conference, but for those who don't have a laptop with them there will be the Internet Cafe.
- All-in price: the SDN is a no-nonsense usergroup, so no surprises and a crazy value for money conference. The registrationfee covers everything except for the bartab on Monday night.
- Supplier access: all important industry supplies will be present and available for questions.
- Goodiebag: with notebook, nice bag, extra's and extra's...
- Location: to be at Papendal for two days is a great environment to leave your work behind and submerge in the sessions and the wealth of knowledge which will be shared.
- Price: as a usergroup the SDN does not organize this conference for profit, but for you, the developer!

Want more information? Go to: www.sdc.nl

Ofcourse you're going! See you there!

Monday, February 20, 2006 9:55:37 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General
 Saturday, February 11, 2006

So you're a developer and you want to get started with Windows Presentation Foundation (a.k.a.) Avalon?
Well here are the steps I took to play around with this new and hip technology:

  1. Create a fresh VirtualPC image with WindowsXP SP2. I read that you can also use Windows Server 2003 if you wish.
  2. Install Visual Studio 2005. I use Professional edition, but the beta's also work with the Visual Studio Express editions.
  3. Download the WinFX software developer kit at: http://msdn.microsoft.com/windowsvista/getthebeta/default.aspx 
    I've downloaded the WinFX RTC plus the VS2005 extensions.
    Note that if you want to install the VS2005 extensions you also need to download the Windows SDK beta.
    If you don't install the SDK the VS2005 extensions will show a message saying that you need to install the Windows SDK and then also make sure that you install the beta SDK, the regular SDK will not suffice!
    Feels like my WindowsXP machine is being turned into a Vista machine already :-)
  4. Install the WinFx RTC download. The installer will want to download another 16MB of data, so make sure your VirtualPC environment has Internet access.
  5. Install the Windows SDK beta.
  6. Install the VS2005 Extensions package.
  7. Install the VS2005 Extensions for Windows Workflow Foundation. These are obviously optional for playing around with the WPF beta, but since we're setting up a play area we might as well get it complete.

Done? Okay, time to test to see if all is well.

Make a little test XAML application, it ofcourse has to be:

a) Use notepad to create a file called 'test.xaml'
b) Copy code below into file.

<Page xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005">
   <TextBlock>Hello World!</TextBlock>
</Page>

c) Save
d) Double click the file.
e) Yeah! A real life XAML application.

I also tried placing this test file on my webserver ( http://www.develop-one.net/presentations/code/wfm/test.xaml ) but opening this URL results in a security exception. I'll look into that some more later. Probably still need to add this URL my Trusted sites.

 


 

Saturday, February 11, 2006 3:11:12 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
WPF
 Wednesday, February 08, 2006

I've just been confirmed as a speaker at the Software Developer Event, the 24th of March 2006 in Ede, The Netherlands. I'll be doing an exciting session about Windows Presentation Foundation, a.k.a. Avalon.

For more information read the session abstract below. Hope to see you there!

Working with Windows Presentation Foundation
This introductory session about Windows Presentation Foundation, formerly known as Avalon, consists of two parts. The first part is about the WPF fundamentals. Here the developer will get 'a look under the hood' in order to get a better understanding of what is happening when developing a WPF application. The second part of the session looks at two tools that can be used to actually develop a WPF application and be productive while doing it, because who really wants to manually program XAML, right? The first tool we'll look at is codenamed 'Cider'. This tool allows a developer to create WinForm-like applications with WPF. The second tool is codenamed 'Sparkle' and is used for creating more Flash-like applications.

Wednesday, February 08, 2006 1:14:18 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
WPF
 Tuesday, January 31, 2006

At VSLive! Somasegar has announced that Team Foundation Server will ship in March 2006.

View the video of the keynote at VSLive! at http://www.ftponline.com/channels/net/reports/vslivesf/2006/soma/

Tuesday, January 31, 2006 4:45:43 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General
 Monday, January 30, 2006

Microsoft has released a draft version of the design guidelines for Windows Vista.

Surf to: http://www.microsoft.com/downloads/details.aspx?FamilyId=FD380553-911E-4659-A085-4DD58AE4B9AE&displaylang=en

Monday, January 30, 2006 8:35:50 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1] -
General | WPF
 Tuesday, January 24, 2006

Microsoft has released a preview of it's tool for editing XAML. The codename used to be Sparkle, the production name will be Expression Interactive Designer.

Read more on Manuel Clement's blog: http://spaces.msn.com/members/manodesign/Blog/cns!1pRsSVBaAuwgFSti-clSJ6Ng!384.entry

Tuesday, January 24, 2006 8:53:44 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
WPF
 Monday, January 23, 2006

Tech Ed Europe has been moved back to the 6th of November and will be held in Barcelona instead of Amsterdam.

Great! Barcelona is a great place to visit.

Monday, January 23, 2006 10:02:24 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General
 Friday, January 20, 2006

I've been wondering whether the following would be possibe:

In .NET 1.1 create a class library with form A.
Compile and copy the assembly to a .NET 2.0 machine.
In .NET 2.0 create a form B that inherits from form A.
Run form A in .NET 2.0.

This works, no problems.

In .NET 1.1 create a winapp with form A which has a button that triggers the following code:

object temp = Activator.CreateObjectFrom( "Test.dll", "Test.FormB" ).Unwrap();
Form f = (Form) temp;
f.Show();

Compile and copy the assembly to a .NET 2.0 machine.
In .NET 2.0 create a class library with form B.
Compile the assembly.
Start the winapp, click the button, et voila, the .NET 1.1 assembly will start the .NET 2.0 form.

Also works without problems :-)

Just giving all this a try has taken away quite a bit of doubt about whether this would work or not and means that in a GUI .NET 1.1 and .NET 2.0 work together quite nicely.


 

Friday, January 20, 2006 11:25:51 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General
 Thursday, January 19, 2006

My friend Arie Leeuwensteijn at Microsoft organizes the Dutch Developer Days. He's got the schedule all done and it looks pretty impressive. It's a two day event and it looks like it'll be big, because it is in the RAI in Amsterdam. This is the same location where TechEd Europe will be held this year.

View the schedule at: http://www.microsoft.com/netherlands/msdn/devdays/default.aspx

Arie has a blog too, have a look: http://blogs.microsoft.nl/blog_arie_leeuwesteijn/

Thursday, January 19, 2006 2:24:41 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General
Another post on www.theserverside.net : http://www.theserverside.net/news/thread.tss?thread_id=38592

Microsoft has released the January CTP of WinFX which includes a Go-Live license for WCF and WinWF. This release has no changes for WPF and a Go-Live license is not included for that technology. Download includes WinFX Runtime Components, WinFX SDK, Visual Studio Extensions for Workflow, and Visual Studio "Orcas" CTP Development tools for WinFX.

Info about this stuff on MSDN: http://msdn.microsoft.com/winfx/getthebeta/golive/default.aspx

Or go straight to the download on MSDN: http://msdn.microsoft.com/windowsvista/getthebeta/default.aspx

 

Thursday, January 19, 2006 2:16:32 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General

Follow this link to view the recent episode of MSDN TV where they discuss LINQ for VB.NET.

Overview
Visual Basic 9.0 will offer radical improvements in its ability to work with data in all its forms: as objects, as XML, and as relational data. Paul Vick and Amanda Silver discuss the latest Customer Tech Preview of the next version of Visual Basic to hit the Web. It includes support for DLinq (language integrated query over relational data) and expanded editor support for query statements and integrated XML.

Thursday, January 19, 2006 2:09:50 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
LINQ

Just came across a deadlink on www.theserverside.net refering to a post by Kevin Jones about Embedded Resources in ASP.NET. Couldn't find the item on Kevin's blog, but a Google search brought me to http://haacked.com/archive/2005/04/29/2879.aspx which explains it pretty well.

Embedding Javascript in your assembly resource seems a great way to avoid deployment issues.

Thursday, January 19, 2006 1:58:47 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
ASP.NET
 Saturday, January 14, 2006

Just a couple of links to stuff that's in beta right now:

WinFX, XAML and SDK
ASP.NET ATLAS
C# and LINQ
VB.NET and LINQ

Saturday, January 14, 2006 10:37:48 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
ASP.NET | C# | LINQ | WPF

I'm finally catching up on some reading that I've been meaning to do.

Right now I'm reading 'Programming Windows Presentation Foundation' by Chris Sells & Ian Griffiths. Good read and I hope to finish it on my next flight :-)

Also spend some time this morning reading an article by Ted Neward on MSDN (http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dndotnet/html/linqcomparisons.asp) which gives food for thought on LINQ and the whole OR-mapping issue.

Saturday, January 14, 2006 10:13:48 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
LINQ | WPF

I just received a mail from my friend Lucas pointing out that some products are getting close to the end of the Microsoft Support Lifecycle.

The mainstream support for the 2000 editions of several products is ending in the near future, as detailed in the following table (for more information on Support Lifecycle, visit www.microsoft.com/lifecycle).

Commerce Server 2000 Standard Edition
BizTalk Server 2000 Standard Edition
BizTalk Server 2000 Enterprise Edition
Host Integration Server 2000 Standard Edition

 

3/31/2006
6/30/2006
6/30/2006
12/31/2006

 

Saturday, January 14, 2006 9:43:44 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General
 Thursday, January 12, 2006

With generic in C# 2.0 life just become so much easier. Today I was impressed by the ease with which you can now sort a list of T.

Code below shows how with one method you can now implement a sort. This used to be much more complex!

public class Person
{
    public Person(string name)
    {
        this.Name = name;
    }

    public string Name;
}

class Demo
{
    public List GetAllPersons()
    {
        List result = new List();
        result.Add(new Person("Mark"));
        result.Add(new Person("Dennis"));
        result.Add(new Person("Duncan"));
        result.Add(new Person("Jeremy"));
        result.Sort(SortByName);
        return result;
    }

    public static int SortByName( Person x, Person y )
    {
        return x.Name.CompareTo(y.Name);
    }
}
Thursday, January 12, 2006 1:14:32 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
C#
 Tuesday, January 10, 2006

I was reading my way through the Internet and came across some interesting stuff about Smart Client Architecture. It seems that the definition of a Smart Client is not so clear. On the Microsoft site it says:

Smart client (n) Definition: Smart clients are easily deployed and managed client applications that provide an adaptive, responsive and rich interactive experience by leveraging local resources and intelligently connecting to distributed data sources.

But then it shows the following picture:

As you can see there are two features that are unique to a Smart Client:
a) Online/Offline support
b) Device Adaptability
Without these features a Smart Client is really nothing more than either a Thick or Thin Client.

Personally I feel that from an architectural point of view offline/online support is much more important than device adaptability. Therefore I think that the definition for a Smart Client should read:

Smart client (n) Definition: Smart clients are easily deployed and managed client applications that provide an adaptive, responsive and rich interactive experience in both an online and offline scenario, by leveraging local resources and intelligently connecting to distributed data sources.

More interesting reading on: The ServerSide.NET and Clemens Vaster's Blog.

 

Tuesday, January 10, 2006 4:16:40 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Architecture
 Monday, January 09, 2006

I always wondered how some sites managed to get their little logo in my list of Favourites. Turns out it is really quite easy, just add a favicon.ico file to the root of your website. Internet Explorer will pick it up automagically.

If you happen to have a different browser you can try:

<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

Found it on Matthias Benkmann's website: http://www.winterdrache.de/freeware/png2ico/favicon.html

Monday, January 09, 2006 1:50:39 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
ASP.NET
 Sunday, January 08, 2006

I've recently moved to the United States. To Lincoln, Maine to be exact. I've started a new company called Develop-One and with the start of a new company I think it also time for a new blog. I'll still run my old blog as a more personal account of my life in Maine, but anything to do with .NET, C#, Windows Vista, LINQ, WWF, WCF, WPF and every other technology that keeps me occupied in my life as a developer I will post about on this weblog.

Happy reading.

- Mark

Sunday, January 08, 2006 12:39:11 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2] -

About
This blog is run by Mark Blomsma.
© Copyright 2008
Develop-One
Sign In
Statistics
Total Posts: 334
This Year: 78
This Month: 2
This Week: 0
Comments: 94
All Content © 2008, Develop-One
DasBlog theme 'Business' created by Christoph De Baene (delarou)