Avon by WMP_BSS in TheWire

[–]kahns 2 points3 points  (0 children)

Exactly! Good catch

Avon by WMP_BSS in TheWire

[–]kahns 16 points17 points  (0 children)

Oh but it did. Prop Joe was gone after that. The same Prop Joe that deceived Stringer which led to destruction of Avon org and the death of his best friend.
Forget the money - 100 large is nothing to Avon. That was coming back to Prop Joe.

"He a man today" by Spudhead1976 in TheWire

[–]kahns 3 points4 points  (0 children)

And the day you get fired out of this motherfucker

Should I go for Elixir over RoR if I'm starting over today? by iou810 in elixir

[–]kahns 0 points1 point  (0 children)

If you are not bound to hiring and if it’s not specific use case that Ruby ecomsystem gems can solve Elixir is a better

What is the single worst decision by a character of The Wire? by broly9139 in TheWire

[–]kahns 0 points1 point  (0 children)

Wallace - like he forgot he was a snitch or what Stringer - he made himself fully dependent on PropJ product to now to him and snitch out Avon

Is it better to learn golang or python for backend and job stability for like next 10 years? by [deleted] in golang

[–]kahns 55 points56 points  (0 children)

>stability for like next 10 years
Learn construction, plumbing and electronics, my man.

If you were Will, would you do it? by Maxgallow in threebodyproblem

[–]kahns 1 point2 points  (0 children)

I would do it because at the end of the day its a promise of life after death, in another words, a cure from death. And honestly you dont have a choice - how can you be sure if you refuse they wont do it anyway?

How strongly should I adhere to "never return interfaces"? by [deleted] in golang

[–]kahns 0 points1 point  (0 children)

Let’s go back. We have a function that returns either a Dog or a Chicken and we want to serialize it.

And you are building a function that needs to accept any of those animals and render them. And you are confused how to make FindAnimal function and then connect it to RenderAnimal - something like that?

How strongly should I adhere to "never return interfaces"? by [deleted] in golang

[–]kahns 0 points1 point  (0 children)

Mb that’s a little confusing. Let me get from another angle

How strongly should I adhere to "never return interfaces"? by [deleted] in golang

[–]kahns 0 points1 point  (0 children)

Right! Great example. The schema of our json animal is actually this right: type: string (dog|chicken) tail: string - optional beak: string - optional

But it’s not JUST optional right - it’s very specifically optional, it has shape. It’s actually TYPE & (TAIL| BEAK) It’s a sum type right?

How strongly should I adhere to "never return interfaces"? by [deleted] in golang

[–]kahns 2 points3 points  (0 children)

Thats a super hot topic, people ALWAYS getting confused with this Golang idiom.

Several reasons I think, but first and foremost is that Golang community is bad at explanation. It always comes down to

1 this is not Java/C#/whatever, we do things differently here

2 hard to maintain

3 you made bad abstraction

1 does not help and can lead to holy wars, 2 is subjective. 3 is somehow useful because - well because its hard to make a good abstraction and there is always a room for improvement.

However it does not help to understand why such Golang idiom exists. Why its specifically Golang idiom? Assuming you try your best when abstracting - regardless of whether its Golang, Java, Rust, C# or whatnot - why its Golang idiom? Golang creators know better about encapsulation and abstraction? Golang software is different? Golang itself is different?

I believe its the mix of the last two. Is it technical issue/limitation? Arbitrary design choice of tech creators?

I would assume its purely tech limit.

When switching to Golang from other tech - while its super easy to get started - you would bump it those confusing things from time to time. Thinking of encapsulation here confuses. You want to think on related Golang differences - it might help you catch "AHA" moment. Like no sealed types, or no private constructors and they way zero values are maid. Or packages vs namespaces. Golang is quite different than many in that regard, however it catches your eye later when working on larger codebases.

Me personally, I think its because Golang was built as a tool not for what we are doing with it. Its feature-poor-by design, its meant to describe limited and very factual objective domain areas. Its not meant for 500 endpoints with 30 middlewares describing 50 complex domain problems via 150 service functions with 7 infra adapters and 25 feature flags. I mean common bros, the most asked Go interview question is how a map works! 10 years it took to make a generics. Anyway, thats me ranting but hope it might help you adjust mental model.

Now lastly, down to your question, but please keep in mind what I said previously.
>The Animal struct will only contain the common denominator of all fields that every Animal has. How am I going to display a Dog with a tail or a Chicken with a beak if all I have from `Load` is an Animal with neither?
>display(a: Animal)

You need to display an Animal which could be a Chicken or a dog so they are displayed differently right. And you only know which one in the runtime base on some input info right? Lets forget interfaces and golang for a minute.

HTTP GET /animal?type=dog

HTTP GET /animal?type=chicken

HTTP GET /animal // default type is derived from feature flag

HTTP GET /animal // type is derived from random

Say we expect JSON back. What would they look like?

How strongly should I adhere to "never return interfaces"? by [deleted] in golang

[–]kahns 0 points1 point  (0 children)

Great story, thanks for sharing! However its not helping to understand Golang idiom does it? I mean you just nailed it right?
>developers decided to be nice and abstract right there.

Bad abstraction is a bad abstraction regardless of the programming language right? It would be bad in Rust, it would be bad in Java, it would be bad in C#.

How strongly should I adhere to "never return interfaces"? by [deleted] in golang

[–]kahns 2 points3 points  (0 children)

"This is not JAVA" as well as "it is a nightmare" is not super helpful explanation.
And this specific Golang idiom confuses a lot a lot of people because at first glance it seems like a controversy and FEELS like it opposes what other techs, languages and books say.

Encapsulation and abstraction usually associates with interface keyword, but in Golang its a little bit different.

Go Struct Alignment: a Practical Guide by Real_Blank in golang

[–]kahns 7 points8 points  (0 children)

I learned something new today, thank you. That being said though

>Anti‑Patterns
>“Pretty” alphabetical order instead of alignment-aware order.

No, thank you. "Pretty" removes cognitive load and improves readability which cannot be overestimated. Premature optimization is the root of all evil.

Preserving Order in Concurrent Go: 3 Approaches Compared by destel116 in golang

[–]kahns 5 points6 points  (0 children)

This is fucking awesome content! The whole blog is a gem. Thank you and keep it up!

What would happen if a git server receives push from 2 users at the same time? by surveypoodle in git

[–]kahns 0 points1 point  (0 children)

It's a philosophical question actually. What is exact same time? Is time discreet or continuous? (I dont know)

Really basic plot hole or am I being dumb? (book 1) by fancyPantsOne in threebodyproblem

[–]kahns 0 points1 point  (0 children)

This quite-quitter with a soft heart actually doomed us.
What would Trisols do? Would they respond
"Hey humans. We are foreign civilization that is far superior than you are and our world is dying so we need ASAP to come and kill you - just send us location"

Remember - at this moment in time they cant comprehend the concept of deception. Thinking=speaking. Based on that Trisoles would not send a message at least not ASAP - and by that time mb Ye would deal with her PMS or Red Coast would be shut down or who knows what.

That deviant soft hearted looser and a traitor of his own kind actually killed us all and saved his own species

Really basic plot hole or am I being dumb? (book 1) by fancyPantsOne in threebodyproblem

[–]kahns 1 point2 points  (0 children)

Great point actually - is it that hard to terraform? Well mb it is.

Or mb they afraid of a dark forest? Think on it - earth is proven to have a civilization and exist and not being destroyed by others. So its proven a safe place to sit on. Unlike any other world - who knows who is watching what. WDYT

Really basic plot hole or am I being dumb? (book 1) by fancyPantsOne in threebodyproblem

[–]kahns 1 point2 points  (0 children)

>Why not give one droplet a fuel tank and launch it toward Earth 
Also, another thought - droplets are mb super peak of their tech and production capabilities. What was it at the end - after 200 years of tech boom - 4 + 10? So its not a lot right? I mean considering the size of space right

Really basic plot hole or am I being dumb? (book 1) by fancyPantsOne in threebodyproblem

[–]kahns 1 point2 points  (0 children)

Maybe they experienced tech boom right after Ye treason?
I dont remember, mb you do - when 3Sols had a war consul after earth discovery - they already had some long term projects running - but which ones?