Better HN
topnewbestaskshowjobs
Log inSign up

randomdata

8,634 karma · joined Jun 23, 2011 (15y ago) · 7,679 submissions

Submissions

comment 2y ago · link · parent

map is also built-in. Where do you find the hash map in the given program?

By your logic some nebulous package in a random GitHub repository that happens to satisfy an interface is also another implementation, but you would have to be completely out to lunch to think that fits with the topic of discussion.

comment 2y ago · link · parent

> Why should complexity and over-engineering be considered best practices for a beginner?

I'm still not clear on where the idea that this is a "best practice" is coming from. Is there some context I am missing?

Aside from the editorialized title, all I can find is an assertion of "following best practices", which does not even imply that it is trying to establish best practices (of any sort, let alone around efficiency or complexity), merely that the author tried to follow some best practices established elsewhere. It is understood that to follow opens the possibility of veering off course, so unless the beginner is also a beginner with spoken language, it would not be taken to mean that this demonstrates best practices.

comment 2y ago · link · parent

Where is the fun in that?

comment 2y ago · link · parent

Given the following, where is the nil implementation found?

    package main

    type FooInterface interface {
        Baz()
    }

    func bar(fizz FooInterface) {
        bizz.Baz()
    }

    type MyFoo struct{}

    func (*MyFoo) Baz() {}

    func main() {
        var foo FooInterface = &MyFoo{}
        bar(foo)
    }

comment 2y ago · link · parent

> It is easy to generate mock implementation code

Not in any reusable way. Take a look at mockgen and testify: All they do is provide a mechanism to push implementation into being defined at runtime by user code. So, if they, or something like it, is in use the implementation is still necessarily there for all to see.

> Also, the original author of the function that consumed the apparently unnecessary interface type may have intended to test it

Okay, sure, but this is exactly what the commenter replied to was talking about initially. What is a repetition of what he said meant to convey?

> That means the discussion may be broader than just what one person contributes to it.

Hence why we're asking where the relevance is. There very well may be something broader to consider here, but what that is remains unclear. Mocking in and of itself is not in any way interesting. Especially when you could say all the very same things about stubs, spies, fakes, etc. yet nobody is talking about those, and for good reason.

> If this offends you

For what logical reason would an internet comment offend?

comment 2y ago · link · parent

There is no redefinition. You know that because you literally repeated what I said in your comment, so clearly you are accepting of what was said.

Seemingly the almost verbatim repetition, yet presented in a combative form is because you don't have familiarity with programming, and thus can only respond with canned responses that you picked up elsewhere. If you do have familiarity, let's apply it.

So, do you actually want to discuss the topic at hand, or are you here just for a silly fake internet argument?

comment 2y ago · link · parent

Uh. No. Why would I ever waste my time proving something I said? If I'm right, I'm right. If I'm wrong, you'll be sure to tell me. No reason for my involvement.

comment 2y ago · link · parent

> Can you tell how many extra memory allocations we are making to solve this problem?

What suggests that the "best practice" is sliced down the efficiency lane? The intent could be to "best" demonstrate how to structure a collection of algorithms and data structures into packages, for example.

comment 2y ago · link · parent

More likely he accidentally left out a word.

"I can't find many, if any, [without] unit tests. Is that intended? If so, why?"

comment 2y ago · link · parent

> They're both redistributing

Well, yes. While perhaps some metadata is lost, the content that is worth fighting for is captured in both cases. Practically speaking, there is no difference between the original source, an ISO rip, and an MKV rip. At least to the untrained eye, they are in every way equivalent. They both are redistribution, indeed.

That is not the case for SaaS in question. What you download during use can in no way be reconstructed into its original form. You can't use the software for a while and then, from what you've collected, start running the software on your local machine. The artifacts of use are very different from the software itself. To stick with your analogy, watching a movie on Netflix does not give you a copy of their server software. Distribution has not occurred.

comment 2y ago · link · parent

The nil interface is another implementation. I mean, unless it is being used as the sole implementation, but I think we can assume that isn't the implementation being talked about given that it isn't a practical implementation. We're talking about where there is one implementation.

comment 2y ago · link · parent

> Why is the term "Open Source" used to refer to publicly available information?

Well, why not?

"Source" has long referred to available information. In fact, you probably won't have to read HN long before you encounter a "source plz"-type meme, intended to mean something akin to: "Please point me to the available information that supports your claim."

"Open" has long referred to available information that is accessible to users. "Open source[code]" uses "open" in the same way.

PAT works too but I'm not sure it communicates anything meaningfully different. As far as I can tell, they are trying to communicate the very same thing. Is your reaction, perhaps, because you are accustomed to "open source" being used in the software sense?

> Do we refer to street dogs as open source dogs?

Dogs haven't typically been seen as information, so, for all practical purposes, probably not. But if we want to change that, sure, why not? Language doesn't have feelings. It doesn't care.

comment 2y ago · link · parent

Sounds like a UI bug more than anything.

The compiler certainly knows how to determine if there is only one implementation of an interface and remove the interface indirection when so. There is nothing really stopping the cmd+click tooling from doing the same.

comment 2y ago · link · parent

Quite clear, in fact, which is why we are able – in theory – to have a discussion about all the distinct features at play. If it weren't clear, we wouldn't be able to go there.

I say in theory, because as demonstrated by the sibling comment, there apparently isn't much programming expertise around here. At least it was fascinating to see how a mind can go haywire when there isn't a canned response to give.

comment 2y ago · link · parent

Your comment was clear about mocks, but not why mocks are relevant to the topic at hand. The original comment was equally clear that it was in reference to where there is only one implementation. In fact, just to make sure you didn't overlook that bit amid the other words, the author extracted that segment out into a secondary comment about that and that alone.

Mocks, by definition, are always a supplemental implementation – in other words, where there is two or more implementations. What you failed to make clear is why you would bring up mocks at all. Where is the relevance in a discussion about single implementations the other commenter has observed? I wondered if you had missed (twice!) the "one implementation" part, but it seems you deny that, making this ordeal even stranger.

comment 2y ago · link · parent

> Nothing stops me from self-signing apps or using websites only.

That is clearly not the same thing. Why don't you do the exact same thing? I mean, other than the monopolistic efforts holding you back.

(I recognize that you are trying to bring your own monopolistic definition to the table, and while I'm sure it has merit as a better definition, I fail to understand what value you think there is in trying to change the subject? Why not just stick to the topic in progress like everyone else, even if you don't love everything about it? The rest of us probably don't love it either, but that's not a good reason to toss the ball to the side in an effort to disrupt play because it isn't the brand of ball you have a preference for.)

comment 2y ago · link · parent

There is no realization of higher profit margins, though, which means that restaurants operating under that model also have to reduce their income in order to "save" on wages.

So, while a fun distraction, we're right back to you thinking that money in someone else's hand is better than money in your own. What is your rational? Conventional wisdom says that there is leverage in increased cashflow. Why is the conventional wisdom wrong?

comment 2y ago · link · parent

Did you miss "just one implementation"? A mock is literally defined by being another implementation. If the 'mock' is your sole implementation, we don't call it a mock, that's just a plain old regular implementation.

comment 2y ago · link · parent

Well, then, don’t pay it. Pay yourself for the service instead. Nothing stopping you from being the service provider if there is no monopoly.

Is suspect you will soon find a monopoly, though, and that you’re merely confusing some external interpretations with what is defined within the context of this particular.

comment 2y ago · link · parent

> And yes popular languages do have real type safe enums.

Right, as we already established, but which is only incredibly narrow support within the features in question. While you can find safety within the scope of enums and enums alone, it blows up as soon as you want the same safety applied to anything else. No popular language comes close to completing these features, doing it half-assed at most. We went over this several times now. Typescript goes a little further than most popular languages, but even it doesn't go very far, leaving all kinds of gaps where the type system does not provide the aforementioned safety.

You clearly know how to read, by your own admission, so why are you flailing around like one of those wacky blow up men at the used car lot? Are you just not familiar with programming?

comment 2y ago · link · parent

> it's that Apple can force itself as a middleman.

Sure, which it can do because of the monopolistic position it has entrenched itself with. If that were cleaned up, it would no longer be in a position to do that. But the other commenter doesn't agree with you. He says that is an entirely different problem.

comment 2y ago · link · parent

While that might theoretically be a benefit, it is one not realized. I have never seen a restaurant not hire staff as employees, as opposed to leasing the space to independent contractors, which means that the restaurant is on the hook for their compensation.

Perhaps you are thinking of strip clubs?

comment 2y ago · link · parent

Like, the labour law? Volunteering to be a slave isn't labour. In fact, income is not even a concern of society. Look at income data sometime. A not insignificant portion of the population realize negative income. All perfectly legal.

comment 2y ago · link · parent

> Suppose a guy wants to be a slave? Shouldn’t he have the right to be enslaved?

Sure. Why not? Typically society would only be concerned with the servitude becoming involuntary. Thus the right to be enslaved would be expected to also come the right to end enslavement at will. That said, in most jurisdictions marriage dissolution is happy to uphold involuntary servitude so we're not entirely consistent here.

> Suppose a guy wants to sell his organs?

Likewise, society might take issue with it because of its once and done nature. Decide that selling your organs was a bad idea and don't want to do it anymore? Too bad. You are already dead. However, relatedly, things like the sale of blood often is legally accepted as you can stop providing blood at any time if you find the association is no longer working for you.

Aside from the monopolistic considerations, the 30% offer to Apple would normally be acceptable to society because, like blood, one can stop offering it in the future should they no longer find it to be desirable. If it were a contract that states that you will pay 30% and on all future transactions for the rest of your life, even if you stop liking the idea, then society would undoubtedly take issue with it. But that in no way has any relationship to what is being talked about here.

Now, the monopolistic considerations are not typically accepted by society, but, indeed, we have gotten pretty lazy in doing anything about it.

comment 2y ago · link · parent

He is saying what is very easy to see in certain contexts is not transferrable to the abstract. Go can be shockingly productive at certain tasks, but it also falls flat on its face at others. If you take your limited experience with Go (or whatever; this applies to all tools) where you found it to be highly productive and then conclude that it is always productive and therefore a tool you can use in all situations, you are bound to encounter negative productivity when you have a different problem to solve.

Need to write, say, a network service? Go can no doubt give just about anything else a productivity run for their money. Need to solve a machine learning problem? ... Good luck. It can be done, of course, but you're quite likely in for a whole lot of extra work not needed in other ecosystems, destroying any semblance of productivity.

In other words, the comment is a thinly veiled "use the right tool for the job".

comment 2y ago · link · parent

Let's assume, for the sake of discussion, all parties involved voluntarily want to give Apple 30%. Why should that be illegal?

It seems it only becomes a problem when there is external pressure that where accepting the giving of giving 30% to Apple is seen as the best of a bad situation. But that's what anti-monopolistic efforts are supposed to avoid.

comment 2y ago · link · parent

In typical normal human speak, a gift and donation are effectively equivalent, but differ by the recipient. A donation is given to an organization, a gift is given to an individual.

If you give to a single individual on the street, it would typically be considered a gift. If you gave to a collective on the street, then it would typical be considered a donation.

Of course, humans are at their best when not normal. If you want to call giving to an individual a donation, go nuts. Hell, if you want to call it the moon, even better.

comment 2y ago · link · parent

And this is why I will never understand why many think tipping is a practice upheld for the benefit of the restaurant. Cash in your hand is always better than cash in someone else's hand.
1
272829
256