Friday, June 8, 2012

Release notes generation puzzle

Introduction


Why a puzzle? It is just about interaction. I want to share my knowledge with you and hope you want to share your knowledge with me. I know you as a reader of this blog have lots of wisdom I can learn from.

I know that I'm "copying" the style of Java specialists with this kind of a puzzle but I like it, so here we go...

 

The problem

 

I will talk about a very simple and useful practice, which I have formalized thanks to the combination of Catel team practices and my own development process automation needs. It isn't a new one and probably you have used it before.

Let's start taking a look at the Catel history file, located at %workspace%\doc\history.txt. I just show you a summary for simplification and, why not, I also give you a preview of the next version of Catel.

Catel history
=============
(+) Added
(*) Changed
(-) Removed
(x) Error / bug (fix)

...
===========
Version 3.2
===========
Release date:
=============
2012/xx/xx

Added/fixed:
============
...
(+) Added IViewModelFactory so the instantiation of view models can now be fully controlled and customized
(+) Added Description property to IMementoSupport to allow a description to the end-user for memento classes
(*) The IOpenFileService now supports multiple files and in WPF it also supports a title
...
(*) Updated System.Windows.Interactivity.dll for SL5

(x) Fixed issue that views and view models could not be resolved when a naming convention contained 2 or more [UP] constants
...
===========
Version 3.1
===========
...

I always dreamed to produce this kind of release notes. But all my previous attempts gave me a strong headache because sometimes the issue tracker doesn't contain all features/fixes that were born from the "creative" developer process or the version control commit comments just said something like "Merged".

So, where does the history file added/fixed lines come from?

Read the history file again. You should notice a legend and the very simple technique that allows us to tag the changes and document them over time.

But it seems like an overwhelming task and requires self-discipline to keep this kind of log up-to-date. Actually we (the Catel team) update this file manually, actually, Geert do most of these updates,  and we also know many teams that do it manually as well.

But this doesn't need to be updated manually. This is the problem that I want to solve and I hope you will share your experience and knowledge with me. The solution is pretty simple but it just become clear to me when I ported the "relevant" commit comment technique (the Catel team practice) to one of my "real live" projects.

Is it to possible generate release notes with a combination of "relevant" commit comment techniques, of course, a version control system (VCS), an issue tracker system (ITS), and a continuous integration server (CIS)?

The clues

 

1)  What is a "relevant" commit comment?

    A "relevant" commit comment is about a commit comment that indicates a feature completion.  It should be related to addition, modification, removal, or bug fixing, but just when those goals are actually "Done, Done". Yes, you read well, I wrote: "Done, Done". A feature is "Done, Done" when is tested, coded, designed or refactored, integrated, it builds, etc. For details read more "The Art of Agile Development".

2) Take a look at the source control page.

 

The solution



There are several scenarios; the fact is that there are tons of version control systems, issue trackers, and continuous integration servers. So, I will wait for your solutions for a couple of weeks, you just have to comment here about it.

I want to share my solution with Subversion (VCS), Team Foundation Server (ITS) with Scrum for Team System process template, and Team City (CIS) but you will need to wait for my next blog post. The truth is that I still have to implement it ;).

What do you think? Can this problem be solved? I know, you have the answer and I am waiting for it.

Remember a couple of weeks. Please don't hesitate just comment on your solution here.

Monday, May 14, 2012

Catel creates a perfect combination with PRISM

Introduction


I have been very "busy" watching the final of the baseball season. The past week, my team was eliminated on quarterfinals, so now I have  time to write.

Talking about competitions, I just remembered the history about how Catel.Extensions.Prism was born.

You may think that Catel and PRISM are competitors. The fact is that most people think that they are competitors. Actually I had the same idea when I discovered Catel, some time after I have been written LoB systems with PRISM. If you read the highlights, is not hard to notice the "isolated" features, mainly if you are looking for guidance or a stating point for the MVVM pattern implementation.

Catel has an out of the box view model base implementation, plus services, with full support for validation, property change notification and commanding. From my point of view Catel beats PRISM as MVVM pattern implementation guidance, with a cleaner approach on separation of views and view models and better testability. The fact is that PRISM has no a ViewModelBase implementation.

So, at some point, I considered removing all the PRISM references from my projects. But then I would loose many PRISM features, that allow you manage the modularity and view composition, that are hard to leave behind when you actually used it. I heard some people talking about the PRISM approach saying that it is a bit complex or strange. They provide example terms like bootstrapper, shell, module catalog, modules, region manager, etc. But the truth is that PRISM provides a good scaffold for modular application development.

That was the moment when we thought that they should be work together and that was the reason for we wrote Catel.Extensions.Prism and it is now available via NuGet.

User Interface Composition with Catel.Extensions.Prism


Starting with Catel 3.1 the Prism extension is available. PRISM includes a feature named "User Interface Composition". Basically it allows building a mosaic like application by loading multiple views that comes from different modules into an active region exposed by a control, also know as the shell.



The PRISM UI composition approach requires that you reference the view or the view type in order to associate it with one region. That is correct if you are coding a module class for instance, but all this is about view models.

In order to understand the code samples you need to read more about UIVisualizerService, and the way it can resolve a view from an instance of a view model. Now you are able to create a composite user interface without actually referencing any view from a view model class.

Making the region manager available

First of all, you must make available the region manager on the instance of ServiceLocator (IoC container of Catel). A PRISM based application uses MEF or Unity as primary IoC container. Therefore, you must synchronize this container with the Catel one, overriding the ConfigureContainer method of the application bootstrapper class, using the following code:

protected override void ConfigureContainer()
{
 base.ConfigureContainer();
 if (ServiceLocator.Instance.IsExternalContainerSupported(this.Container))
 {
  ServiceLocator.Instance.RegisterExternalContainer(this.Container);
 }
}

Activating a view into a specific region

To activate a view into a specific region from inside a view model, use the following code:
 var viewModel = new EmployeeViewModel();
 var uiVisualizerService = GetService<IUIVisualizerService>();
 uiVisualizerService.Activate(viewModel, "MainRegion");

Deactivating a view

To deactivate a view, use the following code:
uiVisualizerService.Deactivate(viewModel);

If you keep your view model alive (see: Keeping view models alive), you can reactivate a deactivated the view using Activate method without specify the region name. 

Deactivating a view automatically

If you close the view model using SaveAndCloseViewModel or CancelAndCloseViewModel or CloseViewModel methods, the view that belongs to this view model will be automatically deactivated from the region where it was activated.

Conclusions   

Nowadays, I enjoy write applications with Catel and PRISM, or with PRISM and Catel, the order doesn't matter. I will just give you one advice, try out this extension and like a host of a popular TV show that I know say, "draw your own conclusions by yourself" ;)

Wednesday, April 25, 2012

Accelerating Catel coding workflow with CatelR#

Overview


The  first release  of ReSharper  (R#)  provoked a  commotion, at  least between my programming  fellowships. Expressions like  "Visual Studio is a great development  tool, but with ReSharper is  awesome" were commonly repeated.

The main reason  of R# success was that the JetBrains team identified a weak point of the Visual Studio coding editor.

Visual Studio, at least in it's firsts versions (.NET versions, 2003, 2005), had no refactoring features,  just like other Java IDEs already had, such as Eclipse or IntelliJ. Also note that  the last two versions of Visual  Studio  improved it's refactoring  features but nothing come close with the power of the R#.

But I will not to talk about R# history, actually the preceding paragraph could be not totally accurate.  I don't  really know how R# was born. (If you know it, don't doubt, just comment it here, allow me to be in the know)

R# as coding workflow guidance


The R#  quick fix  and/or context  action is  very simple  and powerful workflow.  Basically  you can  locate  the  caret  position near  to  an element that  you want to alter, press  Alt + Enter,  and all available suggestions will be displayed. For instance, if you  press Alt + Enter in a  range  corresponding  to  a  "public" modifier  of  a  property,  the suggestions  "To internal", "To  protected" or "To private" would be available, only the options that do not provoke a broken usage are displayed.
 
 {caret}public string FirstName { get; set; }

But all  scenarios are not covered by R#,  there are tons of frameworks and/or toolkit that have it own coding workflows.

Catel coding workflow


If  you are  writing  a WPF  or Silverlight  application  and don't  use Catel, it is  probably that you are not using the right library. See the comparison sheet, for detailed libraries comparison.

But Catel has a "down side". If you want to convert a simple class into a data  or model class in order to  support property changed  notifications and validations, you need re-coding a class like this one:

public class Person
{
 public string FirstName { get; set; }

 public string MiddleName { get; set; }

 public string LastName { get; set; }
}

into this one:

public class Person
{
 public static readonly PropertyData FirstNameProperty = RegisterProperty("FirstName", typeof(string));
 
 public static readonly PropertyData LastNameProperty = RegisterProperty("LastName", typeof(string));
 
 public static readonly PropertyData MiddleNameProperty = RegisterProperty("MiddleName", typeof(string));
 
 public string FirstName
 {
            get { return  this.GetValue<string>(FirstNameProperty); }
            set { this.SetValue(FirstNameProperty, value);  }
 }
 
 public string LastName
 {
            get { return this.GetValue<string>LastNameProperty); }
            set { this.SetValue(LastNameProperty, value); }
 }
 
 public string MiddleName
 {
            get { return this.GetValue<string>(MiddleNameProperty); }
            set { this.SetValue(MiddleNameProperty, value); }
 }
}

As you could be noticed, there is an implementation pattern that should be fully automated. In fact, every Catel version comes with a code snippets package that assist you to write down this class from scratch.

But now, Catel team comes with a new tool. Using the R# SDK, we implement a R# extension that cover the Catel coding workflow and we named CatelR# (obviously).

Now you can do this




You can also do it faster with the R# generation options (Alt + Ins)



The   beta  version,  of CatelR#,  is  released. You can read more about CatelR# and download the beta. We are expecting for your feedback and new features request.

Enjoy it, and have nice coding experience with CatelR#.

Thursday, April 19, 2012

Introduction

I was writing a couple of features of a new tool for Catel developers and users, and Geert advised me to write about this experience.

Then I noticed that I have no place where could do it and just created this blog, applied the simple theme, in the orange fashion, and started to write these lines.

Btw, the orange color is about my favorite baseball team Villa Clara, also known as the explosive oranges.

So, what will you find on this blog in the future?

Actually, I'm a software engineer since 2005 and daily I interacts with friends (or not), sharing (or discussing) about experiences in term of software development practices, including wide range of topics such as:
  • Well coding practices, write code semantically right vs. just "syntactically" right.
  • Continuous integration, building, testing and deploying (devops).
  • Synchronization of version control and issue tracker systems.
  • Multithreading.
  • Automation of common or repetitive development tasks.
  • Version control systems and extreme synchronization scenarios. 
  • IoC, reflection, type descriptors, dynamic proxies, wavers.
and more...

This blog is about the software development. Yes, you heard well, this is just another blog about software development, but with a small difference. Here I will tell you the history just "like was told to me".

Ah, what about the new tool for Catel developers and user?  Expect news about it here or here, it will come soon and would be great ;).

X-ray StoneAssemblies.MassAuth with NDepend

Introduction A long time ago, I wrote this post  Why should you start using NDepend?  which I consider as the best post I have ever...