« first day (4435 days earlier)      last day (496 days later) » 

mr5
4:36 AM
@Wietlol educate me. What's the difference between coverage metrics and complexity metrics tool for unit testing?
Iirc, you mentioned this before that's why I asked you
 
mr5
5:09 AM
I guess coverage is referring to the entire code base, whereas complexity is limited to the unit being tested?
 
mr5
5:41 AM
"This process would loop continuously until the token have expired"
is it have or have been or had or has?
 
 
1 hour later…
7:11 AM
@mr5 Coverage: how much of the code is checked by the tests. Say you have if (something) { /* do thing 1 */}; else {/* do thing 2 */} if your something is only evaluated as true during the tests, then you only test "do thing 1" but never "do thing 2". Thus your code coverage is roughly 50% for this example (assuming thing 1 and 2 are of about equal length).
Complexity: how hard it seems like code is for understanding. It's usually expressed as a number: 2 or 12 or 70. The lower the better. There are many ways to calculate complexity which will give you slightly different results. However, most of the time 1-10 is OK and above is an indication that you may need to look into refactoring. And, say, 40 or above is bad.
The metric is sometimes wrong. However, it's very often a good indicator to at least consider refactoring.
And to pull the curtain off a bit - complexity is usually calculated based on the number of branches possible in the code. A code with a lot of conditionals will be more complex to understand. Depending on the complexity formula, length of code might also be taken into account, so even a method with a couple of if statements might rank higher when it has over 100 lines of code in it.
There are also complexity metrics for classes that might count number of methods but I find those more unreliable. Complexity is usually for one function/method.
@mr5 IMO, sounds better as "This process would loop continuously until the token expires"
But if you want to use a version of "have", then "has expired" is probably correct.
 
8:14 AM
Complexity: not accurate...
 
8:25 AM
I'd not put my life on that measure. However, it is still decent at detecting potential issues. Do take it with a grain of salt, of course.
It's at least easy to verify - look at number. Is the number high? If yes - look at the method/function. Can you at a glance understand what it's about?
That's it, you're done.
I can already spend 5 seconds and tell whether something needs to be refactored. The metric is just there so I don't have to spend 5 seconds for each and every method in the code base.
Weeds out low hanging fruits. It's good at that. The higher complexity things tend to be easy to classify. If it takes more than 5-10 seconds to consider a method, then that's the extreme minority of cases, in my experience. Yes, they do show up and some times you need to go in and do a deeper analysis to figure out if this can even be simplified or should it. But for the most part "low number - good, high number - bad" holds.
 
8:48 AM
> Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and understand.
there are also multiple complexity metrics
cognitive and cyclomatic are the most common ones
 
Well cognitive uses cyclomatic with most implementations I've seen. But yeah, forgot about pure cyclomatic complexity.
That's just the number of paths in the code. It's a factor in how easy code is to understand.
 
 
1 hour later…
10:20 AM
Hi All, say if I am building a new CLI, what are the advantages of using ILogger over console.log to log outputs?
 
10:41 AM
ILogger is integrated with more stuff than just your code
ILogger has certain formatting and additional information
ILogger allows you to log to other places easily, doesnt tightly couple to the CLI
generally speaking, I wouldnt primarily use Console.WriteLine() for logging purposes
in a CLI application, use Console.WriteLine() for user interaction
for example, asking the user to do stuff
or responding to the user's actions
 
thanks @Wietlol
 
10:58 AM
Hello Guys
 
11:42 AM
Hi
 
12:18 PM
 
 
1 hour later…
1:43 PM
Howdy
 
 
2 hours later…
3:15 PM
Des Darilek on December 07, 2022
Announcing the latest addition to Collectives.
 
 
2 hours later…
5:02 PM
posted on December 07, 2022 by ericlippert

Introducing Beanstalk Last time I introduced Bean Machine Graph, a second implementation of the PPL team’s Bayesian inference algorithm. We can compare and contrast the two implementations: In short, the BMG user experience is comparatively not a great experience for … Continue reading →

 
 
2 hours later…
7:10 PM
 

« first day (4435 days earlier)      last day (496 days later) »