Hacker News new | ask | show | jobs
by capableweb 920 days ago
I can't speak for the Python part (which another commentator also already did comment on), but I don't think the React part is anything to highlight as "code you should try to imitate".

I just did a quick look, but it seems to suffer from common problems lots of UIs suffer from. Zero tests (unless I missed where they are located), even for things that doesn't even touch the DOM (like the "helpers"). Components filled with heavy logic at instead of being cleanly separated out. Just two examples after a quick 5 minute browse.

That said, I've definitely seen worse codebases and this wouldn't be too hard to work on in a professional setting. Clearly it works for them, and they seem to be progressing, which is good enough. But again, wouldn't flag it as "exceptional" either which you seemed to have done here.

1 comments

IMHO UI tests are just too difficult to be worth bothering with in most situations.

Maybe AI will change that. But for now I think dev time is generally better invested in other ways of making code work properly, or just fixing bugs that have already been reported.

I know that sounds heretical.

> IMHO UI tests are just too difficult to be worth bothering with in most situations.

Yes, that's because you're doing them wrong.

Don't mess around with the "golden master" testing (edit: seems the frontend ecosystem call that "Snapshot Testing" actually, but it's the same) you see bunch of projects do, that compare the old DOM vs the new DOM you accept/deny changes based on component render output. That's a waste of time and won't actually prevent bugs.

Instead, extract the logic-heavy parts out from your components, then put those under unit tests, like any other code you write.

Boom, easy to maintain, verifies your implementation and makes your UI easier and faster to refactor and build in the first place.

But then those are by definition not UI tests.

In an ideal world one might argue that everything testing-worthy (ie. the logic-heavy parts) is already factored out from the UI components but getting to that point either needs a good amount of foresight and discipline or some a lot of refactoring which is difficult to trust without existing UI tests...