The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
At its core, Microsoft is a company that makes its money the old fashioned way: by creating products of value that people willingly part with their money to use. They stand as a bulwark against the data mongering and user exploitation that Google and Facebook see as the future of humanity.
Never really thought much about it, but very true.
A Fine is a Tax for doing something wrong
A Tax is a Fine for doing something good.
Reading this, I wondered what the author was smoking:
This brings us to the present epoch under Satya Nadella who, against the odds, has revived the company’s mojo and returned it to prominence. He has accomplished this by abandoning the strategies of both his forebears. Microsoft is no longer a technology-forward or a sales-forward company.
Reading this, I know what the author is smoking:
He warns Microsoft away from its “fixed mindset” and has hired a revolving door of consultants and evangelists (including a three-year stint as cultural attaché by yours truly) to help transition the company into a “growth mindset.”
While the author hears echoes of "ka-ching, ka ching," I hear the ghosts of Nokia, SilverLight, Modern UI, Clippy, WPF, the mutilated Skype, Vista, and other titanic debacles, laughing; why are they laughing ? Because they find the screams of developers throw under the bus hilarious
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
So, since code analysis is included in Visual Studio these days, I figured I'd give it a try. It kicks out endless errors and warngings, every single one of which so far is either wrong or I would have to write far worse code just to make it understandable to the analysis tool in order to make it shut up.
The biggest single one so far is that it doesn't recognize that I'm doing a null check or some other check and calling a method that will throw the right exception or that I'm using an assert. I'm not template crazy like most folks these days, but my collections and various other things are templated. I try to keep as much code out of line as possible, and things like throwing exceptions are one of those. But that means it complains about every single place where that happens because it doesn't understand I'm dealing with the problem already.
Given that this already causes many hundreds of issues in headers that will be seen basically everywhere directly or indirectly, and I'm not about to hack my code up with hundreds of suppressions before I even really get started, that pretty much makes it useless for me.
When you write code to work around lackings in the code analyzer, and make your code more complex and less readable just to make it shut up, that's really letting the tail wag the dog. As I understand it, this is hardly specific to the VS analyzer either.
I was also disappointed with it. It did find a few things, but I had to disable various errors and warnings just to find them amongst all its drool. It was a while ago that I used it, but I seem to recall that it was obsessed with using smart pointers and tagging functions noexcept. I think it's a plug-in that Microsoft took from a third party. In any case, I'd already written one[^], though it only understands the subset of C++ that I use.
And, even worse, if you are writing a large, multi-platform system, where different compilers/tools are going to be used, and they will all have their own error/warning codes, it will just be a mess. Creating a macro to hide the suppression mechanism won't help with the error codes.
I guess you could say that only one platform will get code analysis but that doesn't seen practical.
multi-platform system, where different compilers/tools are going to be used
That's exactly the situation I'm in (building for Linux with gcc, Windows with MSVC 2017 - and thanks to WSL, I can do them both from the same session - yay for progress!). I'm using clang-tidy for static analysis and finding it pretty painless. I have it set to run every time I build for Linux build, with only warnings I'm interested in and it's OK. Combined with gcc sanitisers (turned on for debug builds and unit tests), I feel happier that my code's safer than it might otherwise be.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Well yes, but also no.
I'm now doing a VB.NET WinForms project.
I get naming conventions and that we should be using PascalCasing for methods.
But controls are still often named "btnSave" or "txtName", and the VS default for events is btnSave_Click.
ERROR! btnSave_Click is not according to conventions (then again, nothing in this project is).
Even if I named it SaveButton, VS still generates the _ and I'm not going to change that kind of generated code.
The original developer didn't care one bit about conventions and had code as follows (comments added here by me):
Dim SomeVar ' This is possible as Options Strict is Off, making it late bound/loosely typedDim _anothervar As Entities
Private yetanothervar AsInt32 = "0"' Again, option Strict is OffDim theListGoesOn AsInteger
I don't know how many rules this breaks and the lack of consistency is alarming (and I wish I was overdoing it here, but I don't).
The code analyzer did help me to clean things up though.
Another thing the analyzer doesn't get is that a shown form should NOT be disposed!
Doing so will immediately close the form, learned that the hard way some years back
So while I was able to resolve literally 100's of possible bugs and inconsistencies it also leaves me with 100's that I cannot or will not fix!
It's a double edged blade
I just did an analysis on a piece of WPF code I wrote recently (which runs fine, BTW), and it found two variables that weren't used (which I had already pragama'd around, and seven instances of CA2214 (Do not call overridable methods in constructors), which involved having forms derived from a base form class that implemented INotifyPropertyChanged. I'm not changing my code...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I have a big codebase and think CA helps a lot! If you don't like the default rules set - make your own or customize it. I normally would go for local supressions directly on the code in Question - but for your case a global supression could do (or in Project-Settings). I think it's not OK to say the CA "sucks" - if you have special needs customize it - you can, and it's not difficult.
Last Visit: 16-Feb-20 14:44 Last Update: 16-Feb-20 14:44