Sunday, May 31, 2009
Visual Studio templates are a great way to give you an head start with code that has a lot of boilerplate code.
In fact you may already be using project templates withouth knowing. :-) When do option Open New Project in Visual Studio and select a project type (Windows Application, Console Application,etc) you are in fact selecting the project template that will be used to generate your project skeleton. This project skeleton not only includes some code/data files but it also includes the references to the .Net assemblies that your particular project type needs.
If you are curious of how out of the box project template looks like you can find them at:
- VS 2005 - %ProgramFiles%\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates
- VS 2008 - %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates
Visual Studio not only provides you with a great number of project templates out of the box, but you can also write your own project templates
If you don’t want to spend time writing your project template you can find that a lot of people make them freely available on the net. For example Team System MVP Neno Loje created a project template that you can use to kickstart Team System Utilities.
You can create your own project by hand (which involves some labor) or you can create your project like you regularly do. Create all the boilerplate code, include all the references,all your content and then use that project as your project template by exporting it to a project template using the Export Template wizard (available in File->Export as Template)
I don’t want to get into much details of how you can create project templates. Either by hand or using the export option. There is plenty of information about that already.
You can read some fine information about it on these articles:
Not to get back to the real intent of this post. :-) Conditional inclusion of content.
Starting with VS 2008 your project templates can have content that is only included if a certain condition is met. This is a simple IF condition and all you can do is comparing the value of a parameter to a value.
for this you simple have to use on your template files $if$ (<expression>) <your content here> $endif$
For example if your project template allows framework multi targeting you can use this to include references to Framework 3.5
$if$ ($targetframeworkversion$ == 3.5)using System.Linq;
You can check here the list of parameters that are available out of the box and but you can also reference parameters added in the CustomParameters element or parameters added by your wizard.
Now there is a catch. In order to use conditions, your template has to be a template of version 3.0.0 (the template version is defined in VSTemplate element of the .vstemplate file)
eg: <VSTemplate Version="3.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
What is the catch then? If you use the export template to create your project template (even in VS 2008) the project template is exported as version 2.0.0 and you have to manually edit the .vstemplate file to use version 3.0.0 if you wish to use the $if$ functionality.
Post Scriptum: If you think project templates aren’t up to the level of customization you want, you can also use your own wizard in project template. And from that wizard use the VS API to do more complex things on the created project (or/and the solution that is going to hold it). And if that is not enough you can combine it with Software Factories to make it even more powerful.
Tuesday, February 24, 2009
Last week we had the DevDays 09 event. A two day event packed with more than 50 sessions in which i did 3 sessions (technically two and a half).
The last time we had a local DevDays event was in 2004. Which brings back some memories, Due to the foulness of someone who shall remain nameless i was invited to speak for the first on a Microsoft event (something which has been repeating ever since). It was a session about the on the defunct Shadowfax
Since then Microsoft didn’t organized any local Devdays (in 2005,2007 and 2008 we had TechDays) but this year IT was left out so we had DevDays which is mainly a developer event.
This year i was present in the architecture and the developer tracks. I did three sessions:
ARC206 Patterns & Anti-Patterns – While attending a session on Teched EMEA, me and Jota agreed that not only it was the best session we had attended so far. That we should present it on DevDays 09 :-).
It was a presentation about Architectue Patterns & Anti-Patterns, the first (and only :-)) mistake we did was placing patterns on the title since we only talked about architecture anti-patterns.
The presentation went very well, the room was packed (actually it was overflowing the people present exceeded the capacity of the room (which was 150 people)) and people seemed to genuinely like it (at least the session feedback was unusually high for an architecture talk). The presentation was based on Teched EMEA’s ARC 203 Architectures: The Good, the Bad, and the Ugly. Based being the operative word. We not only cut the presentation in half so we could concentrate on the most important issues we also rewrote the content. If I’m allowed to say so i think we somehow manage to surpass the original presentation. :-)
The session went so well that me and Jota are already conjuring what we should come with next time. :-)
TLA206-Scrum e Team System – This was a mixed and ungrateful presentation. I wanted to do a talk on both Scrum and Team System. Since the time was short i had to base my session on the assumption that people were allready familiar with Scrum and had a vague idea what Tem System is.
In this session I’ve shown the three available process templates to use Scrum with Team System, namely:
I’ve tried to enumerate the advantages and disadvantages of the three alternatives and i showed how you can leverage Team System while using Scrum. I did this by demoing Scrum for Team System and how you can complement it by using Scrum Dashboard to have a complete and visual grasp of the progress of your sprint. I’ve also shown how you can use Conchango’s TaskBoard to let you plan and manage your sprint more easily in a graphical manner.
The session was well received by the 120 people that were present.
TLA303 – Customização e Extensibilidade Team System – This was a session on customization and extensibility of Team System. This was a 300 level session and it was assumed people knew what Team System is. Perhaps this scared people off because the session wasn’t full. I don’t have an official count, but by calculations there were probably 68-80 people on the room. This is a purely hands on session. The session has 5 slides with content (excluding titles,etc) on which 3 are images, so it leaves us with 2 slides of information. The rest was done purely on a Virtual Machine with VSTS doing demos. Customization and extensibility is a topic that can be talked for hours so i had to focus my talk on a few topics. I’ve chosen these ones:
- Customizing a process template (including reporting)
- Using the Object Model
- Work Item Custom Controls
- Source Control Checkin Policies
In this session I wanted to do something different. Instead of the usual show the power and ease of process customization demo by demoing how it is possible to customize a process by adding a field to a bug to allow you to list the client who reported it or the date that is expected to have this feature implement or such trivial task.
To show the power of TFS i did a demo totally unrelated to software development. I created a process template from scratch to manage a soccer championship. Not only i modeled the games fixtures (so we can track the calendar, the results, which games have already been played,etc) I’ve also used it to model the workflow of the logistics that happens behind the scenes the allow the game to happen (you know, arrange the police escorts,referees, game reports, notify the press in sum all the tasks that need to happen before and after a game).
The has been modeled using TFS built in capabilities.
- Areas to segregate different divisions (1st division, 2nd division,etc)
- Iterations to model championship seasons and game weeks
- Global list to hold the list of teams
- Team Queries to see which games are scheduled, already played,etc,etc
To show the power of the object model I’ve created two demos
- One that draws the whole championship fixtures in a random manor by creating all the work items that represent a game
- An editor that allow you to see the games (leverages the team queries defined in the process template), edit a game or create associated tasks to a game.
Since the referee have to send reports about the game and sometimes they may include in the report non advisable words I’ve also shown how do develop a custom checkin policy to recommend referees not to include some words in the report. :-) (If you are Portuguese and keep up to date with soccer behind the scenes maneuvers this is much more clearer. Como diria o Octávio “Vocês sabem do que eu estou a falar”)
The session went well (not great but well), but the feedback was positive and people seemed to like my non traditional demo. :-)
I have to refine some of the demos and to make the story and the transition between the demos more smooth. To make things more easy i wanted to have a slide explaining the things i was leveraging in a demo, but this required a second project to show the slides while the demos were happening and a second project simply wasn’t available. Alas next time things will go smoother.
I thing overrall DevDays was very positive. As a whole things seemed to went rather well and this year the evaluations (at a general level) seemed to be above last events average.
At a personal level things went well too. I pulled of the fact that I had to present three sessions in two days.
Not to escape other events tradition, I was stalked by the usual Paparazzi which at the end of the last day managed to corner me and made me mumble a few words to a camera.
Thursday, February 05, 2009
Microsoft has launched a revamped Team System web site. It’s not only a more clean site has it has more dynamic content coming not only from MS team system team as well as aggregating and pointing to content written by the community.
Wednesday, January 21, 2009
In a world that is becoming increasingly virtual and the manufacturing of physical objects are pure commodities. Which skills and techniques are more important for the people who earn their live using their brains ,intellectual skills and their (high paced fading) knowledge? Working harder, working smarter or something else? What is the key to being productive?
It appears that working smarter is an already worn out cliché and needs to be replaced by something else. Mike Elgan says they key is a Work Ethic 2.0 (the follow-up with the help of GTD’s fame Dave Allen follows the same path of thought) but Alan Kay seems to advocate getting back to basics with the willingness to learn through practice (should I repeat the old joke about how to get to Carnegie Hall?).
This thread on an Tim O’Reilly post discusses this specifically to programming.
But with all these discussions could be nicely summoned on a single phrase
Do not handicap your children by making their lives easy.
-- Robert Heinlein
Deja Vu , Deja Vu
Wednesday, January 14, 2009
Queres ganhar uns livros? Participa no passatempo da MSDN Flash
The cat is almost out of the bag
DevDays 2009 is going to be announced very soon in the meanwhile you can browse the official site :-)
It’s a two day event with over 50 sessions and 40 hands on labs.
With a lot of topics including:
- Visual Studio 10 and .Net 4
- Microsoft Surface
- Windows 7
- Internet Explorer 8
- Windows Azure and Azure Services Platform
- Biztalk 2009
- Silverlight e WPF
- SQL Server 2008
- Windows Live Services
The agenda is not closed yet, so I’m not yet sure which topics i will be talking this year. :-)
The date and location is already closed. 18 and 19 of February.
Keep an eye on the session page to see which news are going to be announced in the next few days and weeks. :-)
Sunday, January 11, 2009
In a previous post i slightly grasped (actually just pointed to a good post) about the dynamic of code reviews.
I’ve also talked about the lack of tools for doing code reviews in Team System, something that JB Brown (from TeamReview) picked it up and wrote about it a such clear and sucint way that i should have done it in the first place. :-)
Anyway there seems to be a new kid in town. A new web based code review system that can be used in conjunction with TFS.
It is called Malevich, you can read it’s announcement right here or you can just go directly to the Malevich project site on codeplex.
I haven’t tried it yet but it seems a nice and capable. The TFS integration is a bit on the light side, since it only interacts with source control (since it supports other source control systems as well). You also need to use a command line tool to start code reviews.
If Visual Studio supported extending the checkin window it would be possible to add a way to trigger a code review directly from there. Since an addin would be come in very handy to start code reviews directly from Visual Studio.
When a code review is “requested” a mail is sent to the person (or persons) that are invited to review the code, it would also be nice if a code review task as automatically created in the work item store.
The good thing is that Malevich is available with source so you can hack it yourself. :-)
Thursday, January 01, 2009
At the first day of every quarter Microsoft MVPs stare at their mail client for THE email. Was the award renewed? or did we dropped the ball?
My award starts at 1st January, so this was one of those mails for me. After dinner I arrived home and checked my email.
No renew email on the inbox. Usually the mail arrives after lunch, so in wondered if I was kicked out? :-)
A cursory look on the spam folder and there it was. My renew mail was there.
So Team System MVP for 2009 again. A good way to start the year. :-)
Monday, December 29, 2008
In the last few days I've found a tool called Gendarme it is an open source tool from the Mono Project that allows you to find problems in .Net (either Mono or Microsoft.Net) applications and libraries.
It has a rule based system to do the analysis and it can be seen as an FXCop/Team System Code Analysis kind of system.
I haven't counted the number of rules it provides but doing a visual analysis it doesn't seem to have as many rules as Team System Code Analysis. However quantity isn't everything and from my analysis it has a pretty number of good rules (including some categories that the Code Analysis doesn't has like Linq)
The rules are grouped in the following categories
You can see the full list (and description) of the rules here
There is no Visual Studio integration so you either have to run it from the command line or from a supplied windows form wizard. No MSBuild integration exists either but it would be fairly easy to implement a custom action or just call the execute task.
Integration with TFS could be either easy or hard depending on how fully integrated you would want it. Since the execution of Gendarme produces a report (XML,HTML,etc) you can execute on your build process and make the HTML report available on the build results (the easy part) or if you want full integration like having the data directly on the TFS build warehouse that could a lot more work.
I've spent a couple of hours running it on a median sized project and it enabled me to fix some naming mistakes, make the code more clear in some areas and even fix an error where disposed wasn't being called.
During my analysis I also found a bunch of false positives. The tool has a feature that categorizes the issues that it has found with a degree of confidence, which states the degree of confidence that the rule has in the face of the found issue (most false positives had a medium to high degree of confidence which is a bummer).
The rules documentation is complete and allows you to understand the consequence of not implementing the rule and why you should fix the found issue (although some rules are not documented).
Definitively a tool to use in the future.
Sunday, December 28, 2008
Did the title catch your attention? Well it did mine.
It is the title of a post that I've just read. Although the title seems a little bit trolish it's because it probably is, if you read the subtitle you will see the main title is not only trollish but very misleading. The post subtitle is The Social Dynamics of Code Reviews.
It mainly talks about code reviews in open source projects but most of the knowledge sprung in this post is applicable to close source projects.
Code reviews is something that is hard to do effectively. Even you get past the sociological issues mentioned on the post, without a decent tool it is very hard to keep track what has been reviewed and it's not.
Code review is one of the area I wish there were some kind of offering for TFS. Granted you can do code reviews with shelve sets and some sort of informal communication via email (assigning code review tasks or even a work item type) but that would give us no metrics or a simple way to keep track which parts of the code have been reviewed.
The more complete solution for TFS seems to be TeamReview (freely available on codeplex) which combines specific work item types and a Visual Studio add-in to help you manage the process. While I never tested the tool, I've given some attention to the description and workflow and it seems to work at a very micro level of the code. And the metric tools (what has been reviewed, what is not, etc,etc) seems to be non existant.
There are some more mature solutions that perhaps can be adapted to be used with TFS:
- Review board which has originated from VMware
- The venerable Codestriker
- JCR - which unlike other tools doesn't work at the source control level but with whole files
On the commercial side Code Collaborator from Smart Bear has a good reputation and it works with TFS but never tried it either.