Bill Blogs in C# -- C#

Bill Blogs in C# -- C#

Created: 2/2/2015 4:59:35 PM

I’m teaming up with Grand Circus to deliver another .NET developer bootcamp this Spring. This bootcamp will teach the core skills necessary to build modern web applications using ASP.NET and the core .NET framework.

For most of my regular readers, this bootcamp is probably too introductory for you. It does not assume that your have any prior knowledge of C#, or ASP.NET. We start at the beginning, and move as fast as possible to learn the core skills needed.

However, if any of you have friends or associates that are interested in making a career change and learning to be a developer, this is a great way to start. During the 8 weeks, students learn the core skills needed to make that transition. In addition, Grand Circus will be providing placement assistance to help students land that first developer position.

If anyone you know wants to become a developer, and be part of Detroit’s Renaissance, tell them to sign up here. We had great success with the first bootcamp (over 80% of those students have landed developer jobs), and I’m anticipating the same outcome this time.

Created: 1/21/2015 7:46:39 PM

I’m a bit late this year, but here are my thoughts on the Software industry as we move into 2015.

It’s a great time to be a Developer

I’ve said it before: The talent war is over, and the talent won. Software developers are in high demand everywhere. My readers probably know this. You likely get as many recruiter emails as I do every week. I don’t see this changing. All the demographic and economic information available indicates that demand for software developers will continue to outpace the supply of people with those necessary skills.

But don’t be complacent

But, like all shortages, economics will change this situation as well. More and more people are entering the software field because there is such high demand for developers.But, unlike a generation ago, you will need to compete against people everywhere in the world. If you want to stay in demand, you need to have more skills besides core software development.

There are many directions to go here in addition to the traditional advice of learning the business and adding soft skills. Are you good at explaining software development to others? Help mentor teams. Do you have some of the specific skills that are in high-demand? (Read on for my thoughts on what those might be.) Are there particular verticals you want to explore?

Whatever it is, become a multi-dimensional asset. One day, “folks that can code” will not be as in demand as they are now. But, high-quality software people will still be in demand.

And with that, on to some more technology based thoughts.

Cloud and Big Data

I’m lumping these together because Big Data analysis requires a lot of resources, and cloud computing puts those resources in the hands of many more organizations.

I’m amazed at the amount of information that can be discovered using big data analysis. While it’s not an area I work in extensively, the innovations there are amazing. I expect this trend to continue as more and more data is online for analysis and research.

If it hasn’t already, 2015 spells the time when Cloud Computing is mainstream. I’m firmly convinced that I will never buy a server again. Furthermore, I’m certain all my hosting will be at a cloud provider, not a traditional hosting service. My current choice is Azure, but this is an area of strong competition. I believe this trend will accelerate as companies need to retire and replace existing servers. That will drive more cloud adoption. Faced with the choice of buying a depreciating asset, or migrating to the cloud, the cloud will win.

.NET and C# are on the rise (again)

To paraphrase Mark Twain, “The reports of .NET’s death have been greatly exaggerated.” The last year saw preview releases of the Roslyn compilers, Visual Studio 2015, ASP.NET vNext, and more. License and language changes, along with major investments from Xamarin make the .NET and C# ecosystems cross-platform.

There’s more interest in the C# language, including all the new features coming soon in C# 6. Now that the Roslyn codebase has gotten to the point where the existing C# features were supported, the language team is working hard to add new features to the language. It’s an incredibly powerful and expressive language, and getting more so every release.

Open Source all the things!

An important driver or that resurgence is that the .NET ecosystem is becoming Open Source. The Roslyn compilers are on Github, along with the core .NET framework, ASP.NET vNext, Entity Framework, and more. The licenses governing these releases have been updated to address platform concerns. (Namely, the new licenses allow these projects to be used on non-Windows platforms; that had previously been disallowed).

At this time, C# and .NET provide a real cross-platform open source strategy for backend, mobile, web, and tablet applications.

That fact makes the .NET resurgence real, and important for all developers, not just those targeting Windows.

The programmable web

The web is programmable, and users, customers, and software decision makers expect modern applications to run in a browser.

That means JavaScript has become a core programming skill. Like it, tolerate it, or hate it, but you must have a solid understanding of the JavaScript language to be effective in this world.

JavaScript++

Even though JavaScript is ubiquitous, it is not the only way to write programs for the web. CoffeeScript, Dart, and TypeScript all provide paths to write code in other languages, and compile that code to JavaScript for execution in any modern browser.

Of those three, my bets are on TypeScript. TypeScript is compatible with JavaScript, but extends it with important features that make large-scale development more productive.

I expect innovation to continue here, including changes to the ECMA standard for the core ECMAscript (JavaScript) language.

The big question mark: Mobile Strategy

It’s dangerous to make predictions, especially about the future. There’s one thing I’m confident in: No one is sure what the right mobile strategy is. There are just too many options. You can use browser based applications for everything. You can use a cross-platform web based framework like Cordoba. You can use a cross-platform native framework like Xamarin. You can also create separate apps for each platform. They all have different advantages and disadvantages. And, different teams have different existing skillsets, which means that the cost of each strategy is different.

Personally, I’ve created apps using the first three. I really don’t know which I prefer. I like the native feel of using the Xamarin tools. And yet, the web only versions do mean more portability.

It’s still going to take time for better answers to become clear.

And a brief look back

I’ll close this with a brief look backward. Last year was a pretty big change, and I enjoyed every minute of work. I had the pleasure to teach developers in multiple countries, and different continents, and at different skill levels. I’m excited by the response so many people had learning new skills.

And, at Humanitarian Toolbox, we kept building software to support humanitarian efforts. We got official 501(c)(3) approval, and we are now ready to build more this year.

Created: 12/22/2014 7:55:04 PM

For the past year, I’ve been creating Github repositories to store the code demos for my public presentations. I’ve found it had quite a few advantages. Now, some other speakers are starting to follow the same procedure (or even extending it). Earlier this week fellow MVP Joe Guadagno asked me about how it works, and then used it for his next presentation.

He also started a broader conversation about the technique on twitter. A number of other speakers chimed in with their thoughts. Twitter has great immediacy, but doesn’t let me explain how I do this at length. In this post, I’ll discuss why and how I use git repositories for code presentations.

Why use Source Control for Presentations?

I’d grown very dissatisfied with the common practice of having a zip file for the starter project and a zip file for the finished code. Way too much information was missing.  My best presentations show attendees more than just what to do. I also discuss alternatives that don’t work correctly, and why. These small side steps are missing when the only assets are “before” and “after”. Missing is “why choose this path?”

What was missing was any roadmap to “tried this, found these problems and changed directions.”

I can preserve all that history using a source control system. In fact, I’d been using my own internal source control for presentation demos for years. I could practice by rewinding the history, replaying the checkins and seeing each step along the way through the demos.

Github has now made that possible for anyone attending the presentation. It’s public, and I can represent each step of every demo as a branch in the repository.

The Process

My process starts after I’ve thought through the demonstration that I want to show during the talk. This hasn’t changed at all: what do I want people to learn, and how will I explain those concepts?

Once I have the story, and the arc of the demo, I’m ready to make the repository. I run through my practice sessions (using git at each step) and the I’m ready to record.

I make the “start” project for the demo. Maybe this is direct from File: New Project, or maybe it’s a starter project that already has some features.I’ll create a new git repository, and make regular commits as I get to the initial state. Once I’ve reached the initial state, I make a branch. For these repositories, every branch starts with a 2 digit number, so that my talk attendees can easily follow along. The first branch is likely “01-Start” or something similar.

I continue to build the demo, by following my script. I use commits for small-grained changes that I want people to follow, if they are working on their own. I use branches for larger-grained changes that I discuss during the talk. You can see each section of the talk by checking out each labeled branch in turn. You can follow each commit to see all the smaller changes that make up each new feature.

One very powerful feature that I use for talk demos s to be able to show what happens down the wrong path. For example, I may make an async demo where I’ll explore the problems that happen from using async void methods. Letting the audience see those mistakes is important for their learning. Using Git, I can explore dead ends, and leave those branches as examples of problems. I can back up and checkout an earlier branch, then show the correct path. Attendees can follow the straight-line path, or check out the dead ends for reasons why certain paths are avoided.

Once I’ve finished running through the script of my demos, I check the repo and the commits and branches in order one last time. I make sure each of the branches can be checked out in order and that each branch correctly represents the next checkpoint in the demo.

On Stage

Having a repository does not mean I don’t write code during the presentation. Before the talk, I checkout the starter branch. There are two rules I follow during the talk:

  1. No one wants to watch me type.
  2. It’s important to show the progress from start to finish.

You may notice that these two rules contradict each other.  I do show some of the changes as I move forward through the demo. But, I don’t type everything out. Often, I prefer doing a ‘git checkout’ to move the code to the next step.

If I don’t get any questions, comments, or feedback on the discussion, the demo goes forward from its starting branch to its final branch. I’ll mix typing some of the changes (or using the Visual Studio tools to make large-scale changes, depending on the demo), with using git to move forward by checking out the next branch.

Because I’ve done some typing, git complains when I want to roll forward from branch to branch.

One important tip is to remember to do a ‘git checkout –f’ so that you don’t have to stop, rewind anything you typed, and then move forward.

I can also go off script to answer questions or respond to different feedback. This changes the demo, but I can get it back on track by checking out the next branch.

I don’t have hard and fast rules for when I type vs. when I roll forward in git. My heuristic is that when attendees will learn from seeing the code typed, I type it in. When that transformation is not instructive to the topic, I roll forward. I’m not certain I always get this right, but I like the guidance so far.

At the end of the talk, I tell attendees the URL of the repository, and tell them to explore.

After the talk

Github provides several tools to continue the conversation with attendees after the talk. I’ve used all of these after different talks.

  1. Code Review Comment (or question): Attendees can use github to view any commit, and ask questions about the code. Those questions may be about the topic of the demo, or can be unrelated questions. I like handling those unrelated questions this way, because it doesn’t change the fundamental story of the talk, and attendees do get their questions answered.
  2. Fork and Pull Request: Sometimes I’ll have attendees ask why I wrote code one way vs. another. They can fork the repo, and show me their idea in a pull request. Sometimes I explain my reasons and the attendee learns something new. Sometimes the attendee has a better idea, and I learn something new. Either way, it’s great.
  3. Fork and Branch: Sometimes an attendee wants to take the project in a new direction. They can do that by forking the repository, and extending it on their own. It’s no longer about the original talk, and I’m happy to see that it inspired someone to do something new.

This process is still somewhat new, and I’m sure I’ll continue to refine and change how I do it in the coming years. However, I really like where it is heading.

What do you think?

Created: 12/4/2014 8:53:23 PM

One of the new features in C# 6 is expression bodied members. This feature enables us to create members (either methods, property get accessors, or get methods for indexers) that are expressions rather than statement blocks.  Consider this class, and not the highlighted portion:

 

public class Point

{

    public double X { get; set; }

    public double Y { get; set; }

    public double Distance

    {

        get

        {

            return Math.Sqrt(X * X + Y * Y);

        }

    }

}

 

That’s quite a bit of typing for a very simple method.  C# 6 lets you replace that accessor with a lambda expression:

 

public double Distance => Math.Sqrt(X * X + Y * Y);

 

The body of the get accessor is replaced by the simple expression that returns the distance of the point from the origin.

As I mentioned above, expression bodied members can also be used for methods:

public override string ToString() => string.Format("{{0}, {1}}", X, Y);

 

Lest you worry that this feature only works with non-void methods, here’s a TranslateX method that moves the point in the X direction by x units. It has a void return:

public void TranslateX(double x) => X += x;

It’s one of the features I like a great deal in C# 6. When you use it with simple, one – line methods, it increases readability and clarity of a class.

When I speak on C# 6, I always get reservations from from people about how this feature could be abused. Developers are concerned that someone (not them mind you, but other developers they work with) would abuse this feature and write methods are are pages long using this syntax.

Don’t worry. The compiler won’t allow it.  Suppose I tried to extend the TranslateX method to take two parameters are translate the point in both the X and Y directions.  The compiler does not support expression bodied members with block statements.  None of these attempts to write a method with more than one statement as an expression bodied member will compile:

// Does not compile.

public void Translate(double x, double y) => X += x; Y += y;

 

// Does not compile.

public void Translate(double x, double y) => { X += x; Y += y; };

 

// Does not compile.

public void Translate(double x, double y) => if (true) { X += x; Y += y; };

 

At this point, even the most evil of your co-developers will give up and use the standard syntax for a method that has more than one statement.

Overall the new syntax leads to clearer code, and the restrictions on the syntax that the method must be an expression ensures that it can’t be abused (much).

Created: 11/24/2014 3:55:52 PM

The preview of Visual Studio 2015 is public, and the Roslyn APIs are stabilizing.  A group of language MVPs have begun working on a series of code analyzers and code fix tools that will help you write better code.  To facilitate this work, we’ve created an organization on Github, .NET Analyzers, that contain the repositories for the analyzers, code fix projects, and refactorings that we’ve created.

We’ve got seven code repositories in place already. There’s also a Proposals repository that has potential ideas for new code fix or analyzers projects.

The code repositories are varied, both in completeness and in scope. Some are for a single refactoring. Others will grow to a full suite of analyzers.  Some are nearing completion. Others haven’t had any code uploaded yet.

Mark Michaelis and I started this group while at the MVP summit. Since then, I’ve been very impressed with the response. In particular, Sam Harwell, Tugberk Ugurlu,  and Adam Speight have been working very diligently on several of the analyzers and code fix algorithms. There have been many others that have contributed and offered suggestions and help. I’m singling those three out because they have really spent significant time working on this.

We’d love to see other people get involved as well.

If you want to join us, check out the organization on GitHub. Look at the issues in the code repositories and contribute. Make your modifications, and submit a pull request. We are generally following Github flow, but that’s not a firm requirement. If you are new to Github, just ask one of us via Github messaging, and we’ll help walk you through it.

If you have an idea for something you want to implement, please add it as an issue to the Proposals repository. Mention that you want to work on it. We’ll help you define the requirements, and suggest if the new feature should go in an existing repository, or if it should be a new repository.

If you have ideas, but aren’t sure how to implement them, add them as issues to the Proposals repository. We’ll discuss it and prioritize it with you. If you want to implement it, but need help, just ask.

Special note for the VB.NET community: We’re interested in having support for important VB idioms as well. However, we need the VB community to help us. Most of us are more involved in the C# community than the VB.NET community.

We want to see this grow and become an indispensable set of extensions for .NET developers. Please join us. Let’s see what we can build together.

Created: 11/13/2014 12:50:17 AM

Today, November 12th, Microsoft made some major announcements about the .NET Ecosystem.

I’m going to concentrate on four points: Open Source, Cross Platform, Deployment, and Community Involvement.

Open Source

The core .NET Framework is now Open Source. No longer will you choose “Microsoft or Open Source?” The entire Microsoft .NET Development stack is moving to Open Source. From the core CLR on up. I remember NDA meetings with a very small set of people many years ago starting to push for a moment like this. It has taken a long time, and this movement has slowly garnered more and more people. Before I go any further, thanks to those folks that worked at Microsoft back then and started this ball rolling.

It’s really Open Source: It’s being distributed under the MIT license, and the team has committed to accepting community contributions. You can grab the source, build it, use it, fork it, and do anything else allowed by the standard MIT license. It’s a great day.

Cross Platform

By “do anything that’s allowed by the standard MIT License”, that includes running .NET on platforms other than Windows. That explicitly includes Linux and Mac platforms. In fact, to support these platforms, Microsoft will be releasing official distributions for both Linux and Windows.  

Let me repeat this: Microsoft will be releasing official distributions of .NET for Linux and Mac, in addition to the traditional Windows platforms.

Deployment

As part of the work to create Open Source and Cross-Platform .NET distributions, Microsoft is also breaking the link between the Windows OS updates and .NET. You no longer need to run your .NET applications using the framework in the Global Assembly Cache (GAC), on a machine wide basis.

Instead, you can deliver the .NET core framework (or just the parts you use) with your application. This means you can run .NET based server applications that use different versions of the framework on the same machine.

There’s a huge advantage for this: In a data center, you can upgrade individual application on individual machines without forcing the DevOps team to upgrade machines in the Data Center. You can even run different applications with different versions of the framework on the same machine.

It follows that you can run new versions of the framework in Azure before the team has rolled out new images with updated bits.

Just deploy your needed version of the framework locally with your application.

Community Involvement

Finally, the big finish: Visual Studio 2015 Community Edition. This edition is similar to the previous Professional edition, and it’s now free for independent developers. (Enterprises must still license Visual Studio for commercial use). This is a much more useful edition than the previous Express editions: you can build web sites, mobile applications, and windows applications all with the same edition. You’re not limited to just one style of application. Also, this new community edition supports plug ins and extensions.

I’m excited about this as a great product for students I teach. Too often students were using the trial (time limited) trial, or the express versions. Those just weren’t great tools to keep learning and keep growing. This new version is.

Now what?

This is a huge set of announcements, and it’s only the beginning. Microsoft just made a set of huge bets in cross-platform Open Source. I know I have some biases, but .NET is the most open, most viable cross-platform toolset available today.

When someone asks if you have a cross-platform, mobile, or Open Source strategy, you can answer: “Yes, it’s all in .NET.”

Exciting times.

Created: 11/11/2014 4:12:48 PM

I spent last week in Seattle / Redmond at the Microsoft MVP Summit. As is the case every year, this year’s event was primarily NDA content. I’ll be blogging about the technical content at the summit as the NDA restrictions are lifted.

However, I can talk about the experience.  The MVP summit is one of my favorite events of the entire year. I get to meet super smart people from all over the world that share the same love of software development. It’s a huge community, and I’m always amazed at the people I meet. This year was no exception.

I got to meet the folks that build Friendly, a very powerful and interesting test library for test automation. I got a great demo on the evening of the MVP Showcase event. It’s really quite impressive. The main site for their company is here: English, or Japanese.

While at the Showcase, they asked me to sign copies of my book, which has been translated into Japanese. We all posed for a picture after that:

WP_20141102_17_51_00_Pro

It was also the first time I’ve been asked to sign an electronic copy of my book. If I get a copy of the picture,I’ll post that as well.

It was a great opening to the Summit, and I’m happy to have met new people that appreciate what I’ve written. You should check out their project, it’s really cool and quite powerful.

Created: 9/8/2014 7:44:45 PM

Well, it’s been too long since I blogged regularly. That’s because of a large teaching project I was working on over the summer: Experience IT.

The goal was ambitious: Teach more than 40 aspiring developers the skills they would need to succeed in entry level jobs as .net web developers with companies that are growing in Detroit. My role was to develop the curriculum and act as one of the instructors for an 8 week intensive learning experience.

We gave the students an introduction to HTML5, CSS, JavaScript, JQuery, C#, ASP.NET MVC, Entity Framework, and SQL. I did say it was an intensive learning experience.

Experience It

The first day, 44 people showed up, ready to learn. It was a diverse group. The ages ranged from early 20’s, to mid 50’s. It was almost 50% women. There were different ethnic groups represented as well. Even more challenging was that the experiences the students brought into the class was very different as well. Some of the people had done quite a bit of UX work on web applications; they new HTML and CSS, and even a little JavaScript. Others had never done any development work at all. 011

Our first major challenge was to teach such a diverse group. We had to keep the more experienced students engaged while not leaving the least experienced lost. We did that by splitting up into smaller groups quite often. Thankfully I had a team of instructors that really knew the technology stack and the material. They also had a wealth of industry experience and could relate everything we were teaching to the real world tasks developers do everyday.01

The students spent the final two weeks building group projects of their own choosing that demonstrated what they’d learned. All of us enjoyed these two weeks the most. The students had to plan out their projects and scope them appropriately. They needed to assign work to each of the team members. They had to make use of the ALM tools we use everyday: source control, scrum boards, deployments and bug tracking.

Overall, I think the experience was almost as intense for the instructors as it was for the students. We really enjoyed the energy of the last two weeks. All the teams stretched themselves beyond the scope of what we taught. They were using the introductory knowledge we taught and adding to it by doing their own research, and figuring out new libraries and techniques. As instructors, we were busy helping them learn and expand their horizons.

07

After the class ended, the students started working on their job searches. Several have already landed positions. A lot more are going through second interviews with many of the growing companies in Detroit this month. I hope to hear  that many more have started new careers in the coming weeks.

I’m very pleased with the outcomes so far. I can’t wait for the next eager group to get started. The other instructors and I are making a few tweaks to the curriculum so that we can do even better. One change I do want to make is to have students spend some of their time reading and explaining code. I think that would be a great way to improve their skill at joining larger projects.

I’ve been lucky enough to have been very successful in this career. This has been a great opportunity to help others find their own success. I can’t wait to see how far they can go on this journey.

Created: 4/9/2014 3:00:03 PM

By now, I’m sure you’ve heard the big news: There’s a new public preview of the Roslyn C# and VB.NET Compilers.  And, even bigger news: The Roslyn Compilers are Open Source.

This is an important milestone for these projects. The C# compiler is now written in C#; the VB.NET compiler is written in VB.  (See below). They also now do have full support for all the features in C# version 5 (and then some).  The rest of this blog post walks through some of the important ideas in the Roslyn ecosystem.

TL;DR version: Go to https://roslyn.codeplex.com/ and get started.

Using the Roslyn Compilers (and IDE updates)

You can get the Roslyn compiler from a NuGet package, or by signing up and downloading the End User Preview. You will want to do this before you explore the Roslyn Source. That’s because the Roslyn compiler source makes use of new language features only available in the Roslyn compiler. That means you can’t build the Roslyn source with the compilers that ship with VS 2013.

Once you have the end user preview. You’ll find quite a few new features in the IDE. Most of these are covered in the //build talks, available online. My one recommendation: train yourself to look for the light bulb in the left margin of source. There’s lots of new information there.

If you want to dive deeper into Roslyn, get the SDK Preview. That provides templates and examples for writing extensions based on the Roslyn Language services API. One design goal for the Roslyn compilers is to provide the same language services to the compiler, the IDE, and 3rd Party add-ins. Those APIs let you view program source at its syntactic and semantic tree level, and manipulate those trees. If you are interested in analysis tools, or Refactorings, that’s where you start.

Learning about the source (and more about the languages)

The Roslyn source is hosted on CodePlex. It is a git – based repository. You can clone it using your favorite git tools. In my case, I cloned it from the command line using posh-git. Once cloned, I added it to my list of local repositories in GitHub for Windows. That’s worked well for me.

Once you’ve gotten the source, follow the instructions here to build it. Congratulations, you’ve built a compiler.

Feel like learning more, get involved in the discussions.  First, read the language design notes for C# (or VB if that’s your favorite) and then check the Language Feature Implementation status. The language design notes will give you the history and background for the current language features. It’s very illuminating. Personally, I’m thrilled that the teams have the confidence to share this level of detail with the public. You’ll learn an incredible amount by reading about the alternative implementations and the thoughts and discussions around each decision.

For many of the proposed new features, discussions are ongoing. In particular, the discussion on the null propagating operator is rather lively. If you have an opinion, join in.

Do you have ideas?

Well, we all do. And here’s where life gets very tricky. The Roslyn compilers are licensed under the Apache v2 license.  You, me, and everyone else on the planet can fork them and add our own new language features. On the one hand, it’s a fantastic move to release the compilers as open source. On the other hand, it could lead to chaos.

On the plus side, academics (and their students) can teach and learn compiler construction by working with a world class commercial compiler for two of the most popular programming languages on the planet.

Also on the plus side, community members can prototype ideas for language features and submit them for review. That will do a lot to keep the C# and VB communities vibrant and involved.

And, by looking at the compiler source, you’ll better understand how to build extensions and addins that leverage the Roslyn APIs.

But there is a dark side.

Part of the success of VB.NET and C# is that they are consistent languages. The Microsoft and Xamarin compilers both track the standard very closely, and have very few divergences. That’s a positive for the language.

I worry that it’s possible to have several dialects of C# in the future that all behave differently. If that happens, this global experiment to open source Roslyn will have been a mistake.

Rather than worry, here’s my recommendation to anyone looking at creating new language features: Get involved in the feature discussions first. Talk with the team. They are already active in the discussion forums. Get buy-in for the new feature.

If that happens, this is a marvelous new era. If community members create and discuss great new features, and those features become part of the standard C# Language, the global experiment to open source Roslyn will come to be seen as one of the defining positive moments in computing history. That’s what I want to see happen.

Created: 4/8/2014 12:21:12 PM

Let’s start with the biggest story:

A public Roslyn Preview that’s Open Source.

The next versions of C# and VB.NET have progressed far enough that you now have a new public preview. The Roslyn Compilers now support all the existing features (C# 5, VB.NET 12). In fact, they have even added some new prototype features for the proposed C# 6 and VB.NET vNext releases. (VB.NET would be at version 13, but I haven’t seen a published version number)

Best of all, you can see the development and you can participate in the ongoing language design discussions. The Roslyn compilers are Open Source. You can view them here. I’ll blog more about the compilers and the new and proposed language features in the coming months. 

And TypeScript, don’t forget TypeScript.

In more language news, TypeScript 1.0 has been released. It’s development has been public and Open Source for some time.  It’s integrated into Visual Studio 2013 Update 2, which is available in Release Candidate form.I’ve been working with TypeScript for a while, and I’ll be covering it more here. In particular, this discussion on the null propagating operator is very lively.

In addition, there’s now the new .NET Foundation, which is the curator of several .NET related Open Source projects. You can see a number of .NET libraries and components in the foundation already, and I only expect that trend to continue. The .NET Foundation is a great example of how Microsoft is changing. Look at the current board members of the .NET Foundation. The board already includes prominent community members that do not work for Microsoft. I expect that to continue and grow as time goes on.

Both Roslyn compilers, and TypeScript are already part of the .NET Foundation assets.

Visual Studio Online

The Humanitarian Toolbox has been using the preview versions of Visual Studio. It’s a tremendous step forward for team collaboration in the cloud. The tools help you can more information about your application, and Applications Insights provides a nice extra. Quick edits in the cloud, automatic deployments, insights, and more. Oh, and it’s integrated with your local Visual Studio experience.

Azure Updates

This probably deserves several blog posts on its own. It’s a full time job just to keep up with all the new tools released by the Azure team. There’s a new management portal. New mobile services, new resource management,  Java VMs in Anzure, and more.

I need to dive in more, because it’s hard to keep up with what Guthrie’s team produces.

 

Windows 8.1 update

Most of these news features are for end users, not developers. They do represent a lot of feedback and represent a good direction. For Enterprise developers there are a couple great features. The enterprise side loading story is much better. Modern apps are much more economical for enterprises to deploy than with previous 8.x platforms. The IE Enterprise mode will also help enterprise deal with legacy web-based applications. However, I would still recommend that most enterprises consider any application that needs enterprise mode to be a technology risk.

Universal Apps, and all it comes with

Microsoft has been talking about unifying the Windows Phone, Windows 8 and Windows Server platforms for some time. That’s now gotten even more ambitious. Universal apps also can include iOS and Android devices, using the Xamarin tools. The idea that a common API set could be available across Windows 8, Windows Phone, iPhone, iPad, Android phones and Android Tablets is really innovative.  Also, these projects work across different IDEs: Visual Studio, Xamarin Studio, and (where someone has written the plug ins) Eclipse.

It means C# is, along with JavaScript, the one language you can use to develop applications across all the popular computing platforms today. .NET and C# is truly a cross-platform development environment.

There’s more changes that make this cross-device story compelling. There are changes in the Microsoft Store that make it easier and more advantageous to produce apps for both Windows 8 and Windows Phone. You’ll get more visibility across the stores, and you’ll get more touch points with your potential customers.

Windows Phone and Cortana

I’m impressed with the potential of Cortana. You’ll see lots of people saying that Cortana is “Siri for WIndows Phone”. That’s an oversimplification. Yes, you can talk to Cortana and it will answer you. But what’s really interesting over time is how Cortana integrates with you through your applications on your phone. Voice recognition and voice interaction is a great step. More interesting is how those capabilities will work across applications when integrated with Cortana. Can my scrum app alert me if I’m too aggressive on deadlines because of other commitments? Could a nutrition app integrate across a fitness app to change calorie allocations because of upcoming events, or days off? There’s a lot of potential. There’s also risk. Can those cross-application capabilities be added while respecting users’ privacy?  There’s a lot of potential hear, and I can’t wait to learn more and dive in to create new, useful applications.

Conclusion: Microsoft is reaching out to developers in a big way

I know this post had less detailed technical content than my typical post. There’s a lot of information that came from //build. I’ll drill into many of the areas for some time.

The big picture of all the announcements and the reveals at //build is this: Microsoft is reaching out to developers again. And not just the developers that have traditionally worked within the Microsoft space. They are reaching out to Open Source developers, mobile developers that concentrate on non-Microsoft platforms, and more. It’s a smart move. They brought out lots of technology that makes lots of sense.

The platform, the languages, and the tools, are first rate. I’m glad to see Microsoft reaching out to developers and changing their direction to match today’s developer community.

Created: 3/3/2014 3:21:46 PM

I’m excited to be speaking at DevIntersection in Orlando next month. I’ve got three different talks at this conference.

One for the current wave of tools you already have:

Navigating large codebases using Visual Studio 2013

Visual Studio 2013 adds many new features that can help you learn and explore large codebases. That's important now because more of our time is spent integrating open source libraries and working on long-lived and large codebases. In this session, we'll explore a popular Open Source library using these new features. You'll learn techniques that will take you from confused n00b to experienced ninja in less time than ever before.

There’s one for the wave of technology that’s being released:

Getting Started with Visual Studio Online

The Visual Studio Online services provides a single point for managing source, project data, team collaboration, and deployment information about your project. This session provides an overview of how you can use these tools to manage personal projects with the same tools and processes you use for your professional work. Best of all, it's at a much lower price than many competitive tools.

And, there’s one that’s more forward looking:


An Introduction to the Roslyn APIs

The next version of C# and VB will be built on Roslyn, a new set of APIs that you can use to explore and modify the code in your applications. In this session, you'll learn about the Roslyn architecture and what you can do with Roslyn extensions. You'll learn the basics of a new world where you can explore and modify your code programmatically.

Overall, there are more than 200 great sessions from the industry leaders and experts you’ve come to rely on.

In addition to the regular sessions, there are pre-conference and post-conference workshops you can attend.  And, if you include at least one workshop in your registration, you get your choice of a free Surface 2, or XBOX ONE.

Wagner

Created: 2/26/2014 4:12:27 PM

And, it’s really an improvement.

If you spend much time working with the .NET Framework, and you really want to know how the framework libraries do what they do, you probably spent some time with the reference source browser. The more time went on, the more you hated that experience. The site was quite dated, the source was out of date, and the experience was so last decade.

Most of us spent our time with some decompiler disassembling the libraries that were delivered to your machine.

Well, there’s now a much better experience again. The .NET Framework team has a released a new look for the reference source browser. It’s a *huge* improvement over the previous version. It’s easier to navigate. The browsing, searching, and navigation features are all improved. Since getting access to this tool, I’ve spent much less time in decompiler tools. This experience is just great.

You can learn more about the new reference source browser from this blog post, and this Channel 9 video.

To get the most out of this new experience, you should also install Ref12, an extension that redirects the F12 key to the reference source for symbols defined in the .NET Framework. Hat tip to Schabse Laks for this extension.

Addendum:  There is still some controversy over the license of the reference source for the .NET framework. I’m not a lawyer, and I don’t understand all the issues involved. However, I have read the updated license, and it is getting more open. That’s not to say perfect, but it is more open.

Created: 2/19/2014 7:19:40 PM

I spoke last night at the new Chicago .NET Users group.  It’s a great, and growing group. I had a great time. (confession: I love Chicago, so I always look for reasons to go there.) Aaron has a great group started.  They are a very knowledgeable bunch. 

I spoke on async coding practices in C#, specifically the Task Asynchronous Programming (TAP) model. That can be a complicated topic, and everyone followed the discussion quite well.

Here are several of the resources I mentioned during the talk:

The Github repository for my samples. Each branch represents on step of the demo. The tip of the master branch is the finished sample.

Pearson recently published my LiveLesson series on Async programming fundamentals.  That goes into more depth on the async practices than I had time to cover last night.

Jon Skeet and I did a lengthy session at CodeMash 2012 where we discussed both how to use async, and what the compiler does to your code when you create async methods.  InfoQ has those sessions online.

I had a few great questions about using async methods at the server. Due to time, I gave brief answers.  For more depth, I recommended Stephen Cleary’s talk from CodeMash 2014.

Thanks again for a great group, and the folks at DevMynd for hosting. I had a great time, and I’m happy to come back again.

Tags: C#
Created: 2/11/2014 10:02:07 PM

I recently received an email with a set of questions about how to construct code that manipulates strings. I’m paraphrasing, but the question boiled down to whether I recommended always using StringBuilder to construct strings, or whether should be avoided except when building a string from multiple objects in a loop.

The answer, as it usually is in performance related questions, is “it depends”. Anytime you are making code changes when your intent is increasing performance, you need to measure your application both before and after the change. A lot of non-local program characteristics affect performance.

That said, there are some general guidelines that can help you make a good first choice.

Minimize Garbage

The goal you’re trying to achieve is usually to minimize the amount of garbage that gets created. Strings are immutable, so every time to make a new assignment to a string, you’re manipulating the reference object, and the string that was being referred to is now garbage.

var str1 = "foo"; 
str1 = "bar"; // the string "foo" is now garbage.

The snippet above creates one object that becomes garbage in that same snippet. One item of garbage is not big issue. However, if this snippet is on an often called branch of code, it will add up quickly.

However, assignment in and of itself string does not necessarily create garbage. Consider this code:

var str2 = "foo";
var str1 = str2;
str2 = "bar";  // No extra garbage str1 and str2 point to two different objects

I wouldn’t use this as an example of great coding style. The code creates two different strings, each pointed to by one reference. There’s an assignment, but this snippet does not create garbage.  What happens to the strings created depends on code outside of the snippet above.

Enter StringBuilder

Because strings are immutable, and programmers want to manipulate strings, the .NET Base Class Library includes the StringBuilder class. The string builder class enables you to modify a string like object and then retrieve the immutable string once you’ve created the final version.

Nerd note: The string.Format() methods use a StringBuilder internally. If you are arguing over the relative performance of string.Format() and StringBuilder, please stop.

In general, for simple formatting operations that can be done in one statement, my preference is for string.Format. It’s simpler to read, and it returns the final immutable string after creating it using a StringBuilder.

For more complicated code that builds a string, I’ll use a StringBuilder.

So should you ever use string.Concat?

It’s very rare that I say a certain method should never be used. The BCL team members (and every other developer I know) has enough work to do without writing methods that should never be called. I will use string.Concat when none of  the string objects being concatenate are being discarded. Consider this:

var FullName = person.FirstName + person.LastName;

The person object does not become garbage immediately. string.Concat uses some internal classes to avoid creating temporary objects, so you don’t create temporary objects.

Remember: If you’re not measuring, it’s not engineering

These are, at best, general guidelines. If you are making any changes where the goal is to increase performance, measure before and after the change. Make sure that any changes you make actually do positively impact performance.

Most importantly, make sure you’re optimizing code that is executed often enough that your changes have a real impact to your users.

Created: 1/22/2014 7:20:35 PM

Today, I’m formally launching my new venture to help companies grow and retain software talent. I’ve spent the last 15 years growing the talent pool at SRT Solutions, the firm I sold last August. I know first hand the challenge of hiring and retaining software developers. I also know the investment needed to grow talent, and ensure that developers always have the skills that are needed for modern application development.

The classes I’ve developed are on the same topics where I mentored the great developers at SRT Solutions: C#, LINQ, ASP.NET web development, and Lean Development Practices. The material leverages successful talks and seminars I’ve given at national and international conferences. And, of course, some of the material comes from my Effective C# books. You can see the full list, and the current course catalog here.

I’m limiting the class size to 20 people so that I can spend enough time with each attendee throughout the course. I’m also teaching all the courses myself. I’m not licensing the material to others, or hiring other instructors. Every class will be taught by me personally.

If your organization could benefit, please let me know.

Current Projects

I create content for .NET Core. My work appears in the .NET Core documentation site. I'm primarily responsible for the section that will help you learn C#.

All of these projects are Open Source (using the Creative Commons license for content, and the MIT license for code). If you would like to contribute, visit our GitHub Repository. Or, if you have questions, comments, or ideas for improvement, please create an issue for us.

I'm also the president of Humanitarian Toolbox. We build Open Source software that supports Humanitarian Disaster Relief efforts. We'd appreciate any help you can give to our projects. Look at our GitHub home page to see a list of our current projects. See what interests you, and dive in.

Or, if you have a group of volunteers, talk to us about hosting a codeathon event.