Click here to Skip to main content
14,455,745 members

Welcome to the Lounge


For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

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.
GeneralRe: Code analysis sucks Pin
BryanFazekas24-Oct-19 1:41
MemberBryanFazekas24-Oct-19 1:41 
GeneralRe: Code analysis sucks Pin
#realJSOP24-Oct-19 1:58
mva#realJSOP24-Oct-19 1:58 
GeneralRe: Code analysis sucks Pin
johannesnestler24-Oct-19 2:23
Memberjohannesnestler24-Oct-19 2:23 
GeneralRe: Code analysis sucks Pin
Dean Roddey24-Oct-19 7:26
MemberDean Roddey24-Oct-19 7:26 
GeneralPerhaps ... Re: Code analysis sucks Pin
Davie2124024-Oct-19 5:38
MemberDavie2124024-Oct-19 5:38 
GeneralRe: Perhaps ... Re: Code analysis sucks Pin
Dean Roddey24-Oct-19 7:24
MemberDean Roddey24-Oct-19 7:24 
GeneralRe: Perhaps ... Re: Code analysis sucks Pin
Davie2124024-Oct-19 8:26
MemberDavie2124024-Oct-19 8:26 
GeneralRe: Code analysis sucks Pin
Steve Naidamast24-Oct-19 8:36
professionalSteve Naidamast24-Oct-19 8:36 
I never use any form of code analysis tool, though I have tried a few in the past. Such tools, as you pointed out, merely throw up a voluminous amount of errors and warnings, most of which are meaningless. And I have never found such an issue that I would rewrite my code in such a fashion.

I have been coding for nearly 5 decades and if by that time you have not developed a clean, efficient style of development, you are not going to. And a code analysis tool will not help you much.

What code analysis tools find are those issues applied against the set of paradigms a the vendor of a particular tool want you to follow. Such paradigms are neither correct or incorrect. If you want to follow them that is perfectly fine.

However, most developers do their work from a very personal standpoint and take pride in their work from such a position. As a result, such development will often find the issues that you found with Visual Studio's Code Analyzer tool.

And again, mist such issues are meaningless.

There are some exceptions to this however where such tools demonstrate the more efficient method of developing your logic. However, a lot of this is all relative. For example, I still use ArrayLists quite heavily in my code. Why would I do this when it is already known that List<t> collections are more efficient as the following description from StackOverflow demonstrates?

Yes, pretty much. List<t> is a generic class. It supports storing values of a specific type without casting to or from object (which would have incurred boxing/unboxing overhead when T is a value type in the ArrayList case). ArrayList simply stores object references. As a generic collection, List<t> implements the generic IEnumerable<t> interface and can be used easily in LINQ (without requiring any Cast or OfType call).

ArrayList belongs to the days that C# didn't have generics. It's deprecated in favor of List<t>. You shouldn't use ArrayList in new code that targets .NET >= 2.0 unless you have to interface with an old API that uses it.


Because whether you use an ArrayList or a List<t> is one, a personal preference, and two only efficient in the amount of data being processed. So for example, if I use an ArrayList to process 50 stored structures in a for-each loop, do you really think that by using a List<t> collection it will make such a process more efficient to the end user? Highly unlikely, since all such processes are done in milliseconds and people who insist that others follow the List<t> protocol when there is no need to are merely wasting everyone's time.

Of course, if you plan to process several thousand objects in such a loop than the use of the List<t> collection makes a
lot more sense.

But for me, the amount of data I process in an ArrayList is just as efficient as if I had used a List<t> collection type.

And finally, all of my code can be read and understood by a person less experienced than I than if I had coded it with modern or current standards that have added levels of such obscurity as to make most such such code rather arcane in my view.

Given this, then using a code analyzer serves its purpose if you are intent on developing using current paradigm approaches to your development. And in most such tools, you can turn off a lot of the rules they go by. However, this can be a lot of work and almost to the point of not making it worth the effort. And trying to enter the rules listing in Visual Studio 2019 to review the number of settings that should be able to modified appears to keep crashing the IDE.
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.

GeneralRe: Code analysis sucks Pin
Dean Roddey24-Oct-19 16:54
MemberDean Roddey24-Oct-19 16:54 
QuestionHow do you know when the TOTD is a Dad joke? Pin
littleGreenDude23-Oct-19 7:56
MemberlittleGreenDude23-Oct-19 7:56 
GeneralThought of the Day Pin
OriginalGriff23-Oct-19 5:51
communityengineerOriginalGriff23-Oct-19 5:51 
GeneralRe: Thought of the Day Pin
musefan23-Oct-19 6:02
Membermusefan23-Oct-19 6:02 
GeneralRe: Thought of the Day Pin
Johnny J.23-Oct-19 7:37
professionalJohnny J.23-Oct-19 7:37 
GeneralRe: Thought of the Day Pin
musefan23-Oct-19 22:10
Membermusefan23-Oct-19 22:10 
GeneralRe: Thought of the Day Pin
jeron123-Oct-19 6:18
Memberjeron123-Oct-19 6:18 
GeneralRe: Thought of the Day Pin
Daniel Pfeffer23-Oct-19 6:55
professionalDaniel Pfeffer23-Oct-19 6:55 
GeneralRe: Thought of the Day Pin
Daniel Pfeffer23-Oct-19 6:58
professionalDaniel Pfeffer23-Oct-19 6:58 
GeneralRe: Thought of the Day Pin
W Balboos23-Oct-19 7:41
mveW Balboos23-Oct-19 7:41 
GeneralRe: Thought of the Day Pin
MKJCP24-Oct-19 3:10
MemberMKJCP24-Oct-19 3:10 
GeneralIt's weird when... Pin
Marc Clifton23-Oct-19 3:40
communityengineerMarc Clifton23-Oct-19 3:40 
GeneralRe: It's weird when... Pin
CodeWraith23-Oct-19 3:51
MemberCodeWraith23-Oct-19 3:51 
GeneralRe: It's weird when... Pin
PeejayAdams23-Oct-19 4:13
MemberPeejayAdams23-Oct-19 4:13 
GeneralRe: It's weird when... Pin
CPallini23-Oct-19 4:19
mveCPallini23-Oct-19 4:19 
GeneralRe: It's weird when... Pin
Mike Hankey23-Oct-19 4:24
professionalMike Hankey23-Oct-19 4:24 
JokeRe: It's weird when... Pin
Daniel Pfeffer23-Oct-19 5:08
professionalDaniel Pfeffer23-Oct-19 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.