Live data from Hacker News

Software Mimicry

hillelwayne.com

11–17 of 17 posts

Re: Software Mimicry

#11

In Design Patterns in Dynamic Programming, Peter Norvig notes that strategies are just trivially replacable with higher-order functions (HOFs). So that's where this trope is from! A few things: 1. The "just replace it with a higher order function" thing obviously falls apart when your strategy has multiple methods. In which case, the FP programmer might be tempted to supply a record where each field is a function, an…

Isn't your point 2 exactly what OP said?

> I think it’s more interesting to think of the GoF-language as mimicking HOFs with the strategy pattern facsimile. The strategy pattern reimplements HOFs as a code-level idiom.

Re: Software Mimicry

#12
post #9

So are the birds mimicking the bees, or is it the other way around? Maybe I'm just missing the point. I mean, is int[] a mimic of ArrayList , or vice versa? Of course they're similar, of course they're different. Is "mimicry" just a pejorative thing?

A definition is given as literally the first paragraph of the post.

> Mimicry is when software X reimplements at a higher level a core feature of software Y. The produced facsimile has some, but not all, of the same properties, enough to “look like” it’s the same thing but missing many of the nuances. This exists in every kind of software. One language can mimic another, a library can mimic a language, a database engine can mimic a product, etc.

I don't see how your question even fits into that definition.

Re: Software Mimicry

#13

In Design Patterns in Dynamic Programming, Peter Norvig notes that strategies are just trivially replacable with higher-order functions (HOFs). So that's where this trope is from! A few things: 1. The "just replace it with a higher order function" thing obviously falls apart when your strategy has multiple methods. In which case, the FP programmer might be tempted to supply a record where each field is a function, an…

Isn't your point 2 exactly what OP said? > I think it’s more interesting to think of the GoF-language as mimicking HOFs with the strategy pattern facsimile. The strategy pattern reimplements HOFs as a code-level idiom.

No more than HOFs are mimicking objects.

It's two schools of thought - everything is functions & data, or everything is objects & methods.

Re: Software Mimicry

#14

Earlier quoted context omitted.

Isn't your point 2 exactly what OP said? > I think it’s more interesting to think of the GoF-language as mimicking HOFs with the strategy pattern facsimile. The strategy pattern reimplements HOFs as a code-level idiom.

No more than HOFs are mimicking objects. It's two schools of thought - everything is functions & data, or everything is objects & methods.

Closures are implemented as objects under the skin, but that doesn't make them equivalent conceptually to me. I suppose it's down to syntax, after all if you ignore that you can have anything you like in assembler, but it won't feel very high level.

Re: Software Mimicry

#15

Earlier quoted context omitted.

No more than HOFs are mimicking objects. It's two schools of thought - everything is functions & data, or everything is objects & methods.

Closures are implemented as objects under the skin, but that doesn't make them equivalent conceptually to me. I suppose it's down to syntax, after all if you ignore that you can have anything you like in assembler, but it won't feel very high level.

Closures are a poor man’s objects. Objects are a poor man’s closures.

Re: Software Mimicry

#16
post #15

Earlier quoted context omitted.

Closures are implemented as objects under the skin, but that doesn't make them equivalent conceptually to me. I suppose it's down to syntax, after all if you ignore that you can have anything you like in assembler, but it won't feel very high level.

Closures are a poor man’s objects. Objects are a poor man’s closures.

What's the "poor man's" stuff? Is there a better way I don't know of

Re: Software Mimicry

#17
post #15

Earlier quoted context omitted.

Closures are a poor man’s objects. Objects are a poor man’s closures.

What's the "poor man's" stuff? Is there a better way I don't know of

https://wiki.c2.com/?ClosuresAndObjectsAreEquivalent

Comes from that koan.

Post reply on HN