In fact I would probably prefer databaseRestore to restoreDatabase for the same reason because it would allow to cognitively group database methods in your flat namespace instead of grouping restore methods.
This is especially important in pure C. If OOP-style programming is adopted, databaseRestore() can be strictly interpreted as a method of the Database class without ambiguity, and its first parameter is the object the operation is applied onto. In a sense, even old C & POSIX functions such as fopen(), fclose(), fseek() can be seen as a rudimentary form of OOP. On the other hand, restoreDatabase() may perform other operations that change the state outside of the database object.
It may do anything because it was probably written by an intern
Depends on whether you're Hungarian :P
In all seriousness, I'd go with the prefix if these are part of a large flat namespace, but if there were a lot, then they should move to their own package and become `animal.Cheetah`.
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.
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.
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.
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.
Superscripts in maths is closer to concatenated class names, as it separates it from being a function of something.
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.
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)
uk = United Kingdom
f_uk = goods price model of the United Kingdom
Seems to work. Did I misunderstand?
As other commenters have observed, plenty of great reasons for doing so.
Please don’t. VerseFake is because the natural sorting will sort VerseFake together with Verse.
You, on the other hand - seem to have never worked with codebases that are large enough to find anything in them.
Good luck finding the right function when you call everything starting with a verb.
In programming you start with an Entity and are given a set of Verbs that are applicable to that entity, not vice versa.
You obviously studied philosophy and not engineering if you are asking questions like that.
Many different languages style guides actually prefer verbs for functions as it makes it clearer an action is taken.
Finding function names is very easy with either approach. You have bigger problems and don’t know what you are looking for if you can’t find FakeVerse instead of VerseFake. Why is LandAnimal acceptable over AnimalLand? Why choose AnimalFast over FastAnimal? There is no reason those should be chosen: sorting is a poor argument as the loss in clarity is too great.
So there’s no reason in naming functions any differently when Entity within the name is just another namespace.
Also I don’t really understand why have the function name “restoreDatabase” when you could just put that function as “restore” within a module called “database”.
So you’re kind of missing the whole point of where the prefixes rather than suffixes come from.
Its a VERSE class, not a FAKE class. It just so happens the class is described as a "fake" so...FakeVerse. Its like saying "Hey look a person tall!". While it sounds silly in english its incredibly pervasive in programming.
Another common pattern that drives me nuts is when people prefer nouns over strong verbs in functions. doDatabaseRestore instead of restoreDatabase.