Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have just been reading through some of the white papers & examples from Micros

ID: 642032 • Letter: I

Question

I have just been reading through some of the white papers & examples from Microsoft "Roslyn" and the concept seems very interesting. From what I can tell, it opens up the black box that is the compiler and provides an interface that we can use to get information and metrics about code written in Visual Studio.

Roslyn also appears to have the ability to "script" code and compile/execute it on the fly (similar to the CodeDom) but I have only come across limited uses for that type of functionality in my experience.

Whilst the code analysis & metrics element is an interesting space...it is something that has been around for a very long time and there are numerous providers that have already invested a lot of money into code analysis & refactoring tools (e.g. ReSharper, CodeRush, nCover, etc) and they do a pretty good job of it!

Why would any company go out of their way to implement something that can be provided at a fraction of a cost through buying a license for one of the existing tools?

Maybe I have missed some key functionality of the Roslyn project that places it outside the domain of the mentioned tools...

Explanation / Answer

Roslyn also appears to have the ability to "script" code and compile/execute it on the fly (similar to the CodeDom) but I have only come across limited uses for that type of functionality in my experience.

On-the-fly compilation and execution is the key benefit of Roslyn. I think you may be undervaluing the benefit of this feature because you have never come across a use case in your experience where it really shines. And this makes sense; the need for dynamic compilation is probably a niche feature, but having it does provide for some powerful applications that would be much more difficult without it.

Here are a couple examples off the top of my head where dynamic compilation would be quite useful. There are other ways to accomplish all of these things, but Roslyn makes them easier.

Having plugin files that are loaded at runtime, compiled, and included in the execution of the "parent" application.
Creating a DSL which is then translated to C# at runtime and compiled using Roslyn.
Creating an programmer-oriented application which takes C#, analyzes it, translates it, etc.
Comparing two chunks of code for their differences after compilation, as opposed to just "surface" differences such as whitespace. This is known as Semantic Diff.
So, to sum up, you may never find a use for Roslyn, depending on what software you spend your time writing. However, there are plenty of use cases where Roslyn brings a lot to the table. None of the tools you mention provide this feature. Nor could they based on their architecture and purpose.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote