In this guest post, Josh and Amadeus the co-founders of Code Connect, an Ontario based technology startup share their reasons for and experience of creating an extension for Visual Studio and the new Roslyn complier. Josh, a passionate programmer, loves to build developer tools and explore how they can be used to improve the software we write. Amadeus has his eye on design and is passionate about user interfaces that increase developer productivity.
“A lot has been said on about Roslyn and the changes coming to to C# 6.0. However, less has been said on how Roslyn will empower everyday developers to build extensions for Visual Studio. At Code Connect, my co-founder Amadeus and I have been using Roslyn extensively for two years.
We first started talking about Code Connect in the summer of 2012, after hearing about Code Bubbles and Light Table. Both of these projects proposed radical changes to the way we develop software. Instead of working with software on a file-by-file basis, they proposed that software should be explored and read on a function-by-function basis.
This approach really resonated with us. After all, software isn’t read from top to bottom. Programmers have to jump between lines and across files as they trace out how the computer will execute their software. In many ways, reading software is comparable to reading one of those "Choose-Your-Own-Adventure" novels. Often times, programmers resort to using a pen-and-paper approach to map out how the computer will execute their software.
Unfortunately, Code Bubbles never made it to market and Light Table dropped this feature. We realized that the only way we were going to be able to use a tool like this, would be to build it ourselves.
We began trying to write software to visualize the relationships between methods and called this project Code Connect. Unfortunately, we quickly ran into a number of difficult problems. Overload resolution and working with generics proved too difficult for any ad-hoc approach we devised. We soon realized that if we wanted to build this tool, we’d need to write our own C# compiler. For two undergraduate students, this was a disappointing and daunting realization. We began to weigh the possibility that building Code Connect would be impossible.
That’s when we stumbled across the September 2012 release of Microsoft’s Roslyn project. Roslyn is the internal name for the new C# and VB .NET compilers. Roslyn is more than a rewrite of the C# and VB .NET compilers; it represents a huge shift in the way we think about and work with compilers.
Traditionally, compilers have taken source code as input, compiled it, and produced assembly, IL or bytecode as output. The Roslyn team calls this “black box compilation” and it’s been the status quo in compilers for decades. Roslyn rejects this approach and provides an API for developers to interact with the internals of the compiler.
For the authors of Visual Studio extensions, this is huge. The creators of extensions like ReSharper and CodeRush had to write their own compilers in order to understand your source code.
This was obviously prohibitively time-consuming for the average developer, and most people stayed away from writing Visual Studio extensions entirely. For the first time, everyday programmers can write programs to interpret and interact with C# and VB .NET source code.
The release of the Roslyn CTP in September of 2012 could not have been better timed. We incorporated Roslyn into our project and resumed work. Roslyn’s semantic API let us build and visualize connections between methods. It allowed us to answer difficult questions about overload resolution and generic methods with ease.
We continued working on Code Connect and presented our prototype at the University of Waterloo’s Engineering Design symposium where we won first place. We’ve continued working on Code Connect and have released an alpha version available for free in the Visual Studio Gallery. It’s currently available for Visual Studio 2013 and the Visual Studio “14” CTP.
Today, any developer can create tools that understand and manipulate software. We can create tools to visualize software, tools to rewrite software and tools that help us better understand the systems we create. This is important to the work of every developer, because the tools we use act as productivity multipliers. They help us write better software, in less time.
Roslyn has democratized the creation of developer tools. And I think that’s something we can all get excited about.”
Thinking about Visual Studio for your next project? Then check out Visual Studio Community 2013 the recently announce version that is fully loaded and completely FREE. This version is also completely extensible, which mean you will be able to choose from thousands of extensions for Visual Studio, or create your own like Josh and Amadeus have done. So grab a copy and start coding the app of your dreams for Windows, Android, and iOS