HNHacker News
TopNewBestAskShowJobs

_a_a_a_

1,221 karma · joined December 8, 2022

submissionscomments
_a_a_a_··on Good refactoring vs. bad refactoring
Testability is a good one, thanks. I'm not so sure about performance and I'll chew that one over for now.
_a_a_a_··on Good refactoring vs. bad refactoring
I'm going to disagree and see what other people say.

I don't think that reduction of size is of any relevance. I admit my own refractors tend to make things smaller but it's only a tendency. Most definitely some increase the size overall. I'm currently refactoring a code base – for each item there used to be one class. Each object was examined after creation then a runtime flag was set: Rejected or Accepted. As the code crew I found I was wasting a lot of time around this Accepted/Rejected stuff. Now I'm refactoring so I have two classes for each item, one for when it's Accepted and one for when it's Rejected. The amount of boilerplate has definitely bulked up the code but it will be worth it.

As for complexity, I don't know.

The only thing I refactor for is human comprehensibility. That is the final goal. What other goal can there be?

_a_a_a_··on Good refactoring vs. bad refactoring
For consistency, the same design problems should have the same design solutions a.k.a. pattern. If you don't value consistency, feel free to take a different approach every time. That will confuse your users. I used to work with a guy, the simple problem of reading a CSV was done using a library, problem sorted. Out of sheer excitement he then rewrote it was with combinator parsers, then as some astronaut architect functional monstrosity, so complex no one else could comprehend it.

This is how not to do it – for same problem, use same solution. I admit that's an extreme case but it's also a real one and illustrates the issue well.

(also patterns are not specific to OO, nor is OO incompatible with a functional style)

_a_a_a_··on Ask HN: Determine sound quality of a file, objectively?
Answers here show HN at its finest.
_a_a_a_··on A wonderful coincidence or an expected connection: why π² ≈ g
No probs, and yes I certainly learnt something important, thanks.
_a_a_a_··on A wonderful coincidence or an expected connection: why π² ≈ g
"This definition of π implicitly makes use of flat (Euclidean) geometry; although the notion of a circle can be extended to any curve (non-Euclidean) geometry, these new circles will no longer satisfy the formula π = C / d"

https://en.wikipedia.org/wiki/Pi

_a_a_a_··on Things I Won't Work With: Dimethylcadmium (2013)
Well played indeed, but from wiki https://en.wikipedia.org/wiki/Tetrahydrofuran "Odor: Ether-like".

As a side note, ether is a lovely smell diluted but inhaled concentrated (for recreational purposes – it's a bit like alcohol in effect) it's bloody brutal, burning your nose & lungs.

(They used to be sweets in the UK called Victory V's which contained a very small amount of ether, and they were just lush. Bought some recently and found whatever additives that was had been removed, oh woe :) )

_a_a_a_··on Pursuits That Can't Scale
WHOAH!? Tell us more, please!! (My fave short was Continued on Next Rock, I just wish I had time to reread his novels).
_a_a_a_··on A wonderful coincidence or an expected connection: why π² ≈ g
Ur being rather snotty about this. I've just realised something important which is so obvious to you that you consider it trivial, but it's not. I realised something important today, you might just want to feel pleased for me, and a bit pleased that the world is a little less ignorant today...? Or not?
_a_a_a_··on Ray Tracing Harmonic Functions
yeah, love it too
_a_a_a_··on Ray Tracing Harmonic Functions
'graphics' yes, but 'nice' would be nice because they often aren't.
_a_a_a_··on A wonderful coincidence or an expected connection: why π² ≈ g
I don't agree, I thought what he said was very interesting. It never occurred to me that pi might vary, and over a non-flat space I can see what they're saying. I think it's intrinsically interesting simply because it breaks one of my preconceptions, that pi is a constant. Talking about it being 'not very useful' just seems far too casually dismissive.
_a_a_a_··on Pursuits That Can't Scale
But what else should one do with wealth? Take Elon Musk... Oh, he makes flying, firebreathing, spacegoing dragons with his money.
_a_a_a_··on Pursuits That Can't Scale
+1 for mention of Lafferty. His is a strange status indeed, a kind of well-known obscurity, or great fame writ small. Maybe he's more a writer's writer.
_a_a_a_··on A heck of a wild bug chase
A book is always a good start.
_a_a_a_··on Cats appear to grieve death of fellow pets – even dogs, study finds
Oh, ok, thanks. Interesting.
_a_a_a_··on Cats appear to grieve death of fellow pets – even dogs, study finds
That's unfair. "I very much doubt…" Is a statement of his opinion and not fact.
_a_a_a_··on Cats appear to grieve death of fellow pets – even dogs, study finds
Not a down voter but

> I very much doubt cats understand the concept of death and can "grieve,"

My guess is someone disagrees with both of these claims. To be fair, your doubting that they can grieve is a bit ambiguous – of course they can grieve but whether they can grieve over a death, assumes they understand death as distinct from 'where have they gone?'.

_a_a_a_··on Making your own hot sauce
Okay, in light of recent UK events I get the subtext :-)

But I don't think it's fair to call UK food bland. Done properly it's very good, but what it's not (usually) is heavily seasoned. In no way does that require it to be tasteless, and done properly it isn't.

_a_a_a_··on Uncovered Euripides fragments are 'kind of a big deal'
Yeah, I thought that was a direction too. Slightly over thinking it.
_a_a_a_··on Uncovered Euripides fragments are 'kind of a big deal'
Essplain? Am lost.
_a_a_a_··on Tomato nostalgia as I relive my Croatian island childhood
Was going to say the same. Tomatoes vary hugely in many aspects; you can't really talk about a 'tomato', they're so different.

(anyone tasted a potato fruit? Toxic and like little green tomatoes, but I wonder at their taste)

_a_a_a_··on Uncovered Euripides fragments are 'kind of a big deal'
"Money can't buy you love but it lets you rent it by the hour" – Max Headroom (from memory)
_a_a_a_··on Making your own hot sauce
Is known in a wider area eg. ajver in Turkey. It's okay, the texture can be a bit glooey sometimes. (Sidenote: in Turkish they have different words for heat from temperature and heat from hot peppers - anyone chip in here?)

On heat tolerance, do some genetic thing where people get one, two or three receptors[1] which give different sensitivity to different people. I had a GF who would struggle with the level of capsaicin I literally wouldn't even notice. I knew a guy who would snack on scotch bonnet peppers straight, which would be impossibly agonising for me.

[1] from memory, doubtless incorrect as well

_a_a_a_··on Cortex A73's Not-So-Infinite Reordering Capacity
err, any refs for that? I really doubt it but could well be wrong. I'm not aware of any mainstream arch that can/could do that, that I can think of.
_a_a_a_··on Counting bytes faster than you'd think possible
Oops, buffered of course, you're right.
_a_a_a_··on Seam Carving (2018)
DDG disagrees.

https://html.duckduckgo.com/html?q=%22%20heuristic%20dynamic...

I'm clearly not going to understand your motivation so I think I'll stop here.

(edit: There is absolutely nothing stopping heuristics and DP being combined; in fact they have to be in eg. database optimisation. A pure DP solution to query optimisation will be optimal, but will take unbounded (lthough finite) time, which is unacceptable. DP and heuristics are combined to both guide the DP search and bound it after a strict time (usually a couple of seconds CPU) by when it is hopefully 'good enough').

_a_a_a_··on Seam Carving (2018)
"BLAST is a heuristic method which means that it is a dynamic programming algorithm..."

https://bioinformaticsreview.com/20210503/how-blast-works-co...

"The heart of many well-known programs is a dynamic programming algorithm, or a fast approximation of one, including sequence database search programs like BLAST..."

https://www.nature.com/articles/nbt0704-909

_a_a_a_··on Counting bytes faster than you'd think possible
Bit rusty here but what if you replaced

    if (*file_lo == 127) {
        ++count;
with

    count += (*file_lo == 127);
That might save you the occasional branch mis-prediction, and might possibly open up some hardware-level loop optimisations. Any difference?
_a_a_a_··on Counting bytes faster than you'd think possible
"The solution presented here is ~550x faster than the following naive program."

   ... std::cin >> v; ...
Oh come on! That's I/O for every item, I'm surprised it's not even slower.
← PreviousPage 2 of 34Next →