Play by Play: C# Q&A with Scott Allen and Jon Skeet
Written by Nikos Vaggalis   
Monday, 11 April 2016

Play by Play is Pluralsight format in which celebrity programmers are asked to work on a randomly assigned task, giving the audience a rare opportunity to observe how they work and the way they think towards reaching a solution. This one features Jon Skeet and Scott Allen.


 

For this already well established series of courses, the producers envision the attendee as filling a chair next to their programmer heroes, like colleagues do, watching them perform their magic unrehearsed and at natural speed, thus enjoying an informal view into the work-flow and work process of an expert.

In this recent addition, Rob Conery, co-founder of Tekpub, brought together Jon Skeet, author of the C# in Depth series, and Scott Allen, author or co-author of several books on Microsoft technologies. In something of a departure from the usual task-oriented format this session, lasting 1hr 15 minutes, is a Q&A on .NET, and C# in particular.

The two participants were handed carefully picked Stackoverflow questions ahead of the session so they could process them independently and  in their own time and then present their solutions and walkthroughs at this get-together filmed at NDC{London} 2016.

 

 

This format might give the impression of a Jon Skeet vs Scot Allen match but in reality it is more like Jon Skeet and Scot Allen complementing each other.

The first of the five questions was on Dynamic LINQ and ordering the results of the query in a dynamic manner:

I found an example in the VS2008 Examples for Dynamic LINQ that allows you to use a sql-like string (e.g. OrderBy("Name, Age DESC")) for ordering. Unfortunately, the method included only works on IQueryable<T>;. Is there any way to get this functionality on IEnumerable<T>?

With LINQ you enjoy type-safe queries and thus compile-time checking while with DLINQ you can construct queries dynamically on the fly by passing mere strings instead of lambda expressions, into the library's extension methods. 

The problem is that DLINQ works on IQueryables and the  collection in question was of type IEnuremable. Scott and Jon presented their solutions which surprisingly were on the same track: turn the IEnumerable collection into an AsQueryable one. They followed up with the reasoning behind it as well as providing insights like: 

"IEnumerable<T> works on your local machine and not on the server fetching the results back as you go"

 
The next topic String Formats with Integer Variables had the sub-theme Code as Code vs Code as Data in which Jon Skeet lashes out at people not understanding the distinction between data interpreted as code and code interpreted as data because that ignorance is what still makes SQL injection attacks a reality. He continues by suggesting that in situations that when this interpretation is not clear it's better to emit an error than letting it evolve into something  bad, hence the importance of  exception handling. Reminded by Rob Conery that there are dynamic languages like Ruby that swallow errors so you need to "have good tests", Skeet in sarcastic mood adds "or a compiler", bringing laughter to the panel! Not wanting to pursue the bashing of the dynamic languages any further, he put and end to it with "I'll just stop there". Programmers' humour!  

Scott then demonstrated the concept with an example featuring Func delegates which he would convert to Expression trees and vice versa.

The String Formats with Integer Variables question was fun and proved quite a task for C#, something that could rephrase the question into:

"What does it take in C# to pad an integer with a variable number of zeros that are entered at runtime?"

Pretty easy for a dynamic language like Perl :

my $pad='7';
print sprintf("%0${pad}d",1234);

but a burden for a static language like C# where you have to resort to formatting the formatting string!

Payback time, on behalf of everything dynamic!

 

The section on Automated properties evolved into a long talk on compiler magic and how it enables new features to be built into the language but at the same time confuse when they're just syntactic sugar over established functionality, as the poster of this question found:

"Why can you assign a value to an automated property when it is just read only (there's only a getter)?"

The fun part is that since the presentation is uncut and unrehearsed you get to watch amusing scenes like Jon trying to locate the place of a compile time error occurring, something that reminds us that he is human after all!

Lambda Expression Property Names explores Unary vs Member expressions and indicates where C# 6 simplifies code. The final section Binary Compatibility, discusses how to go about versioning, revolving around inheritance, interfaces and related topics. It also exposing gotchas such as how overriding a method could potentially break library compatibility.

Overall, Pluralsight's Play by Play format came up to expectations. Watching three experts having a relaxed and informal chat where they solve problems and expose their workflow, provides both entertainment and learning opportunities. I would mark its highlights as minute 9.40 on the Lambda talk and 7:30 on binary compatibility.

pbypheadsq

The most recent Play by Play is Angular with Typescript (Beginner level) with John Papa and Christopher Martin.

Browsing around the platform you can observe other prominent names in Play by Play sessions, including:

  • AngularJS Application Design with Scott Allen and Dan Wahlin

  • Ethical Hacking with Troy Hunt

  • Learning AngularJS with Ken Cenerelli and John Papa

  • SQL Server Administration with Pinal Dave

CodeSchool's subscribers can currently sign up and try the platform free for 30 days. Or you can try out all Pluralsight's content with a 10-day free trial, but you have to provide your billing information up-front.

 

More Information

Play by Play: C# Q&A with Scott Allen and Jon Skeet

Related Articles

C# Guru - An Interview With Eric Lippert

C# in Depth, 3rd Ed book review

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter,subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin

 

Banner


ACM Adopts Open Access Publishing Model
05/04/2024

ACM, the Association for Computing Machinery, the professional body for computer scientists, has relaunched Communications of the ACM, the organization’s flagship magazine, as a web-first  [ ... ]



Udacity's New Discovering Ethical AI Course
12/04/2024

Udacity has just launched an hour-long course on Ethical AI. Intended for a wide audience across many industries, it introduces to basic concepts and terms needed to step into the world of Ethica [ ... ]


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 11 April 2016 )