HNHacker News
TopNewBestAskShowJobs

mollerhoj

121 karma · joined March 19, 2013

meet.hn/city/55.6867243,12.5700724/Copenhagen
submissionscomments
mollerhoj··on If not React, then what?
Have you ever worked on a project that used Rails, Laravel, Django or Spring? Without being a SPA? For many (most) websites, I find that these are far superior to client side heavy SPAs with json apis (react, vue etc).
mollerhoj··on Denmark will plant 1B trees and convert 10% of farmland into forest
Growing x100 times the amount of food needed isn’t ‘slack’, its production for export (or feeding pigs to export). We could cut out farmland by 50% and still have more than enough to feed our own population. This food security argument would only hold if there was any possibility of us actually not being able to feed our population.
mollerhoj··on Denmark will plant 1B trees and convert 10% of farmland into forest
Sounds like you’ve fallen for some farmer rhetoric.. How is growning crops to feed 28 million pigs to 6 million people? We’d have to eat 5 pigs each.. If it was really about food security, we’d surely plant crops to eat ourselves, which is much more efficient in terms of calorie per m^2.

Meat has many more negative externalities than plants. Thats the argument for substituting green farming.

Of course it’s political.. anything is to some degree.

mollerhoj··on Denmark to charge $100 per cow in first carbon tax on farming
It isn’t necessary usagligt to argue that the new policy will be ineffectual, and that its just political posturing. However, its not position that either side here in DK holds. Both sides agrees thats its a major reform. You're making a novel claim here.

Given how politics works, its unsurprising that the legislation isn’t completely consistent with other DK policies. The public opinion on nuclear has changed in recent years - maybe we’ll see some changes here soon.

mollerhoj··on Denmark to charge $100 per cow in first carbon tax on farming
We’ve been debating this “green new deal” in Denmark for months. While we have our share of disinformation and bad arguments from political interest groups and confused individuals, it’s pretty eye opening to see how “usaglig”[0] the debate in this thread is. Our political scene is not perfect, but man are we in a much better place here than the US (I assume its the US bias of this site that make even slightly political discussions here so.. difficult)

Here in Denmark, both sides have to make somewhat reasonable somewhat fact-based arguments if they don’t wanna lose face.

[0] we even have a word for whether a debate/argument is ‘high quality’ or not, its either saglig (reasonable) or usaglig (unreasonable)

mollerhoj··on Denmark to charge $100 per cow in first carbon tax on farming
Everything has tradeoffs. This is legislation to try and reduce emissions from co2 and methane. It was suggested by a group of expects in the relevant fields, and our politicians went with it. Growing vegetables obviously has less negative climate impact than beef.
mollerhoj··on Denmark to charge $100 per cow in first carbon tax on farming
I find this a strange claim. 1: Are people living on milk? Never heard of that diet except for infants. 2: Many things are both cheaper and more nutritious, see https://efficiencyiseverything.com/calorie-per-dollar-list/
mollerhoj··on Denmark to charge $100 per cow in first carbon tax on farming
Same, did not expect this from HN. Even the farmers interest group here in Denmark don’t spew this much misinformation..
mollerhoj··on OpenAI researchers warned board of AI breakthrough ahead of CEO ouster
Pet theory: Could it be some bio hacking/disease construction thing they have discovered? I know nothing of the subject (which is probably why it seem a possibility to me) but what if they have discovered something to that makes engineering pandemics significantly easier?
mollerhoj··on GameMaker to be free for non-commercial purposes and have one-time fee license
I made superslimesoccer.io with game maker back in the day, still going strong with 1000s of daily visitors
mollerhoj··on Great Male Renunciation
In most species, males are more colorful than females - since they are the ones during the attraction. Our culture seem to have flipped this logic somehow
mollerhoj··on Htmx is part of the GitHub Accelerator
Same path for me here. In particular, I found unpolys codebase to be of higher quality.
mollerhoj··on Ask HN: Where do I get a headset for my big head
I should have mentioned this, but the noise canceling part is the sole reason for me actually wearing headphones. I wear earplugs+headphones in an attempt to focus in an open office.
mollerhoj··on Building a Lox Interpreter in Julia
I really wish Bob would write a “Crafting Type Checkers” sequel.
mollerhoj··on Ask HN: Can someone ELI5 transformers and the “Attention is all we need” paper?
No, thats incorrect. The connections are automatically deduced from the training data (which is just vast amounts of raw text).
mollerhoj··on React is holding me hostage
Interesting, how are you drawing graphics? Skia?
mollerhoj··on Apple Silicon Mac’s have 2-3 times longer battery than PC laptops
Off topic, but do you happen to use kiba etl? I've also done a lot of etl for rails apps, and kiba is just great
mollerhoj··on Multiple assertions are fine in a unit test
rspec or minitest? ;-) Could rspecs 'expect change' idiom be the difference?

I find that reducing assertions per spec where I can a good guideline. E.g. combining expect(foo['a']).to eq(1) and expect(foo['b']).to eq(2) into expect(foo).to include('a' => 1, 'b' => 2) yields better error messages.

mollerhoj··on Multiple assertions are fine in a unit test
Heh yeah but it can be used to write tests that check your assumptions about a 3 party api. Granted, It'll only fail once the test are rerun without the cache, but it can still be a valuable technique. It can be valuable to have a testsuite that a) helps check assumptions when implementing the connection and b) helps locate what part of it later starts to behave unexpectedly.
mollerhoj··on Multiple assertions are fine in a unit test
Yes, you got us rubyists there. :-( Its the unfortunate result of trying to avoid premature optimization and strive for clarity instead. Something thats usually sound advice.

Enginnering decisions have tradeoffs. When the testsuite becomes too slow, it might be time to reconsider those tradeoffs.

Usually though, I find that to road to fast tests is to reduce/remove slow things (almost always some form of IO) not to combine 10 small tests into one big.

mollerhoj··on Multiple assertions are fine in a unit test
When you say I 'forgot' an assertion, are you implying that test should include all possible assertions on the code? That would perhaps cover more surface, but my goal (read zealot ideology) here is to have the tests help document the code:

test "pressing d key makes mario move 2 pixels right" {

expect { keyboard.d() }.to change { mario.x }.by(2)

}

I could test the value of the d() function, but I dont because I don't care what it returns.

Didnt understand the "whole story invocation" and exception part, am I missing some context?

Sure property-based testing can be invaluable in many situations. Only downside is if the tests become so complex to reason about that bugs become more likely in the tests than the implemenation.

I've sometimes made tests with a manual list of inputs and a list of expected outputs for each. I'd still call that 1 assertion tests (just run multiple times), so my definition of 1 assertion might too broad..

mollerhoj··on Multiple assertions are fine in a unit test
Please correct me if I'm wrong, but would a precondtion not just be the postcondition of the setup?

Invariants would either have to be publically available and thus easily testable with similar methods, or, one would have to use assertions in the implemention.

I try to avoid the latter, as it mixes implemations and 'test/invariants'. Granted, there are situations (usually in code that implements something very 'algorithm'-ish) where inline assertions are so useful that it would be silly to avoid them. (But implementing algos from scratch is rare in commercial code)

mollerhoj··on Multiple assertions are fine in a unit test
There are usually different ways to design a system. Its often the case that designing the system such that it is easy to test (with little setup/teardown) has other benefits too. E.g. It often indicates low coupling and a more simple design.

That being said, there can of course me other tradeoffs e.g. performance and even cases where simple test setups are downright impossible.

mollerhoj··on Multiple assertions are fine in a unit test
OP asked how any state change would be tested with a single 'assertion' and I provided an answer. Absolute rules are stupid, but our codebase has just short of 10k tests, and very few have more than one assertion.

The only reason I can really see to have more than one assertion would be to avoid having to run the setup/teardown multiple times. However, its usually a desirable goal to write code that require little setup/teardown to test anyways because that comes with other benefits. Again, it might not be practical or even possible, but that goes of almost all programming "rules"..

mollerhoj··on Multiple assertions are fine in a unit test
I believe theres a rubocop that checks for it:

https://docs.rubocop.org/rubocop-minitest/cops_minitest.html...

mollerhoj··on Multiple assertions are fine in a unit test
Hopefully the responses are stored locally and replayed on subsequent runs.
mollerhoj··on Multiple assertions are fine in a unit test
To answer your question: We zealots test for the fact that something changes to some degree. E.g with rubys rspec library:

expect { foo.call() }.to change { bar.value }.by(2)

That is, regardless of the absolute value of bar.value, I expect foo.call() to increment it by 2.

The point of the 1 assertion per test guideline is to end up with tests that are more focused. Giving that you did not seem to think of the above technique, I'd say that this guideline might just have helped you discover a way to write better specs ;-)

Guidelines (that is, not rules) are of course allowed to be broken if you have a good reason to do so. But not knowing about common idioms is not a good reason.

You might argue that the above code is just sugar for 2 assertions, but thats beside the point: The test is more focused, there -appears- to be only one assertion, and thats what matters.

mollerhoj··on Vim After 15 Years (2017)
I recently setup neovim with lsp, fzf and like 10 plugins in pure lua. I was surprised that it took me just a few hours. I've spent too much time fighting viml in the past and it kept me from looking at the config for like 3 years. But holy f, things have gotten soo much better. Lua for vim is.. actually good. Like I grok the apis.

I know what its like to be burnt but messing with config, but man I cannot recommend kitty + neovim highly enough. It's absolutely AMAZING.

mollerhoj··on Ask HN: How to do the bare minimum when not valued at work?
Depends in where you live ;-) The chance of running into people again here in the Copenhagen tech scene is > 50%
mollerhoj··on Denmark not offering second Covid booster shot to healthy adults under 50
This does not seem to get much attention from the media here in Denmark.. Probably because it's just not very newsworthy, just common sense policy.. Why is it on the frontpage of HN?
← PreviousPage 2 of 3Next →