Register Login

 

Welcome to the Coach Factor blog. Here you will find all of our ideas on software development. Subscribe at  http://blog.nventive.net.

# Monday, September 22, 2008

One of the nice things of the latest versions of .net, is the ObservableCollection<T>. This class implements the new INotifyCollectionChanged interface (similar to INotifyPropertyChanged that we all know). Here is a small code example:

    1         [TestMethod]

    2         public void ObservingAReadOnlyObservableCollectionSucceeds()

    3         {

    4             //setup original collection with some initial content;

    5             ObservableCollection<string> strings = new ObservableCollection<string>();

    6             strings.Add("string1");

    7             strings.Add("string2");

    8 

    9             //setup readonly collection

   10             ReadOnlyObservableCollection<string> readOnlyStrings = new ReadOnlyObservableCollection<string>(strings);

   11             int addedElementsWhileObservingReadOnlyCollection = 0;

   12 

   13             //setup observer

   14             (readOnlyStrings as INotifyCollectionChanged).CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)

   15                     {

   16                         if (e.Action == NotifyCollectionChangedAction.Add)

   17                         {

   18                             addedElementsWhileObservingReadOnlyCollection += e.NewItems.Count;

   19                         }

   20                     };

   21 

   22             //add one item, addign should be observed

   23             strings.Add("addedString");

   24 

   25             //assert

   26             Assert.AreEqual(3, readOnlyStrings.Count);

   27             Assert.AreEqual(1, addedElementsWhileObservingReadOnlyCollection);

   28         }

Notice the usage of ReadOnlyObservableCollection<T>, which can be used when you don't want someone to alter the contents of a collection.

These are the problems we see with all this new goodness:

  1. These types reside in the WindowsBase.DLL assembly with weird innapropriate namespaces.
  2. ReadOnlyObservableCollection<T> and ObservableCollection<T> implement INotifyPropertyChanged explicitly, meaning you have to cast to INotifyPropertyChanged to be able to use notifications.
Monday, September 22, 2008 5:48:40 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.net
# Friday, September 19, 2008

nVentive will be sponsoring the Montreal .NET community, it's our way of promoting this great group. They offer many meetings per month where great subjects are featured. It's one of our ways of offering coaching and guidance to the Montreal community.

Friday, September 19, 2008 1:22:06 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.net | Announcement
# Thursday, September 11, 2008

For the second time this year, nVentive will be presenting at DevTeach, happening in our home town of Montreal from December 1st to the 5th. Come and catch us talk about agility in our "Done Done" conversation, or about hard core programming in our "Top 10 Umbrellas" talk.

Thursday, September 11, 2008 2:05:35 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Announcement | Umbrella
# Tuesday, September 09, 2008

nVentive will be presenting some cool material at the new Microsoft TechDays conference in Montreal on November 6th and 7th. Be sure to be there as the subjects are the latest and will surely help you increae your team's software developement velocity.

Tuesday, September 09, 2008 3:51:52 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.net | Announcement
# Wednesday, September 03, 2008

Well, such a nice tool was bound to be aquired by a company. Reflector has been acquired by Red-Gate software. You can find Reflector at http://reflector.red-gate.com.

Speaking of Reflector though, did you know there were over 30 plugins available ?

On the subject of plugins, the excellent TestDriven.net addin for Visual Studio will add a few context menu item for running your tests, but will also add one that allows you to jump back to Reflector. Isn't it nice when all these tools play nice together ?

Wednesday, September 03, 2008 2:27:09 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.net
# Friday, August 29, 2008

We've been looking at tools lately that could an agile team get a better view of the quality of the software they are writing. On of those is NDepend, a tool that will inspect your assemblies, determine your code's dependencies and then calculate some metrics for you to analyze. The output will typically be a report, in HTML format. Since this step can be automated, We strongly suggest that you put this into your continuous integration process because from that point, you'll be able see the metrics for your software change with time.

On a previous project, we had integrated NDepend on the daily build and at the of each iteration, we would take a few minutes to look at the reports and note a few actions to be taken during the next one. It was a great way to maintain quality and I strongly recommend you integrate it on your next project.

Now where this tool really shines, is with the VisualNDepend application. This one allows you to visualize the metrics of your software, query your software's compiled code through a SQL like language, and perform comparisons between 2 different reports.

Here are a few examples of the queries you can do in CQL:

SELECT TOP 10 METHODS WHERE CouldBePrivate

SELECT TOP 10 FIELDS WHERE CouldBePrivate

SELECT TOP 10 TYPES WHERE IsClass AND NbChildren ==0 AND !IsSealed AND !IsStatic ORDER BY NbLinesOfCode

Here are a few snapshots of the tool when run on our own Umbrella library.

Picture 1

This image shows Umbrella being analyzed, with the mouse pointer on one method called "Truncate". NDepend shows metrics and information all on one easy screen.

Picture 2

This image shows the result of the execution of 1 CQL query and where in the assembly (in blue) are located the results. Once again, bravo for NDepend: quick, concise and visual.

The author of the product Patrick Smacchia gave an interview to the Visual Studio Talk Show, a french PodCast from Montreal; if you can, we strongly suggest you listen to it and hear what the author himself has to say about this great product.

Thursday, August 28, 2008 11:50:42 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Architecture | Process | Umbrella
Search
Archive
<September 2008>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
Statistics
Total Posts: 47
This Year: 0
This Month: 0
This Week: 0
Comments: 2
Sign In