Live data from Hacker News

I coded something dumb and I'm proud of it

plbrault.com

51–60 of 88 posts

Re: I coded something dumb and I'm proud of it

#51
It's honestly one of the hardest things for me, trying to explain to more junior developers that clever almost is never better. Does anyone have any good litmus or heuristic for figuring out when something is "too" clever?

I was thinking of a way to quantify "complexity" in a process by a sort of "reference counting" style metric, where the moment you have to reference some other location to figure something out, you add 1 to a number and if that number gets above some figure, it's too complex.

Re: I coded something dumb and I'm proud of it

#52
post #33
post #27

Another way to describe what has been done: implement a pure function and avoid storing additional state. It sounds way less dumb that way. It is not really a pure function but the spirit is here. I've done the same during a refactoring of a side-project recently. It handles the input/output to a MIDI controller with many buttons, knobs and matching LEDs. Instead of computing what LED should change at regular interva…

This is how React works, or at least the illusion it presents to the developer. Where it goes awry and gets complicated is that web developers want to modify the input state directly within the same functions that produce the output state, and they also want to trigger side effects after the output state has been completed, requiring another pass. I’ve built a React variant for video compositing. Since it renders at…

This is roughly The Elm Architecture https://en.wikipedia.org/wiki/Elm_(programming_language)#The...

Re: I coded something dumb and I'm proud of it

#53

this is an evil take but i think emojis are massively, massively underrated for use in signaling information (and massively overused in git readmes) A grimacing emoji when a process is thrashing, a fire emoji when it's eating CPU, a sweating smile emoji when the process is running longer than expected, etc etc etc. It sounds dystopian in a way but also useful - neat seeing them used here!

Personally, I disagree. I'm probably in the minority, but emojis don't helot me much when conveying information and I see them more as visual clutter that makes it difficult to distinguish what's going on. This is especially the case when there are a lot of emojis (or other icons for that matter) instead of text, e.g. in menus. It makes it much harder for me to distill the information and it takes me longer to grok w…

Not to mention, they don't translate well to spoken word and are not easy to type on a keyboard either. "Why is svchost panting sweating red emoji CPU usage" is as stupid as it sounds.

Re: I coded something dumb and I'm proud of it

#54
This is kind of fun.

A random nit as we like:

> I needed to somehow create a function that performs a single step of the algorithm, then gives back control to the main loop (which ironically sounds just like an OS' preemptive scheduling)

That sounds more like cooperative scheduling, no?

Re: I coded something dumb and I'm proud of it

#55

this is an evil take but i think emojis are massively, massively underrated for use in signaling information (and massively overused in git readmes) A grimacing emoji when a process is thrashing, a fire emoji when it's eating CPU, a sweating smile emoji when the process is running longer than expected, etc etc etc. It sounds dystopian in a way but also useful - neat seeing them used here!

cdparanoia used to use ASCII emoticons as status indicators -- :-) for when things were going well for instance.

Re: I coded something dumb and I'm proud of it

#56

this is an evil take but i think emojis are massively, massively underrated for use in signaling information (and massively overused in git readmes) A grimacing emoji when a process is thrashing, a fire emoji when it's eating CPU, a sweating smile emoji when the process is running longer than expected, etc etc etc. It sounds dystopian in a way but also useful - neat seeing them used here!

You’ll love to learn more about Chernoff faces! https://en.wikipedia.org/wiki/Chernoff_face

Re: I coded something dumb and I'm proud of it

#57
post #33

Earlier quoted context omitted.

This is how React works, or at least the illusion it presents to the developer. Where it goes awry and gets complicated is that web developers want to modify the input state directly within the same functions that produce the output state, and they also want to trigger side effects after the output state has been completed, requiring another pass. I’ve built a React variant for video compositing. Since it renders at…

I've also struggled with React's insistence on immutability. What if mutability was the only way to update state? I implemented a JSX-powered react-alike that explored the concept[1]. To my lack of surprise, I found the resulting environment easier to get stuff done in. I'm not subjecting my employer to this, but I would totally use this on a solo project that I had to support. [1] https://github.com/tomtheisen/mutra…

This is awesome. Thanks for making it.

Re: I coded something dumb and I'm proud of it

#58

Earlier quoted context omitted.

Because the animation needs to pretend to use something more efficient.

Ironically the particulars of this implementation make it much less efficient than a dumb bubble sort. Many Quicksort implementations have the worst performance on already sorted data, and in this case it will be run a lot on data that is already mostly sorted. It won't matter here because the data size is always trivially tiny, but it is something to consider in the real world.

There's also the overhead of quicksort compared to bubblesort, making it a poor choice for tiny sets of data.

In this case I understand the author's point is to have something visually interesting to show the work being done.

Re: I coded something dumb and I'm proud of it

#59

It's honestly one of the hardest things for me, trying to explain to more junior developers that clever almost is never better. Does anyone have any good litmus or heuristic for figuring out when something is "too" clever? I was thinking of a way to quantify "complexity" in a process by a sort of "reference counting" style metric, where the moment you have to reference some other location to figure something out, you…

If I don't understand something I wrote a month later, it was too clever.

Unfortunately, this is a massively lagging indicator.

Re: I coded something dumb and I'm proud of it

#60
post #33
post #27

Another way to describe what has been done: implement a pure function and avoid storing additional state. It sounds way less dumb that way. It is not really a pure function but the spirit is here. I've done the same during a refactoring of a side-project recently. It handles the input/output to a MIDI controller with many buttons, knobs and matching LEDs. Instead of computing what LED should change at regular interva…

This is how React works, or at least the illusion it presents to the developer. Where it goes awry and gets complicated is that web developers want to modify the input state directly within the same functions that produce the output state, and they also want to trigger side effects after the output state has been completed, requiring another pass. I’ve built a React variant for video compositing. Since it renders at…

IMO react made way more sense when it was used only as the view layer. What react really needed was a separate paradigm for business logic. Having a state machine tied into react is really interesting to me though I haven't seen many try it, and I personally don't use react often enough to give it a go.

React's render loop, and even JSX itself, makes plenty of sense when the data is just fed in and rendered. It falls apart really quickly when data is being changed from inside a component rather than must firing events, leaving us with a decade worth of duct tape trying to find a solution that works long term.

Post reply on HN