Title
#thinking-together
Stefan

Stefan

01/31/2019, 1:18 PM
Are there any techniques or metrics to define or measure how specific or generic something is? That something could be a function or class in a programming language, an algorithm, or even something less formally defined, like a component in a UI framework. I'm familiar with some measures of complexity, like counting dependencies or cyclomatic complexity, which seems somewhat related. Appreciate any pointers to papers or articles about this, even if they "just" define how something is more or less specific or generic than something else to support a hypothesis that is totally unrelated.
duncanawoods

duncanawoods

01/31/2019, 1:35 PM
I'm not sure what "how specific or general" would actually mean for a class. If you get a really precise definition then you have probably defined how to measure it too!
1:35 PM
It reminds me a bit of https://en.wikipedia.org/wiki/Chomsky_hierarchy - the main technique for e.g. proving something is turing powerful, is to show an isomorophism to a known system with proven properties.
stevekrouse

stevekrouse

01/31/2019, 2:07 PM
In BV's ladder of abstraction, the number of parameters in functional abstraction is the measure of abstraction
duncanawoods

duncanawoods

01/31/2019, 2:39 PM
Interesting. The types involved feel like a huge factor for measuring generalisation/specialisation e.g.
add(a : ushort, b : ushort
add(a : int, b : int)
add(a : double, b : double)
add(a : any, b : any)
add<T>(a : T, b : T)
add<T>(... list : T)
2:45 PM
I am reading "An Introduction to General Systems Thinking" right now and it is discussing how to measure the relative generality of scientific laws. Weinberg claims that that laws should properly be defined as conditional "if... so...". He says that the fewer "if... so..." clauses, the more general the law. Applying this to code, instead of looking inside the code for it's generality, look outside at the context in which it can be used i.e. how many caveats are there about when it can or cannot be used?
stevekrouse

stevekrouse

01/31/2019, 5:42 PM
Variables are also know as "degrees of freedom"
duncanawoods

duncanawoods

01/31/2019, 5:49 PM
Number of variables/parameters doesn't seem like a good measure when we can just encode any number of variables into a goedel number.
stevekrouse

stevekrouse

01/31/2019, 5:57 PM
Good point
5:58 PM
I feel like you're onto something with the types thread...
5:58 PM
(Can't we measure the length of the godel number?)
Tim Swast

Tim Swast

01/31/2019, 6:08 PM
The first thing that comes to my mind is https://en.wikipedia.org/wiki/Kolmogorov_complexity but you kind of want the inverse. Given a parameterized definition, what is the size of the space it covers.
j

Joshua Horowitz

02/01/2019, 3:22 AM
ya'll getting silly with this complexity theory fuss
3:26 AM
FWIW, it seems like the best way to think about "specific vs general" isn't as a quantitative measure, but as a comparative relation. X is more general than Y if there's a nice mapping from situations where you'd use Y to situations where you could use X instead. (This is analogous to the concept of "reducing" problems in complexity theory; egg on my face for talking smack about CT 5 minutes ago.)
3:28 AM
There's a lot of wiggle room in that definition, and rightfully so. For instance: is a Turing machine more general than ANY computational artifact? Well, yeah, kind of. Although the mapping from your function to the Turing machine will basically involve programming the function into the Turing machine, so that's not that "nice" of a mapping.
3:30 AM
Two examples of particularly nice mappings: ā€¢ Passing the exact same parameters along, typecast into a more general type! (So
add(a : double, b : double)
is more general than
add(a : int, b : int)
.) ā€¢ Passing the exact same parameters along, with a few extra parameters! (So
join(list, delimiter)
is more general than
joinWithCommas(list)
.)
3:31 AM
But as the mapping becomes more and more complex (writing wrapper code to adapt a library to a different style of API, etc.), it becomes less and less "nice", and it becomes less and less clear that one artifact is more general than the other.