Any method you forget to overwrite from the embed struct gives a false "impression" you can call any method from mockS3.
Most of time code inside test will be:
// embedded S3Client not properly initialized
mock := mockS3{}
// somewhere inside the business logic
s3.UploadReport(...) // surprise
Go is flexible, you can define a complete interface at producer and consumers still can use their own interface only with required methods if they want.
Hi I'm David, self taught developer looking for profissional challenges using GraphQL, gRPC or more low level. Currently staff engineer with great experience in finance (fintechs) and e-commerce.
Generally in banking you either separate preauthorization (or reservation of funds) from authorization, or you separate transaction from settlement and you compute an acceptable rate of loss.
Why did you decide to go with an escrow model in your use case?
Yeah, for sure! I mention it in the README of that library, but one of the motivations I had was to not require you to wrap the errors with my library, like pkg/errors requires you to.
"I think" posts should always handled with care because we have no real evidence, just your "I think".
Pattern 12 is often used to promote critical thinking and to shake previous believes. Most teachers want the class to realize something is wrong because this type of realization helps the process of learning (knowledge coming from you, not them).
In the case of 12 the objection is that the author is unfairly tricking (intentionally or not) the reader into making a mistake, which is unnecessarily hostile.
That's why one of the suggested fixes is simply to place a warning that the following is not to be read as reliable gospel.
Exactly. It doesn't even have to necessarily say "this is wrong" ... just something that causes you to engage with the example as potentially unreliable or not the best solution.
"The traditional way to solve this problem ..."
"Other tutorials suggest something like the following ..."
It's just sadistic to give an example that doesn't work and then I waste time looking for a syntax error or typo that doesn't exist.
> pattern 12: explaining the “wrong” way to do something without saying it’s wrong
I encounter Pattern 12 in three different ways:
1. Google for solution problem. Find tutorial. See solution that, for all intents and purposes, looks correct. Adapt to my problem. Doesn't work. Return to to tutorial. "Surprise! How much time did you lose!?!?".
2. Following tutorial. See solution. Something seems off. Wrack my brain trying to reconcile the solution given that it seems wrong. Scroll down. "Surprise! That was the incorrect solution."
3. Following tutorial. See solution. Seems legit, integrate solution into my learning. "Surprise. Now your brain is broke!"
There is no version of this pattern that I've encountered where I didn't both treat the author as an unreliable narrator going forward and also assume they were a bit of an ass.
You can't learn if you no longer trust your guide.
If you want all features of language X (I doubt we will stop at generics) use language X. Stop trying to make all languages the same.
I work with programmers from OO background (java) and they can't even grasp the utility of functions as value or closures. Every damn "service" has an interface/generated mock and anemic model. They're desperate waiting for generics for go to "complete".
I didn't say they're the same. I'm saying people coming from OO complain all the time of lack of generics, inheritance (besides composition) etc.
I teach basic go at my job to help people wanting to migrate, they start the go journey thinking go will do "less" because we don't have all features as their main language. Which reminds me of this phrase:
> 'You cannot reduce the complexity of your problem by increasing the complexity of your language.'
This type of measurement using quantitative data should be interpreted with care. At least here in Brazil most of places where some impact occur have an increase in net diversity and abundance. Many new sp. invade the niche left open by the former community and what you see is a shift of the entire community.
Which, while terrible to see the loss, gives me some hope that we have less power over nature than we think. A housing suburb is undeniably a less wonderful place than the forest it replaced. But life will inevitably find a way to colonise that suburb. Black birds and Camel crickets bring me hope. But I wish we would stop burning down rainforests and building boring suburbs.
As someone who freelance php and do on-site go coding on daily basis, modern PHP is amazing (symfony/slim is everything I want).
One simple improvement I would love to see is namespace grouping in standard library. Go has all related functions inside some package. Go pls let me do http.notfound<tab/enter> = http.StatusNotFound. But in php even with inteli I need to google some function/const name.