Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
hynek
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
8 ms
·
1.
▲
by
hynek
1y ago
The fancy word for that is Vertical Slice Architecture btw and it's the only way for complex apps that doesn't end in chaos.
2.
▲
by
hynek
1y ago
Yes, because it's showing how the simplest-possible mock already gets ugly if you don't follow the advice. Making the example more complicated would dilute the point it's making. The question of "when to mock" is ve
3.
▲
by
hynek
1y ago
> I’m not sure this is good advice. I prefer to test as much of the stack as possible. The most common mistake I see these days is people testing too much in isolation, which leads to a false sense of safety. You make it sounds as if the
4.
▲
by
hynek
1y ago
Pretty good, except it’s not Bismarck but Fontane. ;) Also, I’m comparing myself to CGP Grey, not whatever it’s transcribed. :D
5.
▲
by
hynek
1y ago
ha, I wish I saw that while working on that talk! adding it to the resources!
6.
▲
by
hynek
1y ago
Shouldn't some AI be able to clean that up for you? This seems something LLMs should be well-suited for. --- FWIW, I'm the speaker and let me be honest with you: I'm super unmotivated to write nowadays. In the past, my usual
7.
▲
by
hynek
1y ago
that's a reference to my attrs library which is what data classes are based on. It originally used @attr.s class C: x = attr.ib() as its main api (with `attr.attrs` and `attr.attrib` as serious business aliases so
8.
▲
by
hynek
2y ago
Both PDM and Poetry are a) 90% solutions that only cover what their respective authors need (and this is indeed what Python is drowning in) and b) written in Python which makes them slow and somewhat janky since Python installations and vir
9.
▲
by
hynek
2y ago
That is inaccurate. Both Rye and uv have the same goals and support virtualenvs. uv is meant to supplant Rye eventually (it mostly already has: see also this post by the creator of Rye: < https://lucumr.pocoo.org/2024/
10.
▲
by
hynek
2y ago
It’s much, much faster both in creating virtualenvs and installing the dependencies. And if you use lock/sync, you get a cross-platform lockfile that you only got with PDM and Poetry before – no more requirements.txt (but it supports i
11.
▲
by
hynek
3y ago
The burpee exercise is named after the US physiologist Royal Huddleston Burpee Sr. I know y’all want to fact-check this – I sure did when I heard it the first time: https://en.wikipedia.org/wiki/Burpee_(exercise)
12.
▲
by
hynek
3y ago
I guess PEP 703 has to be auto-accepted now. I don't make the rules.
13.
▲
by
hynek
4y ago
Conceptually, Cython is mainly for accelerating Python code, and can _also_ access C code. Meanwhile CFFI is specifically for calling C code and nothing else. I recommend the video for the differences. One concrete thing that pops to my min
14.
▲
by
hynek
4y ago
Right, but that would take some really deep patching of code I don't control, just so it works in development. If this were a production issue, I would probably fork the driver and do what you're suggesting (it's not like it&
15.
▲
by
hynek
4y ago
You mean at the Python driver level? Unfortunately, that doesn't work with ctypes. I've tried it by adding the DYLD_LIBRARY_PATH to os.environ before calling ctypes.LibraryLoader.LoadLibrary ( https://docs.python.org
16.
▲
by
hynek
4y ago
That doesn't help you if there's a surprise call to /bin/sh or /bin/bash somewhere in the call stack. Keep reading, I know it's long but I tried to make it comprehensive. :)
17.
▲
by
hynek
4y ago
They did (it's me :)) and unfortunately in this case rpath can't be used, because that particular Python driver uses ctypes ( https://docs.python.org/3/library/ctypes.html ) to open the binary drivers whic
18.
▲
by
hynek
4y ago
Heh sorry I put the date there in the draft phase because I planned for publishing on Tuesday. It got done earlier and I pushed it out in a bit of a hurry because I was leaving and forgot to update the date. I have fixed it.
19.
▲
by
hynek
4y ago
I’m aware of all the problems that e2e tests have, and yet I find it more useful to have 1 test that adds something to a basket and 1 test that removes it than 100 unit tests without contract tests (which I never got the hang of TBH). (To b
20.
▲
by
hynek
4y ago
No, it doesn’t pass over that. It specifically points out that it’s a simplistic example for illustration that probably wouldn’t be worth it. And yet the effects are visible and so are the problems/solutions. I mean what do you want he
21.
▲
by
hynek
4y ago
I’m sorry I’ve apparently misunderstood your point. I guess I’ve never seen too brass imparting more than a big picture “we’re writing tests now”.
22.
▲
by
hynek
4y ago
I know you’re being facetious but: the lesson is rather that mocking generic third-party APIs is so easy, that you can end up in mocking hell real fast. And that you should take the harder route for your future sanity.
23.
▲
by
hynek
4y ago
One of the reasons I wrote the linked article is that the wisdom around is quite fragmented and one (there’s always more than one) frustrating answer is good design makes software testable: “the deep synergy between testability and good des
24.
▲
by
hynek
4y ago
Cue Mock Hell https://www.youtube.com/watch?v=CdKaZ7boiZ4 :)
25.
▲
by
hynek
4y ago
I can assure you that it is possible and meaningful to have full code coverage in certain contexts (for instance for important projects that get only rarely touched) and doesn’t inevitably lead to bad test suites. Railing against code cover
26.
▲
by
hynek
4y ago
FWIW I’m a former senior-less junior that programmed himself into a hole. My blog and conference talks are exactly the material that I’d loved to have had ~10 years ago. Not sure if I’d have been smart enough to take my advice though. ;)
27.
▲
by
hynek
4y ago
> You don't need to build a facade for every api client (the api client is already a facade). I feel like this is covered by > Every rule and principle can be broken once you’ve fully understood its purpose. For example if an obj
28.
▲
by
hynek
4y ago
I put the disclaimer there, because I was afraid people would stop reading and start arguing about mocks vs fakes vs etc. But you’re right, people skip the lede (mentions counter-intuitive, I hoped that set the mood) and lose patience, so I
29.
▲
by
hynek
4y ago
Being a gatekeeper from unit testing is the last thing I aspire to be, but past me (and that’s my imaginary audience) would’ve loved this explanation before he got some projects into mocking hell. I’m the first to say that if you have no te
30.
▲
by
hynek
4y ago
I’m my experience, you get most of that kind of coverage with integration test/user story tests/however-you-call-them. Solutions like vcr aren’t bullet-proof either and are a variation of in-process servers that the article mentio
More ›