Better HN
topnewbestaskshowjobs
Log inSign up

kortex

8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions

Submissions

comment 4y ago · link · parent

Or put another way, 1/10th the surface area of code to write, maintain, review, and bug check. And much less interface{} abuse.

That's taking "tenfold" at face value. I don't see that happening personally. The go community has enough of a nucleus of devs with a certain mindset that I don't see crazy Haskell levels of abstraction taking over. What I do see is more type safety coming to interface dynamicism.

comment 4y ago · link · parent

> I don't mean to disparage the wonderful work of the lo developers but, > this is in many ways what I feared generics would bring.

What is, anything in particular about that "lo" library? Just the way it uses generics, or moreso that it's yet another library to learn to be effective? Can't argue with the latter, but as far as the former goes, I think that looks quite reasonable. It's very explicit, there's no magic going on. I think there's definitely a bar for "so much abstraction that it is discouraging to developers not into that sort of thing", and IMHO that doesn't cross it. Monads, sure, that's a tall order for many folks. But this is pretty tame.

But I am a fan of abstraction so I'm not the best judge.

comment 4y ago · link · parent

Better question:

- 200 lines of statically typed, pure functional code with high test coverage

- 20 lines of code with I/O, parallelism, mutable state and/or interacting with external APIs

I find it way less cognitively draining to review a big chunk of blue ocean code with good patterns, than even small amounts of code which requires me to maintain any kind of state in my head, or try to think about the consequences of how this change interacts with the broader system. I'd say that some kinds of code are easily 10x more cognitively draining than others.

comment 4y ago · link · parent

In terms of ergonomics, I'm more a fan of the fluent style [1] over flow-aware typing with guard blocks. I've never heard of till not but I presume you mean that's like where you have like

    foo: Optional[Foo]
    if foo is None: 
        return some_error_handler()
    bar = foo.qux()  # the above guard "upgrades" O[Foo] to Foo

For me the real reason I love the ergonomics of the Rust-style "monads [2]" over Unions is that it lets you generically operate on each of 3 orthogonal parts: the value, the error, and the container. Optional or Union[T, E] don't quite hit the same way because you end up having to do more contortions to deal with managing the happy path vs sad path. What ends up often happening is without a container, your type "leaks" into other methods - you start ending up with functions that expect a Union[SomethingMoreSpecific, E], instead of just letting the Result.map(T->U) handle it.

Also specifically in Python, the type system is kind of weak (especially those bundled with Pycharm), and a lot of functional operations which ought to be more strongly typed end up with their types erased for whatever reason. In particular functools.partial seems to discard type information more than I'd like. The Result python package [3] doesn't run into this problem near to the same degree.

1] https://martinfowler.com/bliki/FluentInterface.html

2] I find this term frustrating not only because it's infamously ineffable, but also because there appear to be disagreement whether Rust's containers are actual monads or not, leading me to dub what I call the "Engineer's Monad" which is a generic container you can map and flatmap over, even if isn't strictly an Applicative.

3] https://pypi.org/project/result/

comment 4y ago · link · parent

> Sure, HTTP only has 5 verbs

More like 40.

You can also just like...make up your own verbs, the HTTP police won't arrest you, though this rustles the jimmies of HTTP purists. No guarantees any middleware will support it, and this is probably a bad idea if you actually do this in public apis, it's more so "hey, these verbs aren't magic incantations, it's just a string which gets switch-cased".

Same with HTTP status codes. There's obviously some well known ones but you can just like...make up your own.

https://www.iana.org/assignments/http-methods/http-methods.x...

comment 4y ago · link · parent

I think I'm with Jack on this one, at least when it comes to REST interfaces. When I query GET /bar/123, I want an object with a Bar protocol/content-type. I don't want a Envelope[Bar]. What if it's any data type other than json-isomorphic, e.g. image or video? Is /videos/123.mp4 going to return a json object like

    {"data": <base64_encoded_video>, "status": "whatever"}
Of course not!

You already have an envelope, it's the HTTP protocol. The real trick is generically mapping data structures to HTTP responses with headers. In fact HTTP-response-shaped-objects make halfway decent general purpose envelopes in the business logic itself. They are basically Result[T, E] but with even more metadata available.

comment 4y ago · link · parent

That's...really clever, but at the same time, I feel like there's a lot of assumptions baked into how Content-Types are used, and making your own content-type for each data model when it's all just application/json seems...wrong to me on an intuitive level, but I can't quite annunciate why.

I only half agree with the sentiment that /api/v1 violates REST patterns. I don't think there's any guarantee that /api/v1/bars/123 can't be the same object as /api/v2/bars/123.

comment 4y ago · link · parent

I'm not saying you should do it this way, this is just how our startup (still very much in the "move fast and discover product fit" stage) does it. We have separate API models (pydantic and fastapi) and DB models (sqlalchemy). Basically everything not in the original db schema ends up nullable when we first add a field. The API model handles validation.

Then if we absolutely do need a field non-null in the db, we run a backfill with either derived or dummy data. Then we can make the column non-null.

We use alembic to manage migration versions.

But we aren't even out of v0 endpoint and our stack is small enough that we have a lot of wiggle room. No idea how scalable this approach is.

The downside is maintaining separate api and db models, but the upside is decoupling things that really aren't the same. We tried an ORM which has a single model for both (Ormar) and it just wasn't mature, but also explicit conversions from wire format to db format are nice.

comment 4y ago · link · parent

In practice though, the tooling is cumbersome enough that you can't readily sub in some other protocol besides protobuf, json, and allegedly flatbuf. I've had little success finding ways to e.g. use msgpack as the serde. Maybe it's out there but I haven't found it.

comment 4y ago · link · parent

Pattern matching and Result type are truly among the most revolutionary computer science constructions and I am glad to see their adoption starting to catch on. So much nicer to work with than exception handling or endless propagating of error constants a la Go. Python just got pattern matching (although it lacks pattern-match assignment a la Rust), now it just needs an actual Result type in the stdlib instead of Optional[T] which is really just T|None rather than an actual container. Golang can start delving into Return-type-looking generics but I suspect pattern matching is a long ways out.

comment 4y ago · link · parent

I use Cleo for python, same thing, has the ability to generate completion scripts. I also find the API far saner than argparse or click. I don't really use the docstring-parser, I prefer using the Command api for finer control, but it's really cool to just write the help docs and automagically get options.

https://github.com/sdispater/cleo

comment 4y ago · link · parent

Wouldn't the best perspectives be those unaffiliated with either side in the conflict?

Ok sure, you may wish to discount "western" media, but Russia is directly involved in the conflict, and has a vested interest in the outcome. They are ground zero for propaganda.

Shouldn't you go for something like Hindustati Times or Al Jazeera for more "neutral" stance?

comment 4y ago · link · parent

The mean is a statistical measure which is very sensitive to outliers. Your weighting function should be more like an M-estimator.

The more extreme the source, the less weight it gets.

Also it means little to combine multiple sources of similar persuasion. Both Russia and China saying something is not worth 2x, since they are correlated.

https://en.m.wikipedia.org/wiki/M-estimator

comment 4y ago · link · parent

Lots of heuristics. As many have mentioned, "a priori, don't believe anything on the internet" is a great starting point. You wouldn't trust a complete stranger as much as your best friend; almost everyone is a complete stranger on the internet, with the bonus of having a megaphone and opinions to spread. On the internet, no one knows you're a dog. But actually, most sources are humans, and most want to just share their perspective (as opposed to knowing the truth and deliberately lying), however flawed it might be.

Follow the money.

You used to be able to rely more on coincidence counting - meaning more sources saying the same thing means its more likely to be true. That has way less weight when one tweet gets shared, articles written about it, then people tweet the articles, and it comes full circle. You can manifest "facts" easily. And most news reports the same original source. But it's still useful if you can triangulate with multiple high-quality sources, or sources of conflicting persuasion. NBC reporting X is worth 1 unit. NBC, ABC, CNN reporting X is still just 1 unit. But CNN, Fox, Al Jazeera, and AP all reporting X is worth 2-3 units. There should be a logarithmic curve to your confidence. Any situation could flip on its head.

Think like a Bayesian. Every statement should have some prior probability of being correct, near 50/50. Increase the weight if the source is good, it jives with other things you are confident in; decrease it if the sources is bad or it doesn't sit right. De-rate "shocking" information - it tends to outspeed quality but nuanced info.

Knowing who to distrust is often more useful than knowing who to trust. It's often easier to infer as well. Create a mental "trustworthiness score". You start by identifying low quality reporting or straight up lies. This drops a sources' score. Other news from that source is also likely to be bad. Other sources that cluster near this source are also likely to be bad.

All media can be faked (manually or with AI), but at this time, deepfakes have some glaring limitations, and most fakes are in fact "cheapfakes" of the lowest possible effort. Why spend time photoshopping when you can just slap a misleading caption on an old photo?

The information firehose - tweets, shares, comments sections - can be useful for cutting edge info and building the big picture, but wielding it is an art. Most is gossip. Often the most popular/liked opinion is simply wrong, but also often, the truth is there deeper in the thread, but buried. Bullshitting is easy, but speaking facts is hard and time consuming. Look for "rich"/"deep" comments that show someone doing their homework.

I'm loathe to recommend any particular sources (you should develop your own), but I'm partial to the OSINT groups like Bellingcat. AP and Reuters are decent for "mainstream" media.

comment 4y ago · link · parent

Our company read.ai builds add-ons for videocon clients so I'm pretty familiar with most clients.

- Zoom is just simply the best in terms of stability, performance, user experience, and in particular ease-of-first-use. Call quality is the best.

- Webex is a hot mess. They've been scrambling to catch up and have made stride but have a ways to go. Install is a nightmare

- google meet feels like it's barely changed in 5 years. Makes my fans take off. Decently stable at least

- Teams is decent all-around, featureful, and actually had a good SDK before Zoom, but install/userex and stability struggle at times

- is skype even a thing still?

Hands down the two biggest factors are time-until-first-use, friction, and stability of the audiovideo stream. Zoom simply dunked on the other legacy players in this regard.

comment 4y ago · link · parent

Not to be confused with https://github.com/microsoft/pyright and dozens more smaller projects.

comment 4y ago · link · parent

Excellent to see functional programming ideas like deferred computation and clean interfaces make their way into the scientific computing space.

One thing though: I know these are good ideas. But to someone not as familiar with these patterns, they may wonder "why go through all this trouble?"

comment 4y ago · link · parent

That's exactly what this is doing. Numpy is glue around lapack/blas.

R is okay for batch processing, but what happens when management wants engineering to implement data science's models alongside some pytorch models?

Python is totally performant enough if you know how to wield it.

comment 4y ago · link · parent

It definitely can be. I'm constantly trying to push our stack away from anti-patterns and towards patterns that work well, are robust, and reduce cognitive load.

It starts by watching Simple Made Easy by Rich Hickey. And then making every member of your team watch it. Seriously, it is the most important talk in software engineering.

https://www.infoq.com/presentations/Simple-Made-Easy/

Exhausting patterns:

- Mutable shared state

- distributed state

- distributed, mutable, shared state ;)

- opaque state

- nebulosity, soft boundaries

- dynamicism

- deep inheritance, big objects, wide interfaces

- objects/functions which mix IO/state with complex logic

- code than needs creds/secrets/config/state/AWS just to run tests

- CI/CD deploy systems that don't actually tell you if they successfully deployed or not. I've had AWS task deploys that time out but actually worked, and ones that seemingly take, but destabilize the system.

---

Things that help me stay sane(r):

- pure functions

- declarative APIs/datatypes

- "hexagonal architecture" - stateful shell, functional core

- type systems, linting, autoformatting, autocomplete, a good IDE

- code does primarily either IO, state management, or logic, but minimal of the other ops

- push for unit tests over integration/system tests wherever possible

- dependency injection

- ability to run as much of the stack locally (in docker-compose) as possible

- infrastructure-as-code (terraform as much as possible)

- observability, telemetry, tracing, metrics, structured logs

- immutable event streams and reducers (vs mutable tables)

- make sure your team takes time periodically to refactor, design deliberately, and pay down tech debt.

comment 4y ago · link · parent

Something tells me the kind of parents sending their kids to a school that is this hands-on and committed to early childhood development, probably know what they are getting in to - in fact they probably seek it out.

comment 4y ago · link · parent

Julia looks promising, but it has a long way to go to catch up with Python's ecosystem. Python's libraries, communities, knowledge base, and developer availability are almost unmatched (maybe a few languages have it beat). Especially in the scientific, ML, and data science fields.

comment 4y ago · link · parent

You mean like the Alameda-Weehawken Burrito Tunnel? https://idlewords.com/2007/04/the_alameda_weehawken_burrito_...

comment 4y ago · link · parent

Economies of scale at every stage of the game. Fuel is basically the cheapest part of a launch. Last I checked, the cost of maintaining infrastructure was on roughly the same order as the fuel per launch. More launches per site drives the cost-per down.

Reusability is a spectrum. Falcon requires a nontrivial amount of inspection and refurb between launches, while Starship is aiming for jetliner levels of prep.

Musk is also aiming to drive down the capex costs as well. There's less complexity for unmanned cargo hoist missions. I think the target for Starship is low tens of millions USD, basically cheaper than Falcon Heavy, but more reusable, with more capacity.

I think the only thing that's not cheaper, is liquid methane is a bit more expensive per kJ. They are roughly the same price per kg, with RP-1 being more energy dense. But then again, I could see SpaceX vertically integrating and driving that cost down too.

comment 4y ago · link · parent

Nope. That's called rebroadcast. It's also used to try to "launder" photo manipulations, like compositing. I helped work on some algorithms which could pick up artifacts even after rebroadcast.

I would absolutely not trust pdf not to leak metadata. Although now you risk metadata leak from the printer or scanner, which may or may not affect your threat model.

comment 4y ago · link · parent

The brain is incredibly good at pattern matching while not necessarily being able to articulate why they came to that decision. Organic chemistry has these types of relations in spades. Say for example crystallization. You can kinda brute force it; there's only a few dozen realistic solvents to try, but that's a single solvent system. Then there's binary and ternary solvent systems. Then there's heat/cooling profiles, antisolvent addition, all kinds of things. Hundreds or thousands of possible experiments.

You might just decide that a compound "needs" isopropanol/acetone, plus a bit of water, cause something vaguely similar you encountered years ago crystallized well. You often start with some educated guesses and refine based on what you see.

But there's often no clear hypothesis, no single physical law the system obeys.

comment 4y ago · link · parent

Settling Mars is gonna be some multi-generational Bene Gesserit long term thinking shit. In fact when he dies I hope someone else takes up his obsession with Mars or bust. Settling North America took decades. It's like that, except you need a minimum tech tree to even just breathe and grow potatoes.

comment 4y ago · link · parent

Ok, so like 5-10. ISS took 40 assembly flights, with 36 being expensive space shuttle flights ($54k/kg).

comment 4y ago · link · parent

That's true, but there is no fuel source out in space. Outside of Earth orbit, eg Lagrange points, you need fuel deliveries.

On Mars they can make methane with the Sabatier process.

So you have:

- LEO/MEO - vulnerable to asteroid impact ejecta

- GEO/moon/L-points - avoid ejecta, but need regular refueling. If Earth is toast, there goes resupply

- Mars - close enough to the sun for solar, able to conceivably bootstrap in a few centuries

comment 4y ago · link · parent

Yep, I can really feel the friction from the gears in his head when he's trying to explain something at a general level, or express broad empty platitudes about space, electric cars, AI, or whatnot. That's something I've definitely struggled with, and also why I dig it when he shuts off the filter and starts talking about leaky flanges or deleting some crufty noise-absorbing padding that was the engineering equivalent of the parable of monkeys with a ladder. Like if I wanted to hear billionaires bloviating boring bullet points about business buzzwords, I'd listen to Bezos.

comment 4y ago · link · parent

I think he's more in-depth about the rocket stuff than the Tesla stuff. He seems to exhibit more of the broad sentiments and more manager-esque talk when it comes to FSD.

I don't know how that plays into legal ramifications at all; I'm sure there will be the inevitable "well Elon said it can drive itself and make breakfast and solve P=NP!" but I have no clue if that carries any legal weight and frankly I don't care. He's a bit of a massive douche (no worse than bog-standard billionaires) but he has nerd chops and done a good job of hyping electric cars and space.

Honestly I kinda wish he'd just focus on the rocket stuff and lay off the FSD until it's a bit more mature exactly because of the media and lawyers chomping at the bit.

1
353637
85