Tuesday, September 18, 2012

As the Microsoft developer world turns: Guidance for the perplexed


Microsoft is in the midst of launching a host of new operating systems and tools this summer/fall. So what's a developer to choose to build apps and services for Windows 8, Windows Phone 8, Windows Server 2012 and/or Windows Azure?



There are familiar, legacy .NET tools and frameworks available, like Silverlight and Windows Presentation Foundation. There are newer and less familiar (to many Microsoft developers) options including XAML and HTML5/JavaScript. And on the server side, there's ASP.Net for building server-based Web applications.

Microsoft tools vendor Telerik has delivered a new version of its Platform Guidance document that aims to help developers sort through the myriad choices, based on the type of application they are developing. The eight-page Platform Guidance PDF is a free download, available as of September 18.

The document doesn't advocate abandonning tried but true platforms like Silverlight, even though Microsoft seems to be trying to wean developers from that platform by downplaying it and declining to comment on its future, beyond committing to support Silverlight 5 through 2021. (Ditto with WinForms, which Telerik notes isn't the best choice for "greenfield" development, but which still has its place.)

Here's the Cliff Notes version of what the Telerik principals are recommending for development of each type of app:

Desktop Applications – WPF
Dashboard/Reporting Applications – ASP.NET MVC (Model View Controller) with HTML5
Data-Driven Websites – ASP.NET MVC and Web API
Interactive Web Applications (Forms over Data) – ASP.NET WebForms
Mobile Website – ASP.NET MVC HTML5
Tablet Applications – XAML and .NET

The Platform Guidance document includes a chart to help developers evaluate whether XAML or HTML is a better choice for building a Metro-Style -- now know officially as "Windows Store" -- application:



At only eight pages, the Guidance document isn't meant to be a be-all/end-all work. But it's a starting point, which offers some much-needed suggestions for those attempting to navigate the rapidly changing Microsoft development waters.

Friday, September 14, 2012

Web Matrix 2 is Reborn the Matrix


Microsoft's general web development tool, Web Matrix, has been released in version 2. It not only supports ASP.NET, but PHP and Node.js. It might not be open source, but it is free to download and use. What is in it for us? What is in it for Microsoft?

Web Matrix 2 is a strange web development tool to be coming from Microsoft. It allows you to work with a range of open source, and more importantly non-Microsoft, web technologies. This is something that many potential users would find both puzzling and worrying - but in this case the Trojan horse is all too plain to see if you just look at what it is suggested you do with the website you have created.

The idea seems to be that Web Matrix 2 will funnel users into the arms of Azure, Microsoft's cloud hosting service. However, this said, you can use Web Matrix for general web development and deploy on a LAMP server if that's what you want to do.

Web Matrix is a lightweight web development system that installs and sets things up correctly for you. If you download it then you can basically get started on your web site by selecting the appropriate template, waiting a few minutes while the site is generated, and then you can start coding. A development web server, IIS 7.5 Express, is set up for you and you can generally launch web pages as soon as you have created them.


The main supported technologies are ASP.NET, PHP, Node.js and of  course HTML5/JavaScript. The code editor supports highlighting and code completion and makes it easy for you to work.  Support for Node.js and mobile web sites are the two major new features. You can also use CoffeeScript if you want to. Mobile web sites are supported by the use of jQuery Mobile.
As well as the basic technologies, Web Matrix also supports websites based on many different frameworks - WordPress, Joomla, Ubraco, Kentico and more. Again the huge advantage is that the templates install a configured starter site complete with all dependencies. You simply select the sort of website you want to work with and it is ready to go in a few minutes. Amazingly you can opt to use either SQL Express or MySQL as the database for the sites.
You can see an overview video below:



The main new features in Web Matrix 2 include:
Extensibility model lets you write your own plug-ins or use community-built ones
Faster install of open source apps such as Joomla!, WordPress, Drupal, DotNetNuke and Umbraco
New templates for PHP, Node.js and HTML5, and mobile support for all templates
Intellisense (code completion) for major languages, including Razor, C#, VB, PHP, Node.js, HTML5,
CSS3 and Jquery
Application-specific code completion for top apps like Umbraco, WordPress and Joomla!
Simple UI to install NuGet packages
Ability to preview your site using mobile emulators
Remote view to make quick edits to files on live sites

At the end of your development process Web Matrix will offer to publish your site to Azure, but it also offers other options so you are in no way trapped by it. Of course, it is better integrated with Azure but you would expect this from a Microsoft product.

Overall Web Matrix makes it worth trying to overcome any anti-Microsoft bias you might have. It is a free web development tool that works with open source technologies to create a general, standards-based website. It is free to use and works with non-Microsoft technologies in a very even handled way. It is certainly worth trying out.

Monday, September 10, 2012

Umbraco Web CMS 4.9 Focuses on the Editor Experience, Rich Media


The open source content management system Umbraco may have dropped version 5, but the refocus on version 4 has brought some nice improvements and a number of bug fixes.



The free, ASP.Net-based Umbraco is designed for building websites — from small campaign or brochure sites to large media-based sites — and complex Web applications.

Umbraco, which bills itself as a  “priceless CMS at the cost of virtually nothing,” was first released in version 2.0 in 2005, which was also when the first developers conference, called CodeGarden, was held. Unfortunately a turn in the wrong direction resulted in dropping the next major version of the Web CMS to go "back to the basics".

“The early days of Umbraco was the result of a wonderful collaboration between three guys in Copenhagen,” wrote one of those guys, Niels Hartvig, on the Umbraco blog. He added that, “almost eight years later — I’m smiling again” because of the new release.

Focus on the Editor Not the Developer
Umbraco 4.9 features a revised editor, easier integration of third-party videos and images, and a new media library. In addition, the new version includes more than 50 “big” bug fixes, incorporated from submissions by over 20 contributors.

The application now supports HTML5 uploads to the media section, and there’s a new folder content overview that can be filtered and from which common actions can be applied to media items.

The Media button in the Rich Text Editor now supports the oEmbed standard in its embedder, and the code editor for templates, scripting and XSLT templates has been upgraded. Creating and inspecting relation types can now be conducted from the backoffice.

Saturday, September 8, 2012

Virtual Server with IIS 8 released by myhosting.com


Microsoft officially released the highly anticipated Windows Server 2012. The newly released server operating system offers a number of features that can be utilized to benefit developers, resellers and businesses. On the heels of this release, myhosting.com has announced the launch of its VPS Hosting product line of Windows Server 2012, deployed on its existing Microsoft Hyper-V Server 2008 R2-based platform.



“Our customers are always looking for the latest and greatest solutions for their Virtual Dedicated Server,” said Celal Ulgen, CMO at SoftCom Inc. “By offering Windows Server 2012-based solutions so soon after the release date, we hope to give our customers a head start against their competition, so they can take advantage of all the improvements available in the platform.”

Included in Windows Server 2012 are a number of key features that web hosting customers will find useful, including support for ASP.NET 4.5, the latest .NET Framework, IIS CPU throttling, Application Initialization which can improve time to first byte, Dynamic IP Restrictions to help prevent DoS attacks and FTP Logon attempt restriction to help prevent brute force attacks, as well as WebSocket Protocol for real-time client/server communications. Other key features include enhanced support for open standards, improved Remote Desktop and VDI, and powerful new self-service feature that extend more control to users when accessing from the Cloud.

“We have always had a great appreciation for the products that Microsoft Offers,” said Turker Sokullu, CEO, “As a Microsoft Gold Certified Partner, we feel it is our duty to keep in touch with new developments at Microsoft and to launch those products and services that will work well for our customers. And by participating in the Rapid Deployment Program for Windows Server 2012, we were able to get our Windows Server 2012-based solution ready and launch a competitive solution right out of the gate.”

“Microsoft is thrilled to be working with companies like SoftCom,” said Peter Doulas, Business Group Lead for the Server and Tools Division within Microsoft Canada. “There has been a lot of enthusiasm for the recent release of Windows Server 2012, largely in part to a myriad of new features that make for a richer user experience, smarter cloud computing capabilities, intuitive automation and more. In collaborating with companies like SoftCom, customers can tap into the resources and technology to help transform their business.”

Monday, September 3, 2012

Aspect-Oriented Programming with PostSharp


Aspect-oriented programming has the potential to help every developer write higher-quality code in less time. Here's how to declaratively apply custom methods implementing common functionality to your code.



In a recent discussion with the applications development manager of a major global company that uses the Microsoft .NET Framework as its development platform, I was asked how his department could increase productivity. We discussed several approaches, including increased code reuse. That discussion led me to take a deeper look at aspect-oriented programming (AOP). What I found is that AOP can increase code reuse within targeted functional areas, while also improving code maintainability and readability. AOP has the potential to help every developer write higher-quality code in less time.

What Is AOP?
At its core, AOP is the practice of encapsulating functionality common among multiple code elements yet independent of the business logic, and applying that common functionality to the target source code elements declaratively.

The common functionality is referred to as a crosscutting concern because it "cuts across" the entire application as a capability that's useful, independent of the business logic. Common examples include error handling, logging, tracing, instrumentation, transaction handling, security, caching, data binding, undo/redo and even multithreading. None of these 10 examples involves business logic, but they're all common and often necessary capabilities in any high-quality application.

Benefits of AOP
The code that implements one of these crosscutting concerns is known as an "aspect," and thus gives rise to the term "aspect-oriented programming." What benefit does it provide the developer if the functionality for these aspects can be removed from the primary source code and declaratively applied as needed to the application?

I'm truly excited by the benefits of AOP:

The business logic source code is much easier to read and understand, without the clutter of the code needed to support crosscutting concerns.
Less repetition in the code of the business logic means shorter developer times, fewer defects and a less-tedious coding experience.
Developers can better focus on implementing the proper business logic.
Less-experienced developers won't have to learn to weave these crosscutting concerns throughout their code, and experienced developers will appreciate more fluid coding by focusing primarily on business logic.
To be clear, the code for these crosscutting concerns is still present in the application; it has simply been moved into aspects. Writing these aspects generally requires a more experienced developer, so they tend to be high-quality code. These aspects are added to the application by the AOP framework at specific execution points known as "join points," such as at the time of object instantiation, method initiation, method exit, property access and so on. A set of join points is known as a pointcut.

History of AOP
AOP isn't something recently created to help .NET developers. Work on AOP started in the Xerox Palo Alto Research Center (PARC) in 1996, which is the same group credited with giving us laser printing; the Ethernet network protocol; the modern PC GUI using windows, icons and a mouse; object-oriented programming (OOP) via Smalltalk; and very-large-scale integration (VLSI) for semiconductors. PARC research into AOP resulted in the design of what is now AspectJ for the Java language.

Since 1996, AOP extensions have been developed for multiple languages, including C++, Ruby, PHP, SAP ABAP and even COBOL. Visual Studio 2012 and earlier versions do not directly support AOP. The aspect-like capability to declaratively apply custom code to methods can be found in Windows Communication Foundation (WCF) declarative filters and ASP.NET MVC dynamic filters.

The Path to AOP
In order to fully implement AOP in a .NET application, you want the ability to move crosscutting concerns into separate aspects, apply them declaratively to one or more source code locations and -- without changing the application architecture -- enable the use of aspects. While the source code modified by the aspects may be aware of the aspects by leaving certain tasks to them, the source code should be ignorant of the internal implementation of the aspects.

One way to add aspects into an application is to wrap each class with a dynamic proxy (outer shell) to provide additional functionality around the class, but the benefits of this approach are limited. Most dependency-injection frameworks in .NET provide some support for proxy-based AOP, which can be useful for logging, instrumentation and caching. This approach is only able to inject behaviors into the communication between a service and its consumer -- not inside the service itself -- so it can have the disadvantage of altering the application architecture to support aspects.

Another way to add aspects to an application is through code generation, but this, too, is limited. This approach allows for more powerful code transformation, but requires recompilation of the application each time any of the aspects change.

A third way to add aspects is through metadata-driven programming, utilizing dynamic languages such as IronPython or IronRuby. This can allow additional functionality to be added at runtime via aspects, but the complexity of implementing your own AOP framework is prohibitive.

To see how to implement AOP in .NET using a full-featured AOP framework, I looked at PostSharp, which claims to be the most comprehensive aspect-oriented software available for .NET.