Live data from Hacker News

The Grug Brained Developer (2022)

grugbrain.dev

81–90 of 603 posts

Re: The Grug Brained Developer (2022)

#81

Earlier quoted context omitted.

htmx sucks: https://htmx.org/essays/htmx-sucks/

So it is bad?

Definitely for some stuff!

https://htmx.org/essays/when-to-use-hypermedia/

https://htmx.org/essays/#on-the-other-hand

Re: The Grug Brained Developer (2022)

#83
post #45

This has by far the best discussion of the visitor pattern I've yet to come across.

I don't work in typical OO codebases, so I wasn't aware of what the visitor pattern even is. But there's an _excellent_ book about building an interpreter (and vm) "crafting interpreters". It has a section where it uses the visitor pattern. https://craftinginterpreters.com/representing-code.html#the-... I remember reading through it and not understanding why it had to be this complicated and then just used a tagged u…

As far as I understand it, the limited circumstances when you absolutely need the visitor pattern are when you have type erasure, i.e., can't use a tagged union or its equivalent? In that case visitors are AIUI a very clever trick to use vtables or whatever to get back to your concrete types! but ... clever tricks make grug angry.

Re: The Grug Brained Developer (2022)

#86
post #58

Earlier quoted context omitted.

How does someone know twenty C++ developers and zero C developers though?

Born in the 80s.

That wouldn't stop someone from knowing any C developers. It's still a common language today, and was more common when those 80s kids would have become adults and entered the industry.

Re: The Grug Brained Developer (2022)

#87
post #45

Earlier quoted context omitted.

I don't work in typical OO codebases, so I wasn't aware of what the visitor pattern even is. But there's an _excellent_ book about building an interpreter (and vm) "crafting interpreters". It has a section where it uses the visitor pattern. https://craftinginterpreters.com/representing-code.html#the-... I remember reading through it and not understanding why it had to be this complicated and then just used a tagged u…

It's an engineering tradeoff. https://prog2.de/book/sec-java-expr-problem.html - Not the writeup I was looking for but seems to cover it well. > Why burden ourselves with indirection and complexity when there's a more straight forward way? Because each way has its own tradeoffs that make it more or less difficult to use in particular circumstances. https://homepages.inf.ed.ac.uk/wadler/papers/expression/expr... - Wad…

Thank you for those links. The first one is especially clear.

However, this is just not something that I typically perceive as a problem. For example in the book that I mentioned above, I didn't feel the need to use it at all. I just added the fields or the functions that were required.

In the first link you provided, the OCaml code seems to use unions as well (I don't know the language). I assume OCaml checks for exhaustive matching, so it seems extremely straight forward to extend this code.

On the other hand I have absolutely no issues with a big switch case in a more simple language. I just had a look at the code I wrote quite a while ago and it looks fine.

Re: The Grug Brained Developer (2022)

#89

Earlier quoted context omitted.

Born in the 80s.

That wouldn't stop someone from knowing any C developers. It's still a common language today, and was more common when those 80s kids would have become adults and entered the industry.

Maybe they use only Microsoft Windows?
Post reply on HN