Analysing C# code on GitHub with BigQuery
mattwarren.org
mattwarren.org
It's awesome that C# 8 will address the number 1 problem, with non nullable references but number 2 won't be addressed until records post C# 8 by the looks of things and number 5 not until exhaustive pattern matching which doesn't look to be on the cards at all AFAIK.
[0] https://docs.microsoft.com/en-us/dotnet/framework/debug-trac...
[1] https://www.microsoft.com/en-us/research/project/pex-and-mol...
Similarly, it's staggering the number of times I've seen someone wrap their entire method (or worse yet their entire program) in empty try-catch blocks just to avoid responsibly handling null and out of range exceptions. To me, it seems like the ubiquity of this antipattern indicates that there's something inadequate about the language, tooling, or developer culture. Or some combination thereof.
I'm not enough of an expert to say what the problem is or how to fix it, but in my relatively limited experience I've found requiring data contracts up front smooths over a lot of the pain points. But it comes at a cost. I've never used an equivalent in any other language, so I don't how C# and .NET compare, but it does seem like a lot of boilerplate code that can limit decoupling if misapplied.
Putting it on it's own line seems like a waste of space to me and doesn't contribute to the readability.
accidentally, we arrived to the same code style for both C# and C++...
The only downside would be if I worked on someone else’s project with different standards. I don’t think VS can figure out autoformat at the project level, like, say, python mode in emacs.
By the way, after many years I had to change it for coding style reasons. Now when I look back to old code and I see that lonely `{` my reaction is "ewww", so I guess it is also a matter of habit.
Considering the large number of coding standards that mandate the placement on a new line, tossing out readability because it doesn't matter to you seems short sighted.
That said, some languages are impacted by style choice; e.g. JavaScript. Given many of us have to develop in multiple languages, it would be great to select a style supported by all languages (better would be if all languages supported all styles).
https://stackoverflow.com/questions/12233999/is-it-true-that...
Don't understand why we spend so much time arguing about such low stakes stuff as this.
I now realise the better test of 'var' would be to compare it to how many times it's not used. That is count the times that 'var myClass = new MyClass()' is used v 'MyClass myClass = new MyClass()'. But my regex skills aren't good enough for that and I'm not even sure if you can do it purely in a regex?
Also I imagine that 'var someNumber = 1' is used less that 'int someNumber = 1', but again, I'm not sure how to do the regex? I certainly only use 'var' when the same word is on both sides of the '=', so not in the case of int/double/decimal etc.
var i = 1; //int
var j = 1f; //float
var k = 1m; //decimal
var l = ""; //string
var m = ''; //char var integer = 1;
var long = 1l;
var float = 1f;
var double = 1d;
var decimal = 1m;
var unsignedInteger = 1u;
var unsignedLong = 1ul;Although I imagine a significant number of class declarations would contain no var or async/await simply because of their nature.
Using Linq was heavily frowned upon. It took quite a few years before it started to be accepted..
At one point we were also strongly encouraged to place a #region around every single method! I never understood why, and luckily that one did get dropped.
Shudder!!
Especially since VS has plugins (or maybe it's built-in?) that will let you fold/hide individual methods, if you really want to do that!
I can understand banning SQL style linq and allowing only functional style, but I guess that's more of a personal preference.
One of Kevlin Henney's talks references a really neat quote by Poul Anderson on this subject:
> I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated.
[1]: Well, at least directly enough for LINQ performance to be a problem.
Yes, all this was kicked around and argued about.
var x = 10;
int x = 10;
The code was generating some JSON using Linq and created JSON properties: new JsonObject(LinqExpressionHere)
The name for the property was defined as
$"SomePrefix_{x.Name}"
which he helpfully changed to
"SomePrefix_{x.Name}"
which then compiled, but crashed in the test environment because of - surprise - duplicate attributes..
Fortunately, most of the queries I've done are aggregations or looking for C# syntax, so there's only a few places non C# code could get in (I already filter out binary files, which I noticed earlier)
(I know under-the-hood it consists of some very impressive algorithms/hardware/programming etc, as explained in https://cloud.google.com/blog/big-data/2016/08/in-memory-que..., but it feels like magic!)
Top 100 Users on Hacker News by H-Index | https://news.ycombinator.com/item?id=11512455 (Apr 2016, 81 comments)
and other social media: https://github.com/antontarasenko/smq
> using System.Web.Mvc;
But... that is a System namespace.
I've just updated the post, 'log4net' makes in into the top 10 now.
Is the second most used 'using' that's non-Microsoft (after Nunit). Shows how important Unity is for C# take up. And presumably most people using Unity to write games are not going to be sticking their code on GitHub either so this must be a fraction of the real use.
c# just isn't favoured by hobbyists except for game-programming. But in business world (at least from my UK perspective) where nothing comes close to github, c# still seems as healthy as ever and that doesn't depend on unity at all.
However, I guess my lists are limited by what is on GitHub, Paint.NET springs to mind, but it's not open source.
Here in the UK C# seems a lot more popular than Java, but I must admt I'm getting more and more js jobs these days, which fills me with a slight dread for the future as I really dislike programming in it.
I think Unity has helped C# become more popular for the masses again.
We have customers running Linux instances just for Postgres.
If you're looking for a CMS, you'd be hard-pressed to find a better open-source CMS that runs on ASP.NET than Umbraco.