Experiments with TypeScript, MVVM and Windows Store apps – TypedMVVM available on CodePlex

Have you already tried TypeScript?

TypeScript is an Open-Source language designed by Anders Hejlsberg (the creator of C#, Delphi and Turbo Pascal) for extending JavaScript with additional features available in languages like C#: classes, static typing, interfaces, generics, and modularization (just to name a few).

The language is a typed superset of JavaScript: the compiler generates plain JavaScript that can be executed on every platform where JavaScript is supported (as reported on the main site: “Any Platform, Any host, Any OS”). The following links are a great starting point for understanding and learning it:

There’s been a lot of buzz about it in the last period and, while playing with this new language, I have created a new project on CodePlex – TypedMVVM – for experimenting how TypeScript could be used in a real world scenario by applying separation of concerns via the MVVM pattern in a simple Windows Store navigation app developed with WinJS.

Starting from the default Visual Studio Windows Store app Navigation template for JavaScript, I have converted all the .js source files to TypeScript (mainly renaming their extension to .ts) and then changed / added the following folder structure and classes / interfaces implementations:

  • designData – services implementation for design-time data in order to enable “Blendability”;
  • interfaces – interfaces for Services, ViewModels and ViewModelFactory;
  • libs – TypeScript definitions and TypedMVVM core classes (in particular RelayCommand<T> and ViewModelBase);
  • services – concrete services implementations used by the ViewModels;
  • viewModels – concrete ViewModels implementations;
  • views – views definitions.

The first impression is very positive: static typing is a must-have for writing complex apps and enabling features like refactoring or intellisense. Language features like interfaces, classes, generics and lambda expressions permit the developer to write code more readable, maintainable and extensible.

I’m planning to add more features and helper classes to this sample in the future whilst waiting for the final release of TypeScript so stay tuned!

The complete source code is available for download here: http://typedmvvm.codeplex.com

Happy Coding!

NDepend v5.0 available

I’ve just received my copy of NDepend v5.0: this new version adds several great features to the product including

  • Support for Visual Studio 2013 (yeah!)
  • New Dashboard Panel
  • Focusing on Recent Rules violation
  • UI Enhancements
  • Trend Monitoring
  • Churning Rules and Queries
  • Report Enhancements

Click here to read a detailed description of the new capabilities and access the download links (14 days trial available).

Happy coding!

Follow your passion part 5: awarded Most Valuable Professional for Client Development!

Today I’ve been honoured to receive my 5th MVP award from Microsoft for my contributions about Client Development and related technologies during the last year.

It’s always a great emotion receiving the award: I would like to thank all the people that supported me including the smart guys working in Microsoft, my MVP lead Cristina González Herrero, the members of the “Insiders” lists and, of course, my family.

Happy Client Development everyone!

NDepend v4.1 adds CQLinq killer feature and support for Windows Store apps

I already blogged about NDepend basic features here: I was positively impressed by the capabilities of this tool by fellow MVP Patrick Smacchia.

NDepend permits you to examine .NET projects and highlight different metrics in the code in order to better analyse what areas of your solution needs refactoring for improving performance, code maintainability, application stability and applying best coding practices (just to name a few).

Some features, already available in the previous versions of NDepend, include tools for visually representing dependencies between classes, defining custom rules on code, explore code diffs and analyse code coverage. These ones are particularly helpful when the size of the project grows: a visual representation helps the developer to better identify areas that needs more work (and then save development time).

Recently Patrick contacted me for highlighting the new features available in NDepend v4.1. I was very pleased to find support for Windows Store apps but another capability got immediately my attention: CQLinq.

This is a killer feature: CQLinq (acronym for Code Query LINQ) enables the developer “to query the code” for retrieving information about it. Some simple examples of queries could be:

  • find me the methods too big / too complex;
  • find the methods added but poorly covered by tests;
  • get information about naming conventions;
  • any other query you like: the possibilities are not limited at all!

Technically these queries can be constructed using the traditional LINQ syntax and the types defined in the NDepend.CoreModel of the NDepend API.

The best place to start using CQLinq is here by exploring the dedicated section on the site which contains a ton of different examples to start: I recommend to try and run the available samples which are an excellent starting point and then modifying them for custom queries.

I’ve been really impressed by CQLinq and I can’t wait to use it on real projects to enhance the quality of the code and then reduce the time needed for new implementations.

Happy coding everyone!

MultiTouch Behaviors available on NuGet

I’ve received several requests for publishing the MultiTouch Behaviors on the NuGet gallery so I created a simple package containing support for the Windows Phone and Silverlight platforms.

To enable your project for MultiTouch, just run the following command in the Package Manager Console and all the libraries and dependencies will be added to the Visual Studio project:

PM> Install-Package MultiTouchBehaviors

Alternatively just search for the package selecting Tools->Library Package Manager->Manage NuGet Packages for Solution from Visual Studio 2012.

If you are interested in creating a NuGet package for your open-source project, register an account here in the gallery and follow the instructions described in the section “Creating and Publishing a Package“: they are very clear and contain detailed information about the process.

The package definition for MultiTouch is also available in the Source Code section on CodePlex.

Happy Coding!

Microsoft Patterns & Practices: Prism for the Windows Runtime – My favourite resources

As you may know, the Microsoft Patterns & Practices team has recently released the final version of  “Prism for Windows Runtime“, available for download here on CodePlex.

Prism for Windows Runtime

This project contains a complete guidance for building Windows Store apps using C# and XAML and includes the following resources:

Big kudos to all the p & p team: they did an amazing job and I personally felt honored to have the possibility of providing feedback whilst the project was in development.

This is really a great guidance for building Windows Store applications that can be easily tested, maintained and extended: every developer building complex apps will benefit from it.

Other useful links:

Happy coding everyone!

Windows Phone 8 Multi-Touch Behaviors available on CodePlex

The last week has been very exciting for Microsoft developers: The //build/ conference in Redmond was full of amazing content including Windows 8Windows Phone 8 SDK, Microsoft Surface, Xbox SmartGlass, Kinect for Windows and the new language TypeScript.

Unfortunately I hadn’t the possibility to participate at the conference but had some free time during the week-end to watch some of the recorded sessions available here on Channel9: this is really a great resource and I suggest everyone interested in Microsoft technologies to download some videos and have fun with it.

I decided then to take a look at the new features available in Windows Phone 8 and the related SDK: Justin Angel has a great article about this topic in the Nokia Developer Community.

To get my hands dirty I moved then on my personal Open-Source project “Multi-Touch Behaviors” on CodePlex: this is a set of Epression Blend Behaviors for different platforms including Windows Phone, Silverlight and WPF for applying gestures and manipulations (like the one available in the “old” ScatterView control) to generic XAML elements.

The project was not yet updated to Windows Phone 8 so I took this opportunity and experimented with the new SDK: this was really a great experience since I was able to upgrade quickly all my samples to the new platform using the same codebase used for the Silverlight version.

Unfortunately I haven’t the possibility  to test the performance on a real Windows Phone 8 device at the moment but the first impressions are really positive.

I have already checked in the code for WP8 here, I’m planning more testing and development in the future.

Happy XAMLing everyone 🙂

Follow your passion part 4: awarded Most Valuable Professional. Thanks Microsoft!

Today I’ve been honoured to receive my 4th MVP award from Microsoft for my contributions about Silverlight and XAML related technologies during the last year.

Every new award is always a great emotion; I would like to thank all the people that supported me including the smart guys working in Microsoft, my amazing MVP lead Alessandro Teglia,  the fantastic groups of the insiders lists and the “terrific” Silverlight MVPs. You all rock.

Enjoy and continue XAMLing everyone, big times ahead!

Download Windows Phone SDK 7.1.1 Update!

As announced on the Windows Phone Developer Blog, Windows Phone SDK 7.1.1 Update is now available for  download on the Microsoft Download Center.

The WPSDK 7.1.1 Update provides a WPSDK patch that enables developers to develop and test for the recently announced Windows Phone 7.5 256 MB devices, as well to run the WPSDK 7.1 on the Windows 8 Consumer Preview release via the following:

  • Updated 512 MB OS Emulator Image: An updated build Windows Phone OS 7.1 (Build 8773)
  • New 256 MB OS Emulator Image: A new Windows Phone OS 7.1 emulator image (Build 8773) that emulates running on 256 MB devices
  • Emulator Choice: Ability to debug or run your WP apps in either the 256 MB or 512 MB emulator
  • Windows 8 Support: An updated emulator is included, which can run on Windows 8
  • IntelliSense support for adding the new 512 MB requirement to the Windows Phone App Manifest file

News since the CTP release last month:

  • ‘Go Live’ license: The update now has a ‘Go Live’ license; developers running WPSDK 7.1.1 are now empowered to publish their Windows Phone apps to the Windows Phone Marketplace
  • Full Localization: WPSDK now supports all 10 IDE languages; and the OS image now has Malay and Indonesian
  • Windows 8 Support: The updated emulator will now run on Windows 8; note that the OS is still not officially supported by developer support until the final OS release

Useful links:

Windows Phone SDK 7.1.1 Update CTP Download Center page

Documentation

For additional information on this release, please refer the post on the WP Developer Blog.

Calcium framework for Windows Phone available

Fellow MVP Daniel Vaughan has published in these days on CodePlex a new version of his “Calcium” framework targeting Windows Phone.

From the official release notes:

Calcium for Windows Phone is a consolidation of the infrastructure code that has been written for the book Windows Phone 7.5 Unleashed, and is already used by a number of published apps. 

Some of Calcium for Windows Phone features include: 

  • A user option’s system that allows you to add a settable option to an options page, with a single line of code.
  • A bindable application bar with toggle buttons and menu items, hyperlink button/menu items, which allows you to host multiple application bars in a Pivot.
  • Built-in support for localization. Bindable resources allows the user to change the interface language at run-time.
  • An IoC container and DI infrastructure, and templates to allow you to hide or show a Purchase link in your app depending on the • Trial state of your app and so forth.
  • Templates for Views with ViewModels.
  • Attribute based state persistence system.
  • Message service that allows you to display messages and ask the user questions from your ViewModel.
  • Launchers and Choosers abstraction layer.
  • Input Validation system, with styles customized for displaying validation errors.

And much more! 

Unlike Calcium for WPF and Silverlight, Calcium for Windows Phone does not depend on Prism and has a smaller footprint, more suitable for the mobile platform.

Other useful resources:

Fortify your apps with Calcium for Windows Phone! 🙂