Readit News logoReadit News
Posted by u/luuuzeta 3 years ago
Ask HN: Concepts that clicked only years after you first encountered them?
I'm reading Petzold's Code [1], and it dawned on me that I didn't understand logic gates intuitively until now. I took a Computer Architecture course back in college, and I understood what logic gates meant in boolean algebra but not empirically. Petzold clarified this for me by going from the empirical to the theoretical using a lightbulb, a battery, wires, and relays (which he introduces when he talks about the telegraph as a way to amplify a signal).

Another concept is the relationship between current, voltage, and resistance. For example, I always failed to understand why longer wires mean more resistance while thicker wires mean less resistance.

[1]: https://www.codehiddenlanguage.com/

fortituded0002 · 3 years ago
1. Everyone is the main character in their own story.

This manifest in all sorts of ways - from people not being there when you need them the most, from friends dying off as soon as proximity changes, to how and why get people get promoted in jobs. This isn't necessarily bad, but if you don't know how to navigate this it can be quite painful and confusing.

2. Representation matters.

I knew this for a long time, but it didn't fully click until years had gone by and I realized I had unconsciously held myself back from pursuing a wide range of things because I just didn't see anyone like me there.

3. Rules in life are just constructs that we as humans have created.

Starting a business helped the most on this one. That's when I started to see that "rules" or "procedure" are all made up and exceptions can always be made.

(Edit: typos)

btown · 3 years ago
> Everyone is the main character in their own story

For those with anxiety, one of the best pieces of advice I ever received (that also took me years to internalize!) was the corollary to this: nobody is thinking about you in a critical way, at the level that you are criticizing yourself, because they are their own main character. Which is incredibly freeing, because the anxious person’s assumption that one embarrassing moment will turn into them obsessing about your failure… is absolutely nonsensical, because the only person they are obsessing about is the main character to them, themself.

mikrl · 3 years ago
>nobody is thinking about you in a critical way, at the level that you are criticizing yourself

I think there are shades of this, which is to say the level of judgement can vary.

I feel that in a smaller city my social anxiety is not as strong as when I’m in a larger city.

In larger cities, I feel much more evaluated and judged ie eyes on me looking at my clothes, checking me out, etc despite being a much more detached and impersonal environment than smaller cities where I just feel ignored. Maybe it’s just more people around putting me more on edge.

Deleted Comment

user_7832 · 3 years ago
Thanks a lot for your comment! This part in particular

> the only person they are obsessing about is the main character to them, themself

seems obvious in retrospect.

psychomugs · 3 years ago
You’ll worry less about what people think about you when you realize how seldom they do.
sdwr · 3 years ago
This is the classic platitude. I don't buy it - I do judge other people like that.
jahnu · 3 years ago
Regarding #3, the following David Graeber quote always stuck with me:

“The ultimate, hidden truth of the world is that it is something that we make, and could just as easily make differently.”

tootie · 3 years ago
Sapiens by Harari covers this extensively. So much of human development is our ability to ascribe fictive boundaries and definitions to things. Rules, authorities, myths, money, culture, countries, companies. What are any of them? They're all made up. We could just stop believing in all of them tomorrow.
ricksunny · 3 years ago
+1 for the Graeber quote. I wasn't familiar with it but makes sense he would have originated it. Dovetailing that with this Ask HN theme: When you realize that bog-standard consumer loan amortization formulae are arbitrary and not grounded in any fundamental reality more detailed than "the lender gets something in addition to the amount lent", it's eye-opening. I didn't really recognize that until after reading his Debt: The First 5000 Years (yes, I'm familiar with the statement flaws that others have commented before about his works), but set against alternatives I learned about in business school, like zero-coupon bonds (special to corporates, bondholders, and banks) it put the standard loan amortization schedule into context.

Deleted Comment

vidanay · 3 years ago
#3 really hits home when you realize we have rules for killing each other (war). And we have separate legal trials to determine if someone broke those rules while trying to kill someone else. The penalty for breaking the rules about killing someone often is to be killed.
throwaway290 · 3 years ago
Probably most rules that we have are there to prevent us (admittedly this applies mostly to men) from killing each other.

That's why "rules are just constructs we humans created" rings stupid/horrifying. Obviously they were created by humans but that is also why they matter. I prefer "rules were written by humans, mostly in blood". It took years for OP to get the first part, here's to them getting the second part faster.

One doing something wrong to another would get families into an infinite loop of mutual revenge--until we got around precisely to create rules and put up a trusted authority to ensure justice without the need for vengeance. Rules is how our civilization functions and its only hope.

ClumsyPilot · 3 years ago
> 3 really hits home when you realize we have rules for killing each other (war

Those are some of the oldest and most important ones

nivethan · 3 years ago
2. Hits home for me as I’ve begun to realize the same thing. Not seeing any person of color in an activity makes it’s so I don’t want to be the first.
ShredKazoo · 3 years ago
As a white guy, I'd certainly encourage you not to worry about this -- if we're talking about an upper middle class, professional-ish activity, you can be fairly sure that all those white people feel self-conscious about their group being so white and would welcome you to join them.

Anyway, I'd be interested to hear more about the psychology of this.

I remember when I was growing up in the 90s and 00s in California, people talked about race way less than they do today. When ethnic representation became a common topic of conversation, I had a hard time believing it at first, because it seemed so self-evidently obvious to me that race wasn't a particularly important characteristic of a person. I actually had the experience of thinking back to my time in jr high/high school and thinking "wow, that friend of mine had dark skin, and they weren't from India... I guess they were Black, huh".

I'm not trying to claim that I didn't have subconscious biases related to race as a kid. I'm sure I did. But I do suspect they have become a lot more severe as a result of people talking about race so much -- it has become a much more salient characteristic. (I'm also more aware of trying to mitigate my biases and avoid microaggressions and so on, of course.)

So yeah, I'm curious to compare notes with other 90s kids in this regard. I'm white, but if I was Black, I imagine that I'd be way more self-conscious about it now than I was when I was growing up. (Like, if I'm the only white person in a group, I feel self-conscious about it now in a way that I didn't feel when I was a kid.)

jasonwatkinspdx · 3 years ago
Growing up this was a big realization for me the other way. I was raised by evangelicals in Kansas, including going to a mennonite school for most of my education. As a teenager I realized how at my school, at my church, at basically everything in my family's shared life, there was not a single person with brown skin. Not even one. And worse, no one had real awareness of this, and would not understand how it could be any sort of problem if you brought it up. To them it was just the natural order of the universe that their world was purely white people.

There's plenty of evangelicals of every race, but overall the communities are very segregated. It was clear no matter their professed faith, in practice the community I grew up in was hostile to PoC.

akira2501 · 3 years ago
> makes it’s so I don’t want to be the first.

This makes me curious. Would you mind answering, from your point of view, why do you think that is? Is it a specific scenario or type of scenario you wish to avoid or is there a generalized concern that comes with it? Is that due to uncertainty or past experience?

yieldcrv · 3 years ago
Similarly this gives me pause about Ivy League MBA programs.

Although a small sample size, despite their ambitions the BIPOC people I know haven’t been able to reap any professional benefits from it. Whether from access to executive roles, getting taken seriously by venture capital firms, or in their attempts to join venture capital firms. There is a level of discretion in these team forming situations that is not extended to them whether it has anything to do with their race or not, its pretty clear the upwards mobility is not coming from this credential.

For people with their own capital and leverage, it amplifies their ambition if they want. BIPOC don't really have this.

The “average salary” of MBA alumnis is not what is interesting about getting one, for me or them.

Some, or more, examples to the contrary would make it seem less like a total waste of time.

Deleted Comment

__turbobrew__ · 3 years ago
Are you willing to give some examples? I’m curious in what contexts people feel this way.
drevil-v2 · 3 years ago
Sounds like a good enough reason to mandate quotas for everything everywhere. Anything else on your wish list?
bcrosby95 · 3 years ago
I've noticed #2 with my 4 year old. She won't do anything unless there's a girl doing it. My other kids don't seem to care though.
PartiallyTyped · 3 years ago
There are some interesting studies about girls and women playing chess. When blind, the two sexes perform on average about the same, but when they know the gender of their opponent, girls and women underperform.

It is hypothesised that the reason behind this is because chess is a boys’ club, so to speak, and thus there is not a lot of representation.

Absence of representation means that it may seem that you are the only one doing XYZ, which in and of its own can be terrifying because we often feel that the odds are stacked against us (which is a self-fulfilling prophecy), or that we are held to much higher standards than others.

Personally, I enjoy seeing diverse representation even if I am not represented. I want people to not be afraid to pursue their dreams and goals, I don’t want implicit prejudices due to lack of representation either.

heavyset_go · 3 years ago
> 3. Rules in life are just constructs that we as humans have created.

> Starting a business helped the most on this one. That's when I started to see that "rules" or "procedure" are all made up and exceptions can always be made.

This is a big one that I learned through the same experience. Everything is arbitrary, the rules are made up and the points don't matter.

It made me appreciate those who recognize this, and in turn treat others well, even when shit hits the fan metaphorically, and I have absolutely zero tolerance for bullshit hoop jumping and assholes. I know you don't have to play by that book, so I won't, and I'm happier for it.

crackercrews · 3 years ago
Interesting interplay between 2 and 3. Why does representation matter so much if these are just human-created constructs? Genuinely interested to know how the same person had both of these epiphanies.
flippinburgers · 3 years ago
The most popular humanly constructed narrative these days in the US is that representation is everything so I tend to agree with your point. There is an interesting immediate clash between the two.
wood-porch · 3 years ago
A construct being human-created doesn't mean it isn't important, or that we can simply ignore it. Just means it can be changed, unlike a law of nature, for instance.
fortituded0002 · 3 years ago
Ha, interesting observation. They didn't happen at the same time. #2 followed by #3 much later.
whynaut · 3 years ago
why does debt matter so much? human-created construct
huijzer · 3 years ago
Point 3 also hit me a few months ago during a Dan Carlin’s Hardcore History podcast about Rome. Caesar got back from his conquests and half the senate wanted to punish him for crimes against humanity that he conducted during his wars. However, he also claimed massive amounts of land for Rome. Long story short: he wasn’t punished. And this happened 2000 years ago.
kristianp · 3 years ago
Napoleon wasn't roman. Do you mean a caesar?
bennysonething · 3 years ago
Did they actually care about crimes against humanity? I thought they were worried about the amount of power he had?
ragazzina · 3 years ago
> 1. Everyone is the main character in their own story.

Here is just one example of the total wrongness of something I tend to be automatically sure of: everything in my own immediate experience supports my deep belief that I am the absolute centre of the universe; the realest, most vivid and important person in existence. We rarely think about this sort of natural, basic self-centredness because it’s so socially repulsive. But it’s pretty much the same for all of us. It is our default setting, hard-wired into our boards at birth. Think about it: there is no experience you have had that you are not the absolute centre of. The world as you experience it is there in front of YOU or behind YOU, to the left or right of YOU, on YOUR TV or YOUR monitor. And so on. Other people’s thoughts and feelings have to be communicated to you somehow, but your own are so immediate, urgent, real.

David Foster Wallace

lamontcg · 3 years ago
> 3. Rules in life are just constructs that we as humans have created.

Corollary to this is that human rules aren't like programming rules and that the words that make up the rules get interpreted by a human.

One thing that this means is that you can't "hack" a human rule by picking the semantic meaning of a word which works best for you. You have to actually convince the arbiter of that rule that they agree with your meaning. If they don't, and they have a hundred years of legal ruling behind them that they've read and you haven't, then you're screwed.

And good human rules usually do have exceptions to them ("yelling fire in a crowded theater" being the most well understood). This is also why "the exception that proves the rule" is not a stupid saying.

And this is a feature and not a bug. The worst rules we generate are usually the ones that require the human arbiter to be rigid and mechanical. That tends to produce injustices like "three strikes you're out" and "mandatory minimum sentencing" (or any attempt to make the handball rule in soccer/football be objective and just winds up making it worse).

ssss11 · 3 years ago
To further your point 1, I think also “Everyone sees things through their perspective”.

So when you explain something, 10 people hear 10 slightly different things as their own experiences and biases, and even hopes, interpret your statement.

That’s why being able to communicate accurately, clearly, and concisely is a very difficult and important thing. If you can do it tailored to specific groups and with humour, bonus points.

atonse · 3 years ago
While I do see merit in the idea that representation matters, to me, it all depends on what representation in particular. Racial representation gets all the attention.

But for example, seeing that a philosophy major can have a successful computer science experience

bastawhiz · 3 years ago
I don't want to downplay the importance of diverse academic backgrounds, but representation of immutable characteristics (gender identity, race, disability, etc) usually get the most attention because they are essentially always the things that have impact on kids. Your little girl or your autistic child is going to pursue paths they maybe wouldn't otherwise take because of representation. The earlier you get a child to engage with something, the better their outcomes with pursuing it.

Representation is literally about people seeing themselves. If you can't nail down what "people like me" look like when it comes to representation, it might be that representation isn't quite the right way to frame the problem. It's only one aspect of diversity.

jackthetab · 3 years ago
Any suggested reading for #1 ("learn how to navigate \$THIS.")?
texuf · 3 years ago
It’s old and perhaps a little controversial, but “ NLP: The New Technology of Achievement” has good examples and abstractions that could help you with #1
quickthrower2 · 3 years ago
What does representation mean in this context?
chrisco255 · 3 years ago
For #2, I would alter this to say: connections matter.

We are more likely to pursue careers or interests if we know someone (and are friends with them or related to them) that is interested in the same thing or has had experience in the same thing.

fortituded0002 · 3 years ago
That doesn't ring true for me. I was already pursuing careers and interests that my friends were pursuing. That didn't change anything for me mostly because my friends came from a very different background than me. It also doesn't solve issues like my old boss who opted not to have children because she wanted to move up the corporate ladder at a FAANG company. She said that there was no mental model on how to navigate having kids at the company. All of the ones that did were men whose wives stayed home and took care of everything. She (and I) question if it's even possible to do it.

Your comment reminds me a bit of something I heard years ago from a manager at Facebook claiming that the way to solve imposter syndrome was to have people select which teams and projects they worked on because they would be more motivated to work at it. Totally off from what my experience had been, but likely applicable to some people.

However, I'm not saying you are wrong and I'm right. I think what's surfacing here is that what I posted doesn't apply to everyone and what you are saying doesn't apply to everyone either. It likely helps different types of people in different situations.

r4nd0mn3rd · 3 years ago
Please excuse the poor grammar, English isn't my first language. For #3, this rule always fascinated/confused me the most. How did us humans (animals formed from evolution/survival of the fittest) create these abstract 'rules' or fictions we all just collectively follow. Was there some sort of cumulation of ideas of the past woven into novel ones to make an archetypal epoch? Any insight/book recommendation to bridge this knowledge gap is much appreciated.
nine_k · 3 years ago
> because I just didn't see anyone like me there

To me, that would be the other way around: a chance to stand out and be one of a kind, act in a way nobody else had acted before, and reap the benefits of being unique, or the first at least.

(Seeing this as exciting or frightening probably depends on your level of sociopathy.)

fortituded0002 · 3 years ago
> To me, that would be the other way around: a chance to stand out and be one of a kind, act in a way nobody else had acted before, and reap the benefits of being unique, or the first at least

This is a great attitude to have. I know that not everyone has this ability (yet) to function this way, but it really should be the goal of how to operate.

For me, it took me years to get there. Variety of reasons, but I realized much later in life that I was still carrying around traumas of being targeted in public by random strangers at a young age just by being out in public (yes, just walking down the street). That sort of stuff can erode psychological safety that we bring with us and unknown situations can cause us to react rather than respond. This is one of the reasons I think representation matters. Not just that it creates a mental model of what's possible, but proof (hopefully) that it's also safe and allowed.

rajin444 · 3 years ago
> 2. Representation matters.

Strange, I had the opposite encounter. I realized the only thing keeping me from doing things was myself. There are definitely real barriers (hiring quotas, affirmative action, etc.) but without artificial constraints the only thing stopping you is you. You might feel a little uncomfortable but that's something easily overcome - and almost like a superpower when you realize you can overcome an external locus of control.

human_person · 3 years ago
Since you are referring to affirmative action and hiring quotas as “real barriers” I would guess that you haven’t really been in a situation where you the first/only person of your gender or race (etc) to do something. In that case (since you haven’t lacked representation) I’m not sure how well you can speak to its importance. But please correct me if im wrong.
fortituded0002 · 3 years ago
This is actually how it played out for me once I recognized it. I'm of the mindset now that I can jump in and do things. And I think you hit on one of the most important lessons that came out of it for me - the only thing stopping you is you.

With that said, some form of representation helped me greatly with it. It doesn't need to be an exact match, but for me it needed to be enough to make me break my assumptions and see whatever weird walls I had put up in my thinking.

enos_feedler · 3 years ago
I would tread carefully when saying any kind of discomfort is “easily overcome”. We are human beings after all and it’s a pretty generalized statement.

Being a white male but simply being unique in coming from a poor community in a poor city was enough for me to inflict a lot of unnecessary pain on myself through undergrad by seeing myself as different from the majority of elites in my program.

jasmer · 3 years ago
"without artificial constraints the only thing stopping you is you."

To be a plumber, yes.

To be a Doctor, kind of.

To be anything really competitive, not really, no.

There is a reason startup and regular CEO's are way over-represented from upper middle class families, and not ultra poor classes.

If you don't grow up playing Golf (expensive), it's highly unlikely you're going to the PGA.

For the poor kids to even fathom they could do something, they need to be exposed to the concept in a material way, on the whole. Obviously it's not always the case but representation 'is a thing'. And of course it can be way overstated in importance in many cases.

yieldcrv · 3 years ago
most of us here have our own drive, but I’ve come to appreciate that other people are inspired by seemingly superficial things

It clicked for me when I let my publicist go wild and she got me on listicles of BIPOC founders, before, we just had lots of quotes and interviews. Only people already interested in the project on its own merits were following along. After, there were lots of people that are interested in the representation in that kind of niche who otherwise just wouldn't know how to find that representation. Or just wouldn't be able to tell by founder names alone.

and of course we got the amplified engagement from people arguing about “why does race matter” in the LinkedIn comments. so shoutout to the useful idiots, publicists expect that to exist and calculate it.

SamoyedFurFluff · 3 years ago
Feeling uncomfortable is not what is a barrier. A barrier is an executive sexually harassing you to the point of suicide with no recourse. See: the blizzard fiasco. The riot fiasco. The Google fiasco. The Uber fiasco. Etc…

Deleted Comment

Deleted Comment

atonse · 3 years ago
While I do see merit in the idea that representation matters, to me, it all depends on what representation in particular. Racial representation gets all the attention but I find that one less compelling.

But for example, seeing that a philosophy major can have a successful programming career, can encourage others in the humanities to see themselves do it too.

Or seeing someone with ADHD run a business successfully and overcome executive function challenges, can also help others with ADHD.

fortituded0002 · 3 years ago
> Seeing that a philosophy major can have a successful programming career, can encourage others in the humanities to see themselves do it too. Or seeing someone with ADHD run a business successfully and overcome executive function challenges, can also help others with ADHD.

These are great call outs. The definition for representation can be highly nuanced and very personal. This is not to say that issues like race and gender aren't important and don't need support. Just that there are so many things that people bring to the table that can make them feel like "the other" which holds them back. It's surprising how lack of role models can lead some people to think it's not feasible or not even possible.

Deleted Comment

throwaway1777 · 3 years ago
#1 is a fallacy called main character syndrome
concordDance · 3 years ago
> 2. Representation matters.

As a well represented person I can tell you this has nothing to do with representation, its just that the vast majority of humans in the modern world have close to zero agency and/or don't think they can actually change things.

DrewADesign · 3 years ago
> As a well represented person I can tell you this has nothing to do with representation, its just that the vast majority of humans in the modern world have close to zero agency and/or don't think they can actually change things.

As a well-represented person, you're probably making assumptions about the effects of representation that are less informed than you realize.

machina_ex_deus · 3 years ago
Learning history / literature in school is important.

I was a total STEM math nerd in school. I used to frequently complain how I don't get what's the point of it, or how it's a waste of time and I'm learning nothing. I still think the emphasis of school was off, but I get the point of it now.

Stories are like code for humans. You can't tell someone what it means to be good or bad, or to give them a course in philosophy and they will become good people. But you can tell them a good story, that engages with them emotionally, and it will change their perception. And history shows that in fact, those stories being told and repeated aren't just interesting minor curiosity, but they have shaped the direction of humanity and they are driving it. A single person with a single story can change history in such a way that it would be completely different without it. And some stories about stories need to be told as a warning so that people will not fall for those kinds of stories again.

satvikpendem · 3 years ago
Regarding literature, I'll give an opposite opinion. Being forced to read the classics in school led me to not caring about them at all because I just couldn't relate at all, I had not had the requisite life experience for them to make an impact on me. Now, being an adult and having the life experience, reading them again makes me think more deeply and I can actually relate. So I think in school, we actually shouldn't read high literature lest we hate reading them as adults, which is really when they should be read, not before.
lumb63 · 3 years ago
Not only this, but also the impact having to read something has on enjoyment. There are books like To Kill A Mockingbird that I didn’t care for in high school simply because I had to read it. When I revisited it years later of my own volition, I enjoyed it greatly.
therealdrag0 · 3 years ago
The vast majority of adults read almost 0 books. I think there’s some value in forcing classic cultural capital when we can even if it’s lost on some.
josephcsible · 3 years ago
I agree in general, but for me it wasn't so much just having to read them as it was having to do a bunch of silly assignments based on them. My high school completely ruined The Great Gatsby for me that way.
abdullahkhalids · 3 years ago
I think most educators and teachers know that students won't get the classics. The goal is to at least make the students comfortable with the difficult language of the classics, and make them realize that analysis of these books yields deep insights.

If they instead taught students easier books in schools, student would never develop the reading skills to tackle the classics, and a much smaller percentage of adults would ever bother rereading the classics or even acknowledge their power.

Of course, the teaching has to be improved so that students never hate it.

9804 · 3 years ago
I think people come out of school hating reading because nobody likes being forced to read specific books, as everyone's tastes are different. It sounds like this might have been what happened to you.
machina_ex_deus · 3 years ago
I never hated reading, it's just that I didn't get the point of it. What are we even doing here and why?

What's the point? Math has clear purpose. I do enjoy some books. I just didn't get the point of studying them beyond reading. Why are they babbling about ? Is there any use for this information or is it just a torture in memorization? Why would I ever care about all these abstract literature terms?

Ironically they missed telling the meta story: why would anyone care about stories.

If stories are just something you read for fun, why would anyone care to teach me how to analyze them?

EDIT: To be clear, these were the questions that weren't answered back then.

Only now, years later with life experience the purpose is clear.

mabbo · 3 years ago
I completely agree with this. I loathed Shakespeare in school. Now I try to get a visit every year to the Stratford Festival (in Stratford, Canada) to see at least one or two Shakespearean plays.

I also remember reading 1984 on my own time in high school- it wasn't in the curriculum the year I might have. It blew me away. But if I'd been forced to read it, I probably would have been bored.

dehrmann · 3 years ago
My issue was the volume we were expected to read, or at least volume on top of books I wasn't interested in reading.
kamaal · 3 years ago
And exams.

Learning is one thing, being tested on facts and trivia is totally something else.

thewebcount · 3 years ago
I was fine with literature, but yeah, history, what a snooze-fest. Why do I care who fought what war 1,500 years ago and who won? It seemed like it mostly came down to a bunch of pompous elites having dick-measuring contests a lot of the time.

Then one day the teacher didn’t want to teach and instead showed an episode of Connections, and I was blown away. Learning about how and why our science and technology became what it is was something I could related to and seemed actually useful. I still don’t care for military history, though.

UncleMeat · 3 years ago
Even if there is no connection to our own time, history is one of the most effective teachers of the process of empathy out there. It requires you to be able to place yourself in another time, place, and context. I'll also note that military history and "elites having dick-measuring contests" is far from the trendy side of the last four or so decades of history research and writing. Cultural history, microhistory, and even history of science are all hot topics.
MichaelDickens · 3 years ago
> You can't tell someone what it means to be good or bad, or to give them a course in philosophy and they will become good people. But you can tell them a good story, that engages with them emotionally, and it will change their perception.

Is that actually true? Do we have good reason to believe that people who study history/literature behave more ethically?

chestervonwinch · 3 years ago
Additionally, I would say more historical emphasis within STEM itself would be beneficial. Motivate through context. Show students that the concepts arose from people solving problems.
Akronymus · 3 years ago
> Learning history / literature in school is important.

Really depends on HOW you learn it IME. If it's just regurgitating dates/names/whatever it isn't helpful at all, at least for me. If you establish that event x led to y because of z, it just clicks and suddenly makes sense.

For example, let's take hitlers rise to power: "He became the chancellor of germany in 1933" That is just about useless. "Hitler rose to power with the help of the nazi party, which was partially formed in response to the treaty of versailles' excessively harsh terms, leading to an extreme amount of inflation and a harsh drop in industry. This set the stage for hitler arguing to use a war as a means of getting rid of the penalties of versailles and bringing germany out from the slump"

For me, in school I was mostly taught the first variation.

UncleMeat · 3 years ago
This is true for literally everything you can possibly learn in school. You can learn math badly. You can learn physics badly. You can learn programming badly. You can learn personal finance badly. Professionals who work on history pedagogy work hard to prevent the sort of "memorize names and dates" approach. This shouldn't be considered a unique problem with history as a discipline.
thyrox · 3 years ago
The power of follow ups (especially in sales)

One thing which held me back for a very long time was not following up with people who didn't show much interest initially.

I wasted so many good leads thinking it is impolite to follow up with people after contacting them once. My whole life changed once I understood the power of follow ups and understanding that most people are so busy that it takes at least 6 reminders before most people will take any substantial action.

The reverse is also true. People say a lot of things and most of the times you never cross the bridge or reach it. Nowadays, I rarely argue about anything and don't act on stuff until a person reminds me once or twice. This small filter can be like a miracle for saving your time and energy.

satvikpendem · 3 years ago
Agreed. When I was doing sales, I would follow up with people seven times before they replied. I used to feel bad until I realized that it worked, then I just automated that part and didn't think about it further, the leads once they replied were sent to my CRM where I could then set them up on a call or some other action.
kuschku · 3 years ago
I've automated the opposite: three unsolicited mails, and I automatically send the sender's entire company to spam and reply with a friendly request to stop. Three more, and I send an automated cease and desist, threatening legal action (with receipt confirmation requested). If it still continues after that, I actually involve lawyers.

Most people are only willing to do something after repeated attempts because they're polite and want you to stop. If a website asks you whether you want cookies, you only click "yes" because the alternative is more work. If you constantly pester and threaten someone long enough, you'll always get a "yes" at some point. But that's not consent, which is why it's illegal.

Even if lawyers cost money, if I'm just expensive and stressful enough to stop people like you from sending even a single unsolicited message, it's worth it. Time is the most valuable resource we humans have, you've got no right to waste other people's.

cddotdotslash · 3 years ago
I block people on LinkedIn or report them as spam on Gmail if I get more than 3 unsolicited messages. 7 just feels borderline ridiculous.
philsnow · 3 years ago
This reminds me of the parable of the widow and the unjust judge from Luke 18, where the widow perseveres in asking the judge for a judgement in her favor and the judge eventually accedes because he's so tired of seeing her.

(The point of the parable, as I understand it, is not "One Weird Social Engineering Trick That Will Always Get You What You Want!!!11" but rather that we should persevere in prayer and petitions to God because, if even the unjust judge was eventually moved, how much more likely is our heavenly Father to grant us our heart's desire because he isn't unjust like the judge. This is an example of an "a fortiori" argument, https://en.wikipedia.org/wiki/Argumentum_a_fortiori , which are fairly common in scripture.)

opportune · 3 years ago
This comment makes my LinkedIn make a lot more sense
elorant · 3 years ago
How much time do you allow passing before each recontact?
aj7 · 3 years ago
You were not trained well.

The principal element in sales is asking for the order. Everything, and I mean everything, follows from that. If you had been trained this way, following up would be second nature.

zeroxp · 3 years ago
Some products dont fit well with a one call close and are centered around building long term relationships with your clients. This is especially true in b2b. Maybe you were trained too narrowly.
abdullahkhalids · 3 years ago
I am not trained at all in sales. Can you expand upon this?
geocrasher · 3 years ago
Narcissism.

My grandmother was a terrible narcissist. I loved her dearly and she had a lot of wonderful qualities, but The quality that stood out the most, sadly, was narcissism.

My mother was also a narcissist to a somewhat lesser degree. It didn't occur to me that I too was a narcissist until I was about 35 years old. It took waking up in the corner of the living room in my friends one bedroom apartment Early one morning to see it.

I had pushed away my wife and kids because in my mind all of my problems were their fault. I had blamed others for every thing that had ever happened to me or every feeling that I had felt. And in that moment I realized:

It's ME.

Everything changed in that instant. It was no longer just about me anymore. I stopped seeing the people closest to me as opponents and started seeing them as what they were, family. My support system. The love of my life.

As the years have gone by since then I have seen more of my past through that light and things have become so much more clear.

Understanding that my grandmother was a very damaged person who turned a narcissist to deal with it, then raise my mother similarly, help me understand two things. The first was that the things I blamed myself for in the past weren't my fault. Secondly, it helped me forgive them for some of the awful things that happened. I'm not saying it's okay to be a narcissist. But recognizing that their narcissism affected my life, and it was something that I could shed in my own personality was a serious life changer. And the funny part is that after I realized all of this, my debilitating depression essentially went away. And that was a big deal.

I also learned not even 2 years ago that I have ADHD which was like a light bulb moment for me as well because it explained so much of my life.

whimsicalism · 3 years ago
I find it interesting when people come from a long family line of narcissists (not uncommon) that they often attribute it to a cycle of being raised by a narcissist making you into a narcissist.

it seems more likely that there is a genetic/biological basis for this personality trait

zwkrt · 3 years ago
It’s possible but I don’t really buy it. There’s a very real sense in which narcissism is just a lack of acquired skills that most people have. That skill being the ability to see both the good things and the bad things about yourself and about others at the same time. If you’re raised in an environment where your caretaker teaches you they are always right (with severe consequences for pointing out they aren’t) then it is hard to develop a nuanced worldview. The child can either get on board with the parent, become “one of the good ones” and become a narcissist themselves or they can become a black sheep of the family, usually with worse outcomes.

Importantly, the skills can be learned as an adult it’s just hard to do. I come from a long lineage of family members who did not know how to swim, but I don’t think that there’s a genetic basis for this.

SebKba · 3 years ago
I think genetics are completely misunderstood. I also have serious Narcissism in my family and to me it very much looks like that's the world view you learn if that's how it's demonstrated to you as a small child. Small children have no filter on inputs also. If dad isn't around because mother is unbearable and she lives a narcissistic reality it becomes the water that you swim in. I don't think there is genetic code that determines that you think other people are to blame for everything!

Random theory: Children of narcissists like IT because it's a world that is very predictable with rational explanations.

chottocharaii · 3 years ago
or it could be a biological disposition to developing it as a response to the trauma of being raised by a narcissist
Balgair · 3 years ago
Hey! Glad to hear you're on a better path.

Thank you for sharing.

Please continue to contribute here on HN, I really appreciated your comment and experience.

geocrasher · 3 years ago
Thank you for your kind reply :)
runald · 3 years ago
It's interesting to read that you slowly shift the narrative from accepting your faults to making excuses to blame externalities, like inherited narcissism and ADHD. Look the word up, it's essentially an umbrella term that pretty much describes anything that can be considered negative, almost to the point that it's meaningless, except as a convenient tool to antagonize people. Selfishness and self-admiration is spectrum, everyone possess it one way or another. To claim otherwise is inhuman. Clearly, there are actual extreme narcissists, but they are not as frequent as people use the term loosely nowadays. Disclaimer: not a psychologist, but probably neither are you.
aexer0e · 3 years ago
I don't think he was trying to justify or excuse his way out of his bad qualities in the second part; It felt more like he was pinpointing the reason. I'd say it's okay for people to give reasons for bad actions as long as they they still admit to wrongdoing and don't use that reason as an excuse for it being okay.
alphydan · 3 years ago
> Look the word up, it's essentially an umbrella term that pretty much describes anything that can be considered negative

I suggest you look up the difference between the common sense of the word narcissism and the psychiatric diagnosis (which has a more rigorous and specific definition).

theptip · 3 years ago
Domain Driven Design. The book by Eric Evans lays out a bunch of concepts and as a developer that had not owned the architecture of a big domain, it was hard for me to see exactly where they fit. But after reading the book a couple times, and then encountering a few tricky domain modeling challenges, I started to see where these patterns add value. Also, as I started trying to describe the cohesive domain architecture of the system to a growing engineering organization, I also clicked on the advantage of having a standardized set of terminology for the problem, rather than inventing your own. It's nice to be able to link to an existing explanation of what a Repository is for, instead of having to name and document your own ad-hoc architectural patterns (or more likely, end up with you ad-hoc architecture being under-documented).

Things like Repositories, Aggregates, Bounded Contexts, and so on are going to be a net drag on your system if you only have a few 100 kloc of code in a monolith. But they really start to shine as you grow beyond that. Bounded Contexts in particular are a gem of an idea, so good that Uber re-discovered them in their microservices design: https://www.uber.com/blog/microservice-architecture/.

(Edited to clarify the book author)

eckza · 3 years ago
It's a solid book. I was chugging through it a bit at a time, until I discovered Scott Wlaschin's Domain Driven Design Made Functional. I've dropped the Evans book (as it's mired in mid-00's Enterprise Java patterns) and am enjoying this one quite a bit more.

Both books are great. Read whichever one aligns with your practice best.

I recommend Wlaschin's book for anyone curious about FP, without hesitation. He's great at explaining things from first principles, without veering off into "monad tutorial" territory.

https://pragprog.com/titles/swdddf/domain-modeling-made-func...

cpeterso · 3 years ago
Evan’s book is a bit of an academic slog, but I finally felt like I understood how object-oriented design should work.

An easier introduction I recommend is InfoQ’s “Domain Driven Design Quickly”, available in print or a free PDF ebook: https://www.infoq.com/minibooks/domain-driven-design-quickly...

theptip · 3 years ago
Thanks, I hadn't seen that book -- will give it a read. I'm interested to see how DDD gets applied to the functional programming paradigm, as it seems quite deeply ingrained in OOP to me.
bongobingo1 · 3 years ago
Is Wlaschins still reasonable (readable?) if you're not an F# developer (yet?) - but are familiar with FP generally?
feoren · 3 years ago
I had the exact opposite reaction to this book. It seemed like great stuff when I first read it, but over time, I realized it's really misguided in a lot of ways:

- Aggregates are too heavy. You need to make the decision about what is or is not an aggregate way too early in the design process. Boundaries are fuzzy.

- Actual concepts don't exist in nicely packaged bounded contexts. Concepts overlap a lot. You need to make the decision about which concept fits into which bounded context too early in the design process. Boundaries are fuzzy. Things are kinda like other things. The definition of "Employee" is not the same in the Scheduling context as the HR context as the Payroll context, yet they do overlap a lot, and you can't just treat them as completely separate things. If you break everything down into tiny contexts to deal with this, you just make Contexts and Aggregates the same.

- Repositories are not original to DDD and I think are very likely to foster absolutely horrific SELECT N+1 or even SELECT N^2 or N^3 performance. You simply can't let one bounded context do all its expensive operations in a vacuum; not when you have lots of contexts and lots of operations. In a complex system, most parts need to be planning, not doing. The results of most operations should be a plan that you can compose with other plans, analyze, and possibly even have an "optimization pass" if you need one.

- Ubiquitous language is the right idea. If you take nothing else from DDD, take this.

theptip · 3 years ago
Fair enough; YMMV.

I've not found that Aggregates need to be designed at the beginning; I've found it works fine to define an Aggregate after you start seeing performance issues with query patterns (i.e. define an Aggregate and forbid direct access to sub-objects when you see pathological access patterns/deadlocking).

Personally I've found Repositories to be a good way of enforcing that N+1 queries DO NOT happen. For example, in Django you can have the repository run select_related/prefetch_related and `django-seal` on the ORM query to forbid unexpected queries. This somewhat neuters the flexibility of the ORM, which can be a big cost, but lets you build much more restrictive queries that are guaranteed to perform well. It's a trade-off and I don't think it's a clear win for every use-case, but particularly when dealing with Aggregates I think having a limited number of ways to query is beneficial. (This might mean you're running some sub-optimal SQL queries, over-fetching etc., but for most line of business applications, that's actually a viable trade in exchange for simpler domain interfaces and protection against N+1 queries.)

Regarding "planning" vs. "doing", that seems to fit quite well with doing most of your work in POJO/POPO domain models, then only rendering those into DB writes at the edges. I think Repos can help with that. (IME you get N+1 selects when you use ORM models that abstract away the SQL queries and have application code interacting directly with ORM models; if you remove the ORM from your core domain logic and force it to live at the edges in Repos, this is not possible.)

scruple · 3 years ago
> Aggregates are too heavy. You need to make the decision about what is or is not an aggregate way too early in the design process. Boundaries are fuzzy.

I've had the exact same complaint. I think there's a lot of great stuff to take away from DDD -- I also hear myself frequently making the same point about it's ubiquitous language -- but going all-in on some of its concepts, especially early in a projects life, is probably always a mistake that may well end in disaster.

danielvaughn · 3 years ago
The terminology really turned me off because I found it difficult to comprehend. But I loved the idea of ubiquitous language and always meant to return to the book and give it another shot.
theptip · 3 years ago
Indeed, some of the names are just bad; "Anti Corruption Layer" is actually a quite useful concept for explicitly translating between concepts in different Bounded Contexts (do the translation explicitly at the edge so the mappings between BCs are explicit, instead of mixing terminology), but man I feel like something more snappy could have been used.
shortlived · 3 years ago
This is the book by Eric Evans?
theptip · 3 years ago
That's the one. (I edited in a clarification to my original post.)
rolenthedeep · 3 years ago
It took me an embarrassing amount of time to fully grok what object oriented programming really means. It's one thing to have someone tell you what an object is, but it's another thing entirely to build a fully object oriented system.

I remember what made it click: I was designing an animation system, which had a bunch of different interdependent moving parts. Once I started treating each part like an object and letting it manage its own state it all just clicked. I started with this massively complex functional-like system that managed four or five different motions, but once it was broken into objects most of the code just fell off and it became a nice clean system.

I was super proud of it at the time, but it's pretty bad by my current standards.

czx4f4bd · 3 years ago
I didn't fully grok OOP until I saw how composition and dynamic dispatch can be used in real code to create abstractions and flexibly swap out different implementations for your interfaces.

You could build a chatbot that supports Discord, Slack, and IRC dynamically at runtime, or a web app that can use multiple different database engines, or a social network with multiple types of posts that can all be rendered in a main feed, or a bunch of other things. In all of these cases you can also take advantage of this kind of dynamic dispatch to inject mock objects for testing, as well as theoretically have an easier time swapping out a layer if you want to change a dependency.

What really frustrates me is that almost none of the OOP instruction I've encountered ever showed these kinds of real, practical examples. They always over-emphasize harmful inheritance-based approaches and never really explain composition. In college we learned about OOP by building a little text-based RPG thing with different types of monsters implemented as subclasses of an abstract base class, which left me feeling like there wasn't much practical use for it outside of game development.

It wasn't until my first internship that I saw a real-world use of OOP, in the form of a giant Spring Boot monolith with tons of dependency injection. Eventually, after staring at that for a few months, OOP finally clicked for me, but I still find it annoying that nobody ever tried explaining this using practical, small-scale examples.

abraae · 3 years ago
> What really frustrates me is that almost none of the OOP instruction I've encountered ever showed these kinds of real, practical examples. They always over-emphasize harmful inheritance-based approaches and never really explain composition.

So true. The canonical example used by OO pundits is often a "Person". A Person can be either a Contractor or an Employee (inheritance).

Having spent a lifetime in HR systems, there really couldn't be a worse example. It turns out that people may become contractors or employees, and then change back again, leaving the company and then returning. Some people may even hold the role of contractor and employee contemporaneously. Any crazy shit is true for humans. Instead of using simple OO classes to model people, IRL you end up with many, many tables that capture their lifecycle.

Good OO candidates/examples are usually non real worl things. Window managers and windows. Progamming concepts. That kind of thing, where the rules are simple and point in time.

PaulStatezny · 3 years ago
> I didn't fully grok OOP until I saw how composition and dynamic dispatch can be used in real code to create abstractions and flexibly swap out different implementations for your interfaces.

> You could build a chatbot that supports Discord, Slack, and IRC dynamically at runtime...

As a counter-point, OOP isn't necessary for dynamic dispatch.

None of these dynamic features you describe are necessarily any harder in non-OOP languages — or easier in OOP languages.

You can do the same kind of dynamic dispatch in Elixir, Go, etc.

OOP really is a preference, not a differentiator.

Source: I cut my teeth on OOP and used it for many years. Been using Elixir for the last half a decade, and have zero loss of ability to do things like this.

hnick · 3 years ago
For me, the issue was that OOP in an academic context was always toy examples. OK, Dog and Cat are Animal that can MakeNoise, Eat, and HaveFur (except sometimes not). Yeah, I get it. It's a ridiculous amount of boilerplate compared to just throwing some functions in and getting it done.

The issue was that anything they taught had to be dumbed down to the point to fit in a classroom and they basically stopped there. We also never wrote code that would be looked at by more than one person. I didn't "get it" until I spent years in a real job, with systems complex enough for this to matter, and practical examples like Dependency Inversion etc as you say. There was also a complete lack of Composition and (at the time I did it) multiple-inheritance which is a bit more controversial these days.

Our traditional Comp Sci course also worked on a variety of languages but nearly zero UI or web programming back then, which are both natural fits for OOP that we largely ignored.

mekster · 3 years ago
Examples totally do suck.

A class Animal is inherited by Dog class that barks. That's like the total opposite of what any practical example can be and people confuse how that's even useful.

moloch-hai · 3 years ago
You don't really understand OOP until you recognize it as one style among many that you may use in different parts of each program. Some parts are naturally OO-y, others DD-y, others declarative, often an unholy mix in each place. The problem dictates elements of the solution. Shoehorning a solution into a particular style makes a bad solution.

Never forget who is in charge. Deferring to a style dodges responsibility for your choices.

hnick · 3 years ago
Perl's approach to OOP has flaws but it being generally "data structures you already know but with some magic and functions attached" helped me understand it on a more fundamental level. It greatly supports the mix-and-match approach you mention here.
ShredKazoo · 3 years ago
DD?
opportune · 3 years ago
My first job was doing mostly Lego-pieces greenfield development. I learned a lot, but also didn’t learn as much as in my second job where I started having to work with a much more complicated, slightly “legacy” system with a big codebase.

At small code sizes, OO does not really have any apparent advantages to doing everything imperatively or in a hacky way. In fact I’d argue it tends to overly complicate and obfuscate things. But there is a point at which you really start wanting OO instead because you can no longer reason about the binary as a whole, and need to start thinking in terms of interfaces with separation of concerns. Even if you did understand the whole state, there are too many people working on it to keep up with changes to the whole state in a way that lets you reason about the thing as a whole.

At my first job (and in college) code never reached such levels of complexity so OO always seemed like some dumb fad to make things more complicated than necessary. I still that is often the case, but now I absolutely see the benefits when they present themselves.

voidhorse · 3 years ago
I doubt you're the only one, and I actually feel that a lot of people that find themselves having to program in an OOP language don't really understand OOP fully or what its motivations are. I personally don't think it's possible to really grok OOP without first understanding the motivations for its origins and how it compares to doing everything in a purely imperative fashion. The best way to actually understand its purpose (and flaws) is to implement an OOP system in an imperative language (e.g. implement a basic OOP class system in C, etc.)

It's common for a lot of online resources (I don't know about university) to provide introductions to programming using OOP, which I think is a terrible mistake. It fills beginners' heads with all sorts of incorrect, fanciful ideas about how computers work and what happens when a program is executed. It's also difficult to know how to use OOP concepts and structures correctly without knowing why they're convenient. I strongly believe you need a good understanding of the technical motivations for such constructs before you can actually use them with good effect--otherwise you're simply relying on imitating patterns or taking certain things as foundational when in fact they are not. I think functional languages and strictly imperative languages are far more appropriate for a first programming language.

rolenthedeep · 3 years ago
Very much agreed. My main problem with school was being told "how" and not "why".

If I were to teach programming, I'd start with straight up assembly. Give people a taste of what the cpu is actually doing under all your abstractions. Probably a few weeks, enough for hello world, fibonacci numbers, and an intro to branching. Then introduce C, get used to pointers and basic high-level language concepts. Really hammer in the idea of thinking like the CPU and being mindful of the resources you're using.

From there, guide them towards building a real application in imperative C or C++. After that the overarching theme is rewriting the application in an object oriented language, with attention to why and when you should and shouldn't use these new tools.

IMO, understanding the fundamentals of how a cpu works is absolutely essential for writing good code at any level of abstraction, and it seems a lot of new programmers are missing that.

analog31 · 3 years ago
I read the earliest articles on OO and SmallTalk in Byte Magazine, which IIRC would have been the early 80s. OOP was totally and utterly bewildering to me, a BASIC and Pascal programmer.

It "clicked" much later, in two stages, using languages that were "kind of like" OOP, even if not rigorously so: LabVIEW, HyperCard, Visual Basic. I think VB had a decent strategy for introducing OO to the rest of us. Out of the box, it was "object based," meaning that you could use classes that had been created by someone else. For a bit more money you could buy the version that let you do full OO, but I never did that. But by being a user of objects, it gave you an idea of what you'd want if you could create them for yourself.

Nowadays of course people range from being bullish to bearish on OO, and I've had the experience of doing it badly and making a mess of things, when a procedural or functional model would probably be better.

Kind of a lesser issue is that I finally grasped how to work with a modern OS after laying my hands on the first couple volumes of the Win32 programmer's manuals, which I think were vastly less forbidding than Inside Macintosh.

layer8 · 3 years ago
> the first couple volumes of the Win32 programmer's manuals

What books exactly are you referring to here?

zabzonk · 3 years ago
I've always found OO programming completely natural. n fact, it's the only kind of programming i've ever really done - create a structure with data members, and then create functions to work on that structure. you can (and should) do this in low-level languages such as C and assembler.

Of course, if you want to go the whole polymorphic route, i'd suggest using something like c++, but the key ideas are really structures, and functions that operate on those structures.

opportune · 3 years ago
As someone who started programming in BASIC, OO is a really good way to think about stuff (it introduces the abstraction of “conjoined data” that is typed and has functions) but it was not natural. It just feels natural now that I’ve spent so long in school and at work dealing with OO languages. I imagine if you had started with BASIC you’d feel the same
intelVISA · 3 years ago
I really struggle outside OO paradigms as well. Having classes is such a useful framework to organize how data is stored, operated on, and moved around.

The hardest bit is knowing when to stop, aiming for the RAII sweetspot in C++ is the goal not AbstractBeanFactoryFactoryBuilder().

sureglymop · 3 years ago
I've always had a hard time because I was thinking.. why would I carry the performance hit of instantiating objects for a bunch of stuff?
xigoi · 3 years ago
If the functions are not built into the objects, that's not object-oriented programming.
gurchik · 3 years ago
When I was younger I had a lot of trouble with OOP. It probably didn’t help that my two strongest languages at the time (PHP and Python) allow you to use them fully iteratively if you want. For some reason I never found an explanation that focused on state. A lot of the examples I saw I remember thinking it made a lot more sense to just rewrite the functions so they aren’t part of a class.

I still frequently see code examples online that are written using classes that don’t need to be. I imagine this is the reverse problem: people from languages like Java thinking everything has to be in a class.

kevinmchugh · 3 years ago
Yes, looking back I was shocked to realize how little my oop education and work had talked about state
rileyphone · 3 years ago
I had a similar shift in perspective recently, that went from viewing objects from the outside as things to be manipulated, to viewing them from within as independent entities with boundaries. What made it click for me was watching Alan Kay talks and reading “Object Thinking” by David West. Now, I think the idea is due for some sort of renaissance. Though the culture of programming has turned against it in favor of FP, OOP continues to underlie the most important languages, organizations, and products in a way that speaks to its ultimate potential: to build evolvable, growable, maintainable software systems in service of human flourishing.
AndyNemmity · 3 years ago
This one is the same for me. I'm not even sure I still totally get it.

It feels like something used an awful lot in ways that don't really add any value. But again, it must just be my lack of understanding. Maybe one of these days it'll click in.

rolenthedeep · 3 years ago
In my animation system, I had a laser beam projecting from a fixed point to a movable point in space. There are also sprites which travel up and down the beam.

Moving the beam endpoint required an animation to bring the width to 0, change the endpoint, then ramp the beam width back up. The sprites each have their own animation in different conditions, and moving them along the beam is another animation.

The real key for me was the sprites. I built a class which takes in the start and end points of the beam and an update method. Once you start the sprite up, you just have to poke it every frame with the time delta and it manages all of its own animations.

Likewise, the laser itself was an object that managed its own animations and the sprites related to it.

This resulted in a bunch of objects with just a little code in them. But because the concerns are separated, it results in less code overall than it would take to manage everything all at once.

Is this the best, or even a good way to do this? Probably not, but it was a very beautiful solution in the moment

ipnon · 3 years ago
An object is a function closed over its variable default arguments.
bsuvc · 3 years ago
Unit testing and using dependency injection to write test-able code.

I'm not sure if it was years, but it wasn't immediate. I just didn't understand why dependency injection was good at first, and not just someone's weird personal code style choice.

I thought it was just people being "Enterprisey" which I'd encountered many times over the years.

Once I committed to unit testing, I realized how necessary it is.

Unfortunately I still encounter customers who haven't bought into it and as a result have untestable code. It's so hard to go back and retrofit testing.

closeparen · 3 years ago
Seven years into my career I'm increasingly convinced that the emperor has no clothes with respect to unit tests that are just transcripts of the code under test with "mock.EXPECT()" prepended to everything - 95% by volume of the unit test code I've ever read, written, or maintained.
grogenaut · 3 years ago
I call those lockdown tests and they're a smell. You don't want to dictate the implementation, just the inputs and outputs. The former leads to very brittle code, the latter describes and validates the contract. It's also important where you put the logic of the test in the code base when you have multiple layers. This latter part is harder and system dependent.

In many cases mocks are now over used where previously they were important in say 2008. Especially now with languages that support functions as objects, better generics, and other features which weren't common a while back. Likewise frameworks are and languages are generally way more testable now which means you're doing less backflips like static injecting wrappers for DateTime.now into libraries to make tests work. This further allows more contract and less implementation specific testing.

As with most things there is a lot of nuance/art to doing it well and smoothly

sanderjd · 3 years ago
Yep, I think mocks are mostly a smell. The "functional core" of a module should be entirely or almost entirely unit testable with (possibly fake) dependencies passed in. The glue code ("imperative shell") should be tested at a higher level - "integration" or "end to end" or whatever you want to call it - which looks at the externally observable effects of running the code (database changes or API responses or whatever) rather than the details of its execution.
Izkata · 3 years ago
I think my favorite of these was a function that called 4 other functions and didn't do anything else, its unit test mocked out all 4 other functions and asserted that each was called.
bsuvc · 3 years ago
Yeah, the mere presence of unit tests is not enough. It has to actually assert something useful.

When I code review, I try to make sure I call out "fake tests".

lamontcg · 3 years ago
I keep looking for a reason to write software using a proper DI container framework. In talking to Java devs most of them just mention injecting mocks for your database. You don't really need a full DI container for that you could use a service locator instead or some even lighter DI pattern. If you have that particular hammer though and know how to use it, then it becomes easy to achieve and use config to inject your backend.

But that's a long way from glorious full DI containers where you never call 'new' in your code anywhere and all object creation can be dictated by config. I suspect that must be only the kind of thing that people who maintain 1,000,000 line codebases that are at the center of massive bureaucracies.

mrfox321 · 3 years ago
At my bigco, there's no service-level DI (c++)

Just vanilla C++ classes, and virtual interfaces if we need to mock things for unit tests.

No automatic wiring of the hierarchy.

jjice · 3 years ago
The thing that made it really click with me was the quote (two whom I'm not sure it belongs to) that is roughly "code to abstractions/interfaces, not implementation".

The idea that I take advantage of good abstractions and I send those objects into my classes that need to perform actions via those abstractions made a lot of sense. Helps enable good polymorphism, as well as unit testing and other things.

I don't think I'm doing it justice, but the idea took a good while to understand there reasons behind it. Some books that helped me grok the idea were

- Patterns of Enterprise Application Architecture - Clean Architecture - Architecture Patterns with Python

along with running into problems that could be easily solved with a decent abstraction at work and learning to apply it directly.

number6 · 3 years ago
Can you explain the concept? I feel I didn't grok it fully
niklasd · 3 years ago
I found this explanation very helpful: https://hakibenita.com/python-dependency-injection (if you program in Python)
ericlewis · 3 years ago
Not sure about poster above, but I found a large amount of value in writing tests when developing API backends. I knew the shapes and potential data. Was easier to write tests to confirm endpoints looked right than manually hit the api endpoints.
Traubenfuchs · 3 years ago
I‘ll add to that: the difference between "offline" unit testing and spring integrarion testing with test containers and real application contexts + all the related concepts like @SpyBean, @Mock, @MockBean...

I always hated testing and I still do, but every time I commit to doing it right I catch so many errors before QA.

everybodyknows · 3 years ago
> dependency injection

The term is unfamiliar to me -- is it related to "fault injection"?

azeemba · 3 years ago
Let's say Class A depends on Class B. A lot of people have the instincts to have A construct B so that the callers of A don't have to worry about it.

But this makes testing A in isolation difficult. When testing A, you want to mock out B with an instance the test can manipulate.

So we want A to not create B, instead we want B to be "injected" into A. The general strategy of having B passed into A is called dependcy injection.

itronitron · 3 years ago
Dependency injection is one of those technical terms that are made up to describe something that has been done for decades but with a new name because the creators of the new term don't have much experience and/or they want to gain notoriety for creating a new programming technique.

If you've ever written a constructor for a class that has arguments (within the constructor signature) that are used by the instance of the class when instantiated then you have done dependency injection, or put more simply 'passing stuff in' which was eloquently stated in another comment on this thread.

rozap · 3 years ago
People would have way fewer opinions on it if it was just called "passing stuff in"
ngc248 · 3 years ago
It is a pattern where you inject the dependencies of a class into it rather than create the instances of the dependencies within the class. for more info --> https://en.wikipedia.org/wiki/Dependency_injection

it makes the code cleaner and testable.

k__ · 3 years ago
The idea of DI is that you creat resources indirectly, and don't call the named constructor in your code. You then use interface types to interact with the resource.

This way, your code isn't bound to a specific implementation.

Some DI frameworks even go so far and define all resources in a config file. This way you can switch out the implementation without a recompilation.

la_fayette · 3 years ago
No it is a design pattern to structure code. It is also known as the hollywood principle (don't call us, we call you). Meaning that dependencies of a class are provided from the outside, the class itself doesn't know how to create instances of dependencies, just relys on the dependency container (also named inversion of control)...
gavinray · 3 years ago
Going to steal a description I wrote for a blogpost several years ago, when I had recently understood DI for the first time so it was very fresh in my mind:

https://hasura.io/blog/build-fullstack-apps-nestjs-hasura-gr...

Dependency Injection solves the problem of when you want to create something, but THAT something also needs OTHER somethings, and so on.

In this example, think about a car.

A car might have many separate parts it needs:

  class Car {
    constructor(wheels: Wheels) {}
  }

  class Wheels {
    constructor(tires: Tires) {}
  }

  class Tires {
    constructor(rims: Rims, treads: Treads)
  }

  class Rims {
    constructor() {}
  }

  class Treads {
    constructor() {}
  }
We can manually construct a car, like:

  const car = new Car(new Wheels(new Tires(new Rims(), new Treads())))
But this is tedious and fragile, and it makes it hard to be modular.

With dependency injection, it allows you to register a sort of "automatic" system for constructing an instance of "new Foo()", that continues down the chain and fetches each piece.

  class NeedsACar {
    constructor(@Inject private car: Car) {}
  }
And then "class Car" would have an "@Inject" in it's "constructor", and so on down the chain.

When you write tests, you can swap out which instance of the "@Injected" class is provided (the "Dependency") much easier.

okino · 3 years ago
Good series about the approach from a functional perspective https://fsharpforfunandprofit.com/posts/dependencies/

Deleted Comment

dymk · 3 years ago
You'd do fault injection by injecting dependencies that respond with / throw faults.
Simon_O_Rourke · 3 years ago
I think the poster is referring to Guice or something similar - that there's a framework which selects which instantiated runtime object gets injected as a dependent into another, thereby automatically "figuring out" what object needs to get instantiated first, and then next etc.
rr808 · 3 years ago
Agreed, this has taken me years. It also is tough because lots of people over use it IMHO. When the logic keeps bouncing around dozens of classes its too hard to follow, even if its easy to test.
groundcoffee · 3 years ago
+1 to this. It doesn't help that some dependency injection frameworks' (ahem, looking at you Dagger2) error messages can be convoluted and hard to understand.
monero-xmr · 3 years ago
Another solution is to eliminate classes and only use structs or similar plain objects. Makes mocking and testing functions much easier. At this point I see no reason for OOP whatsoever and consider it a big mistake.
optymizer · 3 years ago
Getting rid of data abstraction and encapsulation is throwing the baby with the bath water.

The abstract concept of OOP (messages between complex objects, as defined by Alan Kay) is an attempt at mimicking biological systems. Most modern languages implement data abstraction, but call it OOP, where they encapsulate some functionality with the data it operates on. Really helped with varying data formats in the AirForce in the 60s, apparently. There isn't anything wrong with this abstract concept either - it's a way of structuring a solution, with trade-offs.

Support for unit testing and mocking has little to do with OOP, and everything to do with the underling platform. Both C++ and Java, for example, do not have a special runtime mode where arbitrary replacement of code or data could occur. This is necessary for mocking functionality that is considered implementation detail and hidden by design. The hidden part is great for production code, not great for testing.

For example, if an object in java has a field like 'private final HttpClient client = new CurlBasedHttpClient();' this code is essentially untestable because there is no way in Java to tell the JVM "during testing, when this class instantiates an HttpClient, use my MockHttpClient".

Kotlin fixed some of that with MockK, which can mock the constructor of a Kotlin object, and you can return your mock implementation when the constructor is invoked.

Clearly, it's a platform issue. There could be a world where you could replace any object in the stdlib or any method or field with a mock version. JavaScript is much more flexible in that regard, which is why unit testing js code is much easier.

The root of it all stems from the fact that unit tests need to change some implementation details of the world around the object, but production code should not be able to, in order to get all the benefits of encapsulation.

If you get rid of modern OOP, you are swinging the pendulum in the opposite direction, where your tests are easy to write on any platform, because everything is open and easily accessible, but your code will suffer from issues that creep up when structures are open and easily accessible, such as increased coupling and reduced cohesion.

sanderjd · 3 years ago
This seems totally orthogonal to me.

Using a totally non-OOP functional style, you can either instantiate state within a function or pass it in from the calling context, which is the same trade-off that dependency injection targets.

adlpz · 3 years ago
I agree with OOP not being needed at all, but I don't agree on this being an alternative to dependency injection.

However you structure it, there will always be "glue code" that ties the nice inmutable code with the outside-interacting bits, and if you want to unit test those, dependency injection (with functions or state, not classes or instances) is still the way to go.

alpaca128 · 3 years ago
OOP tends to encourage thinking in more abstract ways than is often necessary imho. I feel like learning a language with only structs had a positive effect on my coding ability (as someone who more or less started with Java).

The few times I had to use Java afterwards I felt the same - all OOP features were unnecessary or at least didn't feel like the most straightforward approach. Nowadays I never use classes in Python, JS etc., it's just not needed - and in the case of Python it makes JSON insanely cumbersome.

Deleted Comment

a_c · 3 years ago
People never change because of YOU. This applies to work, relationship and family.

It made me click about the saying that science advances one funeral at a time. It is easier to rally people of similar thought than to change people of opposite opinion. Not impossible, just more difficult. It explains a lot of thing in my opinion.

1. It is easier to start a start up than to convince your boss to take a certain product direction. E.g to not pursue certain pursuit, as outlined by John carmack's departure from meta. The ultimate judgement will be whether YOUR idea survive rather than whether your boss buy your idea. And I prefer bootstrap, at least for now, for that reason.

2. Never attempt to change your spouse. Find the common ground instead.

3. Empathy is mostly about experience sharing. You can't have people feel something they never experience before. If you can empathize, it means you have experience to draw similarity between. Imagine teaching a 18yo to be a father, that's how preaching people to be empathetic felt like.

fritzo · 3 years ago
Yes, that resonates. But how do people change? Through their own rude awakenings? When they contrast their own selected peer group with other teams?
a_c · 3 years ago
"Change" is manifestation of idea. If you have the idea that sleeping 8 hours a day is beneficial, you are very likely to act like it.

Imo, ideas form within the spectrum of indoctrination and "epiphany".

Indoctrination is something that you hear over and over, and sort of taking it as granted. Parent to children, school to students, religion to devotees, government to citizen, social media to general public, hackernews to us developers, all impart their flavors to our mind and we act according to it. Take sleeping for example, sleep well, sleep long enough, sleep early shouldn't elicit much debate, we treat it as truth more of less. On the other hand, dietary cholesterol consumption, which is considered, advertised and indoctrinated as bad for more than 5 decades has now garnered some attention to consider otherwise [1][2][3]

Epiphany is circumstantial, event driven. Either you have a lightbulb moment, or reality decides to slap you in the face. Having a close friend/relative die at a young age will either makes you treasure life a lot more, or send you into deep depression. But it will change you forever for sure. On the other hand, again taking sleeping as an example, I have been a night person since teenage, habitually sleeping at 3am, 4am, feeling drowsy in the morning and study/work in the late evening. "I prefer working in silence" is the excuse I gave to the then self. One day it dawn on me that there are only 24 hours a day, if I can get things done in 1am before sleep, I can equally get things done in 6am after sleep. And if I can rest well, I can get things done quicker. No new information just one day I viscerally feel that shifting the biological clock earlier makes more.

1. https://en.wikipedia.org/wiki/Ancel_Keys

2. https://en.wikipedia.org/wiki/Seven_Countries_Study

3. https://en.wikipedia.org/wiki/Robert_Lustig

marcosdumay · 3 years ago
People change due to their own concepts that take a while to click.

You can have an impact there. But you can't cause immediate change.

a_c · 3 years ago
btw, I think my comment is just a different take to fortituded0002's comment "Everyone is the main character in their own story." https://news.ycombinator.com/item?id=34209966
H8crilA · 3 years ago
Reminds me of "managing unmotivated people is hard, so don't".