News for hackers. Stuff that matters.
Re:Don't Name Classes After Patterns. Mostly by mjburgess on Sunday August 23, 2020 @03:46AM (#24250309)
Is this is just a more mathematical convention?

You write a_b where in english you'd say "b a". eg. Graph_users -- the user graph.

In mathematics the data element (noun) comes first and is differentiated by some property (graph_user, graph_product, etc.). For the sake of easily tracking what's going on.

So it makes complete sense to have VerseFake, VerseReal, etc.

Re:Don't Name Classes After Patterns. Mostly by jhanschoo on Sunday August 23, 2020 @05:01AM (#24250641)
Idk what you mean by mathematics since mathematics rarely deals with elements from different levels in a hierarchy without renaming.

Important influences probably include

- Lexicographic ordering, (programming) method access, directory path (which influences package namespaces)

- Romance languages put qualifiers after the bare noun by default. You have vestiges in English in titles like Secretary-General, via Norman.

Re:Don't Name Classes After Patterns. Mostly by mjburgess on Sunday August 23, 2020 @05:42AM (#24250783)
Eg., in english, "consider two kinds of graph: unweighted and weighted. Call them G_u and G_w..."

In mathematics your notation corresponds to Noun_adjective, pretty universally. I have never seen the converse.

"Consider a statistical model trained on UK data and a comparable one trained on US. Call them f_UK(x) and f_US(x)..."

"Compare a voltage applied across a resister, V_r with a voltage across a diode, V_d..."

"Consider the population growth of rabits (dP_r/dt) vs the population growth of foxes (dP_f/dt)..."

A notational description of a problem, using mathematics, always leads with the noun.

I have always considered the same phrasing in programming to just be this same mathematical convention.

"FalseVerse, RealVerse, ComplexVerse" reads weirdly to me. My strong preferece, as a physics grad cum data scientist, is VerseFalse, VerseReal, VerseComplex...

V_f, V_r, V_c

The particular variation follows the general structure, in notation.

Re:Don't Name Classes After Patterns. Mostly by jhanschoo on Tuesday August 25, 2020 @09:53AM (#24271348)
You're tunneling in on subscript notation. Consider also max f, diam C, edge(G).

In programming you also have contrary examples, e.g. FooObserver vs. BarObserver, especially when FooObserver's implementation and BarObserver's implementation are little alike they have very different roles in the application.

Re:Don't Name Classes After Patterns. Mostly by johbjo on Sunday August 23, 2020 @06:30AM (#24250926)
a_b in maths is pronounced "a of b" in English, and is often intended to be equivalent to a(b).

Superscripts in maths is closer to concatenated class names, as it separates it from being a function of something.

Re:Don't Name Classes After Patterns. Mostly by mjburgess on Sunday August 23, 2020 @06:46AM (#24250998)
Subscript to "of" doesn't always work.

A model trained on UK data is f_uk. It isnt "model of UK"... its a model of, eg., prices for goods.

f_UK is more like "the UK's model (of prices)"

I think the better way to interpret the mathematical convention is ObjectOfStudy_variation

...which is the convention being used in programming.

Re:Don't Name Classes After Patterns. Mostly by johbjo on Sunday August 23, 2020 @10:14AM (#24252097)
Kind of. Pronouncing a_b as "a wrt b" should work though.

With f_uk, it could mean a model with parameters trained for UK - "theta uk".

In my view, it's nice to have subscript-like things in the constructors. Ex:

uk_price_model = PriceModel(uk_model_parameters)

Re:Don't Name Classes After Patterns. Mostly by OnlyOneCannolo on Sunday August 23, 2020 @09:37AM (#24251844)
f = goods price model

uk = United Kingdom

f_uk = goods price model of the United Kingdom

Seems to work. Did I misunderstand?