Better HN
topnewbestaskshowjobs
Log inSign up

nathan_long

4,485 karma · joined Jun 1, 2012 (14y ago) · 1,146 submissions

Submissions

comment 7y ago · link · parent

Poor reliability is a theme in IoT, self-driving cars, and here.

We are all accustomed to the fact that computers are flakey. Our computers and phones sometimes need rebooting to fix weird behavior. My printer just forgot how to connect to WiFi for no apparent reason. Everyone has stories like these.

What's tolerable for many popular products is not tolerable for others, though. Leaving aside whether having a gun actually protects you, people own guns for that reason. If your gun won't fire when your life is in danger, or if your car won't swerve when a truck is in the road, or if your thermostat won't turn on when it's bitterly cold, that's unacceptable.

Clearly there exists highly reliable technology: plane and spaceship controls, for example. My understanding is that an extreme focus and expenditure on reliability is required to achieve that.

I think that some of these consumer product categories where it's critical that the thing actually work will require the same kind of rigor before people can trust them.

comment 7y ago · link · parent

> since electronic elections are not verifiable in any meaningful way

As I once saw someone point out here, the crucial thing is that they be verifiable by the average person.

Imagine a technically perfect electronic voting system, immune to tampering, preserving anonymity, etc. It's provably perfect - but only to the handful people who can understand the proof.

Average people could not have confidence in such a system, so it undermines democracy. (This may also be a barrier to using vote counting systems better but more complex than "first past the post" unless they can be explained clearly.)

"Put your paper ballot in that bin everyone can see and we'll all count them together at the end of the day" is a process that anyone can see is legitimate. So that's what we should do.

comment 7y ago · link · parent

People may say alarming things while practicing their lines for a play, too. You can probably think of other plausible reasons. But Amazon workers can't know the context.

If Amazon workers hear something that sounds like a situation the cops should intervene in, they're in a tough situation. Not calling the cops could mean letting someone die. Calling the cops could embarrass someone or, somewhat less likely but possible, get someone killed because the situation unintentionally escalates.

Calling the cops definitely draws attention to the fact that Amazon was listening in the first place, which I would argue is a good thing and which Amazon would really like you to forget.

My feeling is that for the sake of the workers' humanity, they should be allowed to call the cops if they are concerned about the user's safety; otherwise you're asking them to ignore their conscience, which is dehumanizing and likely to haunt them.

And if users plan to say alarming things, they should turn off their AI microphones first. Having them know to do this brings healthy attention to the true nature of the devices.

comment 7y ago · link · parent

> I believe ICE should be responsible for illegally attaining this information. They should also bear the cost of educating the Motel 6 workforce on their rights to resist requests from law enforcement agencies.

Totally agree. A hotel worker would be a hero for refusing to comply with an illegal request, but it's not reasonable to expect them to know what's legal or not here.

Citizens should be able to assume that those who enforce the law also obey the law, and when that's found not to be true, the agencies should be in deep trouble. Without law abiding law officers, the whole system falls apart.

comment 7y ago · link · parent

I've wished for this myself. We replaced a refrigerator, and I thought "what a waste - 95% of the mass of that thing was non-moving parts that could've lasted centuries".

> There is still R&D to be done to update for modern manufacturing techniques, but an upstart that simply built old classic designs and added a 30-year warranty would do well. Bonus points for standardized dimensions (for easy replacement years from now).

Extra bonus points for publishing manuals and 3D printing plans for replacement parts and ensuring they remain available long term - eg, creating a web site and funding a foundation to keep it running + seeding torrents with the info.

comment 7y ago · link · parent

Why would we go beyond step 2? As a taxpayer, I could buy the argument that the govt needs a new font, and that, having made one, it should make said font available for free so taxpayers can get the benefit.

I don't see why my taxes should fund a public CDN, though.

comment 7y ago · link · parent

Everything is a tradeoff.

You say:

> sometimes you don't have a name ready and it's actually better to defer naming the thing until you know what it is

You can do that without this feature; you can use throwaway variable names like "x" and "y".

Taking an example from the post:

> (1..9).each_slice(3).map { |x, y, z| x + y + z }

vs

> (1..9).each_slice(3).map { @1 + @2 + @3 }

The shorthand saves you 7 characters in the rare case when you truly have no idea what to call your block parameters (even a single-character name can be descriptive, eg if x and y are coordinates). That seems minimally useful.

Meanwhile, you've made your block parameters look like instance variables, and everyone else (including all tools that work with Ruby code) has to learn why they aren't.

Seems like a poor tradeoff to me.

comment 7y ago · link · parent

Verifying a user's email by collecting their password is ineffective for users with 2FA enabled and reckless/malicious for those (the majority) without it.

Accidentally log that data somewhere, and you've opened a way for attackers to take over your users bank accounts, social media, and pretty much every other online account, as they all rely on email verification.

If we had privacy laws with teeth, somebody at FB would be calculating how many millions in liability each piece of data collected represents. This one would be astronomical and an automatic "no" by those calculations.

comment 7y ago · link · parent

Arguably, giving up your email login is worse than giving up your banking login, since attackers could use your email to reset the password on other accounts, possibly including bank accounts.

For banking, a better system would allow you to generate some kind of token in your banking site which would allow the kinds of permissions you want to grant to a third party, and which you could unilaterally revoke at any time.

comment 7y ago · link · parent

> So is Verizon responsible even though nobody at Verizon had anything to do with it?

Imagine if CompuServe still existed, but they had undergone 100% employee turnover in recent years. They'd still be liable, right?

It seems to me that when Verizon bought CompuServe, they calculated that its assets minus its liabilities totaled less than the purchase price and hence it was a good deal. If we treat leakable data as a legal liability, it should send the right financial signal - eg, maybe as a company you don't want to collect much.

comment 7y ago · link · parent

> not an apples to apples comparison IMO

I see what you did there.

comment 7y ago · link · parent

I think password management is a good fit for Mozilla. I perceive Mozilla to be trustworthy and competent, and the code for this is open source: https://github.com/mozilla-lockbox

They also generally do a good job with UI, which is not true of all open source solutions. This may not be crucial for devs, but it's crucial if we want to share passwords with the non-devs in our lives.

comment 7y ago · link · parent

The bullet gem has helped me solve this problem in specific applications before, yes.

My higher-level problem is that having lazy-loading on by default allows N+1 queries to creep in to a code base and you need a third-party gem to find them. I've had to spend significant time finding and fixing this after joining teams with large legacy apps.

"Disable lazy loading globally" should be an ActiveRecord setting and it should be on by default IMO; people who need lazy loading should have to turn it on per query, something like `query.allow_lazy_loading(post: :author)`. I suspect that a very small fraction of queries would use this, since many apps don't do server side rendering, many who do SSR don't use Russian doll caching, and even those who do both still execute many queries that should prefetch all the associations they use.

comment 7y ago · link · parent

> Wouldn't you expect a carbon tax to be similar in price to the cost to get the carbon back out of the air?

If the goal of the tax is to fund carbon removal and if that removal can be done immediately after emission without any damage being done to the environment, then yes. Otherwise you'd want to factor in the damage done.

If someone injected you with snake venom and argued that they should only be fined the amount it costs you for antivenom without consideration of the damage to your body, you would not accept that.

comment 7y ago · link · parent

> Callbacks suck, so write service functions for complicated CRUD. Working around ActiveRecord defaults is like the 2nd thing you learn to do at a serious Rails shop. I'm afraid you may not have been working with sophisticated Rails engineers, because we certainly modify defaults in our applications.

I'm not sure why you feel like you need to demean my experience to discuss this. Callbacks are extremely commonly used in Rails apps and not at all the province of Rails newbies. Here's DHH in 2018 telling you about how Basecamp uses callbacks: https://www.youtube.com/watch?v=M3JPTOTqsnE

And even if you don't like callbacks and never use them, at some point you're going to change jobs or consulting clients and land in a code base that's full of them.

> Elixir is hot, but it's hard to learn and will always have a barrier to entry that Rails won't.

Maybe so. I can't predict to what extent it will catch on, but it's paying my bills. If I get to stay in a happy little niche, that will be fine with me.

comment 7y ago · link · parent

> I love how every time there is a post about Rails, someone preaches the holy grail of Elixir/Phoenix.

I can understand how you might feel that way. I tried to make clear that I don't think it's the perfect answer to everything forever, but to specify ways in which I've personally seen it as an improvement. And given that the OP is about the continued merits of Rails, don't you expect some commenters to express disagreement?

> the main thing that execs care about is the bottom line and how fast we can push products to production

True. But that matters not just on day 1 but for years to come. Sandi Metz in the Ruby community teaches that point well.

I've seen Rails patterns like ActiveRecord callbacks lead to buggy, confusing code, greatly hindering progress on feature work and requiring significant debugging effort.

Certainly lots of businesses have succeeded with Rails, and I've worked for some of them. Lots of businesses have succeeded with Python, Java, .NET, PHP, and Node, too. That in itself doesn't argue for which one to pick when starting a new project.

After experiencing difficulties with my Ruby tech stack, I started looking around, and Elixir is where I landed. At this point I'm invested and biased, just as the OP is. But bouncing back and forth between the languages recently has confirmed for me that I prefer Elixir for the reasons I gave above.

> To any young devs out there, I strongly encourage you to not pick a framework by its hype but evaluate it based on your system needs / maturity.

I'd suggest young devs pick tools based at least partly on job postings, and on that measure, Rails will win by a landslide. But keep your ear to the ground. When I started as a developer, I was using PHP, but I kept hearing how Rails was better. Learning it and moving to work in it was a great career move for me.

Something will come after Rails. Something will come after Phoenix. There will always be a new something. Don't get too caught up in the hype, but don't get too attached to your current tools, either.

comment 7y ago · link · parent

If the query was expensive and could be run periodically, I'd either create a materialized view that gets refreshed as often as necessary (maybe by https://dockyard.com/blog/2017/11/29/need-an-elixir-dependen...) or use a GenServer process for caching that data (as you might do with Redis otherwise).

I don't think the view rendering itself would ever be a performance issue, but rendering a view is just a function call in Phoenix, so I could take a similar approach there - store it in a GenServer.

comment 7y ago · link · parent

> The problem I had with the bullet gem however is that some times you actually want N+1 queries. Especially with Russian-Doll caching.

I know it sounds like I keep beating the same drum, but to me this problem seems like "we have slow views, therefore we need to sprinkle conditional caching logic everywhere, therefore we need to allow lazy loading, therefore we need to watch for N+1 queries."

As I wrote elsewhere (http://nathanmlong.com/2016/11/elixir-and-io-lists-part-2-io...):

> By contrast, by compiling templates to functions, Phoenix automatically and universally applies this simple view caching strategy: the static parts of our template are always cached. The dynamic parts are never cached. The cache is invalidated if the template file changes. The end.

With fast views, no lazy loading is needed and no N+1 queries need to be possible. I don't think this is a problem inherent to Ruby, just to the way ActionView and ActiveRecord currently work.

comment 7y ago · link · parent

> Perhaps you don't want everything eager loaded, but you want an exception to be raised if you try to access an associated record that hasn't been preloaded.

Yes, exactly.

> When I need to load/use them along with many parent records, it seems pretty obvious that I'll want to include those associations (eagerly loaded) in my AR query to avoid N+1 queries as you mentioned. Then again, maybe I've just spent too long taking those assumptions for granted where newer devs might not.

You know that and I do too, but legacy Rails apps tend to be full of N+1 queries in my experience, and it's a major cause of slowdowns.

comment 7y ago · link · parent

I haven't used Node, but I think it's funny how they tout asynchronous IO via callbacks. Meanwhile the BEAM has that plus asynchronous computation - you just write synchronous code and let the scheduler pause your BEAM process as needed.

If you don't have to write code to deal with the computer pausing your unix process to run a different one, and you don't have to write code to deal with the VM pausing your code to run garbage collection, why would you have to explicitly write code to deal with a pause for IO?

comment 7y ago · link · parent

I know how to preload associations, but I don't know how to globally disable lazy loading of associations. Do you know a way?

comment 7y ago · link · parent

Yep, I used it extensively on one project, configuring it to raise exceptions if it detected an N+1 query and gradually enabling it test by test as I fixed them. It's very helpful.

comment 7y ago · link · parent

I spent a couple of years dreaming of getting paid to work in Ruby and Rails and about 7 years doing so. There are many things I loved about Ruby, and Rails brought a ton of good ideas to web development, as this post describes (though I don't agree with all the highlights).

I've since moved to using Elixir and Phoenix, and then even more recently, done some consulting on a Rails project. So the contrasts are on my mind.

My perspective now is that the advantages Ruby/Rails have over Elixir/Phoenix (community size and number of libraries) are circumstantial, and the advantages Elixir/Phoenix have (fault tolerance, concurrency, speed, less requirement for external tools) are inherent in the VM.

Yes, speed of development and maintainability matter. And yes, you can write good or bad code in any language. But if Rails taught us anything, it's that defaults matter. And the default pattern in Rails is to use ActiveRecord and rely heavily on model callbacks, which can get confusing quickly. ActiveRecord also has no way to turn off lazy loading as far I know, and chasing down N+1 queries to improve performance is something I spent far too many hours doing.

My productivity also wasn't helped by the long test run times of Rails applications, or by wasting time trying to optimize view rendering on a heavily-used page.

All of those are either non-issues for me now or at least greatly reduced - Phoenix view rendering is crazy fast, N+1 queries aren't possible with Ecto and it doesn't have callbacks, Elixir test suites are highly concurrent and generally fast (though driving a headless browser is still rather slow).

Performance and concurrency do impact productivity. And I find that "functions in modules" is a great way to structure code and makes it easy to refactor. So does being able to run the entire test suite faster than I can get distracted.

The best ideas of Rails, in my opinion, are present in Phoenix - things like structural conventions, English-like naming, and database migrations. But many of the pain points are missing.

Phoenix and Elixir aren't the One True Way™, aren't the best for every conceivable software problem, etc. And surely they'll be superseded. But in my opinion, Rails already has been.

comment 7y ago · link · parent

This reminds me of the ISPs getting upset about the bandwidth they have to deliver on behalf of Netflix.

"Our platform enables your app" is true in both cases. But so is "our app brings people to your platform." The power imbalance is that it's easier to build a competing app than a competing app store or ISP.

comment 7y ago · link · parent

> I hate being outright dismissive but it sounds like an expensive html/pdf form with a printer attached.

I don't think that's dismissive at all. That's what it is, and it sounds good to me. Basically the computer is a scribe with perfect handwriting that fills out the paper ballot for the voter while the voter watches. Absolutely any voter is qualified to assert whether the ballot contains the votes they intended to cast.

From there, you could have the voter carry the ballot and drop it in a box that's being observed by any number of interested parties, providing old-fashioned accountability. Counting by scanner is an optional time saver, with hand counts as the alternative / double-check.

comment 7y ago · link · parent

> none of the election committees were willing to commit to a full hand recount

I don't see how any system can work if nobody is willing to double-check it.

comment 7y ago · link · parent

> Kiniy said Galois will design two basic voting machine types. The first will be a ballot-marking device that uses a touch-screen for voters to make their selections. That system won’t tabulate votes. Instead it will print out a paper ballot marked with the voter’s choices, so voters can review them before depositing them into an optical-scan machine that tabulates the votes. Galois will bring this system to Def Con this year.

This sounds great: paper trail, no chance of "hanging chads" or bad handwriting, verifiable by the voter at the moment before scanning and hand-countable if necessary.

comment 7y ago · link · parent

> But using less javascript is the hype today...

Is it? This article on npm weekly (https://medium.com/npm-inc/npm-weekly-133-billions-of-packag...) says 4 billion packages were downloaded in a single week - representing multiple packages per week per human on earth. (Granted, this was Feb 2018, which is 2.8 millennia ago in JavaScript years.)

This site (on which you can't use the back button after choosing a graph) seems to show downloads still growing for popular packages. https://www.npmtrends.com/

comment 7y ago · link · parent

> You think people can’t tell the difference between Melanesians, Caucasians and Sub Saharan Africans?

Get someone to show you pictures and have you identify them. I bet you'll make a lot of mistakes.

Historically, not only can people not tell the difference objectively, they decide what the difference is subjectively. In the United States, the child of a white slave owner and a black slave, if their parentage was known, was ... black. People of "mixed race" might be deemed a different race than their own full siblings, based on which visible characteristics they got from which ancestor.

Even today, people migrating from one country to another are often surprised that their racial classification is different in the new country than at home.

12345
39