Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ultrafilter
Aug 23, 2007

It's okay if you have any questions.


cheetah7071 posted:

The most horrifying part of that is calling a proportion a percentage

I'm not seeing the problem with that. Interpreting proportions as probabilities can be an issue but that's not happening here.

Adbot
ADBOT LOVES YOU

cheetah7071
Oct 20, 2010

honk honk
College Slice
using the wrong name means making errors about whether the correct range of the value is 0-1 or 0-100, constantly

Xarn
Jun 26, 2015
The best thing is when you have two APIs, one you want to shovel into another, and they use different ranges.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Volte posted:

There's nothing wrong with this :colbert: And it's still a percentage. 0.1 and 10% are the same thing: 10/100.

percentage = .1 says very explicitly .1/100

Volte
Oct 4, 2004

woosh woosh

leper khan posted:

percentage = .1 says very explicitly .1/100
It doesn't. The fraction is the percentage and the % sign is a shorthand for "x/100". Percentage refers to a fraction of 100, it doesn't specifically mean just the numerator.

cheetah7071
Oct 20, 2010

honk honk
College Slice
0.1% is a valid value for a percentage. If I saw that without context I'd end up being confused whether it legitimately is 0.1% or if it's a proportion and meant to be 10%. In this case the context resolves it but mistaking those two words leads to nothing but headaches

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug
I definitely have some code that's in the camp of 'I absolutely could algorithmically generate this but couldn't figure out how and it's a bounded value'. As someone else mentioned, this probably isn't THAT bad of a code snippet, aside from the naming stuff.

Volte
Oct 4, 2004

woosh woosh
It's pretty simple: there's no place that you should ever see "percentage" and assume it should be an unadorned number between 0 and 100. There's nothing in life, programming, or mathematics that uses it that way. Not even everyday use of percentages in common language express percentages without the percent sign.

Normally this wouldn't even come up, since you rarely need to specify "percentage" instead of something more general but since this is specifically designed to visually represent percentages, it makes sense to me that it should follow the definition of what a percentage actually is, and not what some people might mistakenly believe a percentage is.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Volte posted:

It doesn't. The fraction is the percentage and the % sign is a shorthand for "x/100". Percentage refers to a fraction of 100, it doesn't specifically mean just the numerator.

Per Centum. Fraction of 100. It's literally the words meaning. 10 percent is 10/100. .1 percent is .1/100

Per Mille. Fraction of 1000. 10 is 10/1000. .1 is .1/1000

It's very explicit.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
It's pretty simple: my interpretation is obviously correct and you're all idiots.

Volte
Oct 4, 2004

woosh woosh

leper khan posted:

Per Centum. Fraction of 100. It's literally the words meaning. 10 percent is 10/100. .1 percent is .1/100

Per Mille. Fraction of 1000. 10 is 10/1000. .1 is .1/1000

It's very explicit.
But you're mixing up two different words, percent and percentage. A percentage is a fraction of 100. Percent is just a shorthand for "out of 100" or "divided by 100". "10 percent" is the percentage 10/100 = 0.1. "0.1 percent" is the percentage 0.1/100 = 0.001. I would understand this complaint if the name of the function was "percent" instead of "percentage", but in that case I'd say it's just wrong and there's no real good interpretation of that. Percentage is pretty unambiguous though.

pokeyman posted:

It's pretty simple: my interpretation is obviously correct and you're all idiots.
I meant keeping track of when to interpret it as a fraction instead of a whole number is simple: always (another post snuck in there and maybe made it less clear who I was responding to)

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Falcon2001 posted:

I definitely have some code that's in the camp of 'I absolutely could algorithmically generate this but couldn't figure out how and it's a bounded value'. As someone else mentioned, this probably isn't THAT bad of a code snippet, aside from the naming stuff.

Use machine learning.

Macichne Leainig
Jul 26, 2012

by VG
Stable diffusion to generate progress bars based on a supplied percentage

CPColin
Sep 9, 2003

Big ol' smile.

pokeyman posted:

It's pretty simple: my interpretation is obviously correct and you're all idiots.

I'll drink to that!

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Volte posted:

But you're mixing up two different words, percent and percentage. A percentage is a fraction of 100. Percent is just a shorthand for "out of 100" or "divided by 100". "10 percent" is the percentage 10/100 = 0.1. "0.1 percent" is the percentage 0.1/100 = 0.001. I would understand this complaint if the name of the function was "percent" instead of "percentage", but in that case I'd say it's just wrong and there's no real good interpretation of that. Percentage is pretty unambiguous though.

I meant keeping track of when to interpret it as a fraction instead of a whole number is simple: always (another post snuck in there and maybe made it less clear who I was responding to)

percentage
a part of a whole expressed in hundredths
https://www.merriam-webster.com/dictionary/percentage

Yes it is unambiguous. A percentage of .1 would be .1/100

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
I imagine (hope) you would not write code where you call an argument "percentage" and then smugly "well actually" other people who are confused about why the value is treated as an (unscaled) proportion rather than a percentage in the colloquial use of the term

if you write a method like that and you name the argument "percentage" rather than "proportion", what does that choice of term imply? - if not that you're treating the number as what most people would understand as a percentage, i.e. a number where 100 really means 1 because it's been scaled like that

If you call it that, and we assume you're not merely being careless (or a smug prick) about what you call things, then you chose that term over something less pointed like "proportion" or "fraction". the reader of the code is entitled to infer something about what you meant by that choice of term, and what else are they to assume

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
like, even if I agreed that "proportion" and "percentage" were terms that have absolutely 100% the same meaning and connotations (I don't agree, by the way) I still wouldn't name a variable that if it was meant to be an ordinary proportion; because I would know that the majority of people reading the code would not understand it to mean what I was trying to express, and if writing code is an act of communication with the computer and with other programmers, then that's a failure to communicate well

cheetah7071
Oct 20, 2010

honk honk
College Slice

Volte posted:

It's pretty simple: there's no place that you should ever see "percentage" and assume it should be an unadorned number between 0 and 100. There's nothing in life, programming, or mathematics that uses it that way. Not even everyday use of percentages in common language express percentages without the percent sign.

this is absolutely wrong. Completely wrong. I see numeric values between 0 and 100, intended to be interpreted as percentages, constantly in my work.

Volte
Oct 4, 2004

woosh woosh

leper khan posted:

percentage
a part of a whole expressed in hundredths
https://www.merriam-webster.com/dictionary/percentage

Yes it is unambiguous. A percentage of .1 would be .1/100
"A part of a whole" is literally the definition of a fraction and 0.10 is already expressed in hundredths. It's ten hundredths. That's what the decimal notation means. You can argue the nuances of naming functions and whether this term confusing to the average reader (I'm starting to come around that it is confusing, but certainly not incorrect) but as far as the definition of percentage, you're mistaken.

If the language had an actual % postfix operator that let you specify "50%" directly, what would you expect "printPercentage(50%)" to do?

Hammerite posted:

like, even if I agreed that "proportion" and "percentage" were terms that have absolutely 100% the same meaning and connotations (I don't agree, by the way) I still wouldn't name a variable that if it was meant to be an ordinary proportion; because I would know that the majority of people reading the code would not understand it to mean what I was trying to express, and if writing code is an act of communication with the computer and with other programmers, then that's a failure to communicate well
I'm not sure exactly what distinction you're drawing between an ordinary proportion and a percentage, but it's called a percentage because the function is specifically is designed to visualize percentages.

cheetah7071 posted:

this is absolutely wrong. Completely wrong. I see numeric values between 0 and 100, intended to be interpreted as percentages, constantly in my work.
File a bug report

Volte fucked around with this message at 22:04 on Jan 17, 2023

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆
if your variable names are ambiguous enough to provoke a big annoying argument like this you should ensure there is actual documentation (or at least a comment over the function definition) specifying the actual range of inputs instead of leaving your readers to infer it

because whether you think your side is right or wrong someone from the other side is gonna read your code someday

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
"percentage", at least as used colloquially, can mean (A) a number expressed in a particular form (e.g. "100%" standing for the number 1) but it can also mean (B) the number to the left of the percent sign when a number is written that way. If you don't agree with this, imagine you asked someone what percentage of voters in a particular state voted for Donald Trump in the 2020 presidential election, and that they responded "forty-five". So long as you would interpret that response as meaning that Trump got 45% of the vote, and not as meaning that he got 4500% of the vote, then I think you're compelled to accept that "percentage" can have meaning (B).

When I say "ordinary proportion" I mean a proportion that's not presented as a percentage (sense A). Of course, a percentage (sense A) is a proportion (presented in a particular way).

Volte
Oct 4, 2004

woosh woosh
I think at best it shows that there needs to be some clarification on the range, which really there should be in any case, but I still don't think there's a better word for that function than "percentage" given what it does (maybe ratio but I think that tends to connotes a proportion of one thing to another). A lot of colloquial usage has implied information omitted in ways that you would (or should) never assume in a more rigorous setting like programming. "What's the temperature?" "31". In common parlance, this is probably a well understood sentence given all available context. In programming, it would be obviously underspecified - if it wasn't obvious otherwise, you'd have to go to the documentation to see what units are expected. If you see "percentage", maybe you do the same thing just to make sure because sometimes the meaning of words can be tricky, but I still say that if the documentation then tells you the number should be between 0 and 100, then it's a misnomer. In other words, if you assume "percentage" means anything other than "scalar multiplier of a whole", then you're just assuming that the library writer was wrong. Bury me on this hill :colbert:

cheetah7071
Oct 20, 2010

honk honk
College Slice

Volte posted:

I still don't think there's a better word for that function than "percentage"

the correct word is "proportion"

Volte
Oct 4, 2004

woosh woosh
The parameter should be called "n" so that you have to look up what the range is.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Volte posted:

I think at best it shows that there needs to be some clarification on the range, which really there should be in any case, but I still don't think there's a better word for that function than "percentage" given what it does (maybe ratio but I think that tends to connotes a proportion of one thing to another).

I think that "proportion" and "fraction" are both better terms, particularly because unlike "percentage", I do not think either of them admits alternative interpretations that readers would have high confidence in until surprised by the author's actually-intended meaning. This goes back to what I said in my previous post about the choice of the term "percentage", in place of other possible terms, appearing to have significance to the reader.

Votlook
Aug 20, 2005

cheetah7071 posted:

the correct word is "proportion"

petition to start using the word "peruno"

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)

Volte posted:

The parameter should be called "n" so that you have to look up what the range is.
based

redleader
Aug 18, 2005

Engage according to operational parameters
the problem isn't the parameter name. it's the parameter type

JawnV6
Jul 4, 2004

So hot ...
heard this was the thread to discuss Basis Points??

take boat
Jul 8, 2006
boat: TAKEN
I think it's the thread to discuss type systems with measurement types: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/units-of-measure

Ranzear
Jul 25, 2013

What percentage of bikesheds have more than a page of stupid argument printed sans serif on the underside of the cornflower blue metal roof?

🔵🔵 ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Ranzear posted:

What percentage of bikesheds have more than a page of stupid argument printed sans serif on the underside of the cornflower blue metal roof?

🔵🔵 ◯ ◯ ◯ ◯ ◯ ◯ ◯ ◯

Looks like 20 or so based on your diagram

Ranzear
Jul 25, 2013

It'll never be 0.20 exactly, so the <= is spurious precision and can be changed to just <, of course.

The real horror is that the filled circles have a different width from the unfilled circles and I had to pad the latter with spaces manually.

QuarkJets
Sep 8, 2008

RPATDO_LAMD posted:

if your variable names are ambiguous enough to provoke a big annoying argument like this you should ensure there is actual documentation (or at least a comment over the function definition) specifying the actual range of inputs instead of leaving your readers to infer it

because whether you think your side is right or wrong someone from the other side is gonna read your code someday

"Perhaps I was wrong, but the fact that I was confused at all says a lot about your position"

Macichne Leainig
Jul 26, 2012

by VG

RPATDO_LAMD posted:

if your variable names are ambiguous enough to provoke a big annoying argument like this

Counterpoint; goons. :spergin:

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug
Crossposting from the Python thread because I think it goes here:

Switched teams recently, was trying to modify some stuff and went to check unit tests; most of the packages I'm touching don't have unit tests (and I don't have time to overhaul them) but one did, so I was like 'oh okay cool, I can add some tests here to check things'.

However, when I looked more closely, I realized that all the tests were some variation of the below. See if you can spot the problem.

Python code:
def test_get_widget():
	expected_response = ["OUTCOME"]
	class_to_test.get_widget = Mock(response=expected_response)
	assert class_to_test.get_widget(test_parameters) == expected_response
This is also the package where I added the most actual functionality that actually could use some tests...so...welp. Looks like I get to rewrite all the unit tests tomorrow.

QuarkJets
Sep 8, 2008

lmao

Is your team checking coverage at all? You should be able to point to all of the code with 0% coverage and be like "hey you're not actually testing any of this".

shame on an IGA
Apr 8, 2005

Falcon2001 posted:

Crossposting from the Python thread because I think it goes here:

Switched teams recently, was trying to modify some stuff and went to check unit tests; most of the packages I'm touching don't have unit tests (and I don't have time to overhaul them) but one did, so I was like 'oh okay cool, I can add some tests here to check things'.

However, when I looked more closely, I realized that all the tests were some variation of the below. See if you can spot the problem.

Python code:
def test_get_widget():
	expected_response = ["OUTCOME"]
	class_to_test.get_widget = Mock(response=expected_response)
	assert class_to_test.get_widget(test_parameters) == expected_response
This is also the package where I added the most actual functionality that actually could use some tests...so...welp. Looks like I get to rewrite all the unit tests tomorrow.

Thank you for boosting my confidence to believe that I actually can change careers from wastewater treatment to software dev

NtotheTC
Dec 31, 2007


shame on an IGA posted:

wastewater treatment to software dev

but you repeat yourself

Adbot
ADBOT LOVES YOU

Qwertycoatl
Dec 31, 2008


I wonder what maintenance problems you get with a giant struct that you don't get wth 26 somewhat less giant structs grouped by name rather than purpose.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply