by devillighter · 9y ago · 0 comments
// if we don't have frequencies, use the default (this should never happen, but here it is)
if (tblFreq == null || tblFreq.Rows.Count == 0)
{
a = (float)0.02;
b = (float)0.02;
}
is kind of fishy. Why not bomb out instead of failing silently for things that are never supposed to happen? Not saying this is inherently wrong - I'm certainly not capable of actually understanding the details of the analysisBonus points for not using the shorthand float literal syntax.
I would expect to see this many goofs only from someone that's been using C# for a month or so. I only used it for a couple years
I'm making assumptions based on experience with C# codebases and I think my argument on double vs float is solid. I don't think I've ever seen floats used in a production C# codebase because there's no point.
Overboard maybe :) but I still think whoever wrote that is very inexperienced.
https://github.com/propublica/nyc-dna-software/blob/master/F...
1. Knows how to use "using" but doesn't use it for myConnection.
2. myConnection.CreateCommand would be more idiomatic than new SqlCommand ... cmd.Connection = myConnection;
3. Doesn't know how to use "using"! using (DataTable myDt ... then goes on to "return myDT"
4. Also just noticed the oddity of myAdapter.SelectCommand = cmd although cmd is immediately disposed after that, then Fill is called later.
That's one function although the rest seem to repeat similar sins (CTRL+C, CTRL+V).