289 karma · joined Dec 1, 2011 (15y ago) · 193 submissions
6.
Ask HN: How to transition (back) into frontend dev?
1 points · by chrstphrhrt · 6y ago · discuss
comment 6y ago · link · parent
I find OOP useful for configuration and library-level APIs (e.g. for injecting dependencies and wrapping things), when there is really zero expectation that a user should have to understand the class definition entirely. But that's about it.
Where it seems to break down for me is when classes are actively used at the application implementation level for general encapsulation. E.g. data access layers. This can be done perfectly fine with modules/packages. Adding inheritance is just asking for trouble in a team setting IMHO.
Trouble comes when there is no clear peer review and style policy to avoid classes for anything other than config or distributing libraries (as separate projects). What ends up happening is a proliferation of subclasses or method overrides when developers are in a rush to ship features without understanding the whole codebase. This is a technical loan with very high interest.
It makes sense rationally in the moment, as classes have an inviting feel to the user as a kind of grab bag of related functionalities that are easily introspected (at first). Compare it to searching through docs for all the different namespaces in a package and learning what types their various functions support, it requires more thought and grasping the concepts of the library. Alternatively, a class with a broadly defined purpose starts to look like a common utility to throw things at. It's a grab bag of stuff that is more amenable to hacking with blinders on, in a way.
Next thing you know the chains of inheritance and method overrides have grown into a very hard to disentangle hydra. The accumulated overhead of maintaining it is compounded by the debugging challenge of knowing where exactly a given instance is coming from and which layers it has been through on its way to a given breakpoint.
comment 6y ago · link · parent
There is so much dystopian doublespeak in startup marketing, and people continue to believe it, because not doing so threatens their careers. Of course there are also many startups out there that actually do improve lives, but I wouldn't say it's the majority.
comment 6y ago · link · parent
With sub-interpreters, I wonder how different it is from normal multithreading like in JVM. Need to read up on this idea. I can't see how it wouldn't require the same locking and mutexes or message passing if multiple interpreters are to work on logically related data.
So my immediate thoughts were about leveraging it as a replacement for multithreading and event loop clustering by treating the interpreters as lightweight processes and having them communicate over some kind of protocol. Like how the BEAM does built-in process supervision.
The "supervisor" process itself is async in the way it coordinates the tree.
13.
Language skills more important than math to learn programming, research shows(massivesci.com ↗)
13 points · by chrstphrhrt · 6y ago · 2 comments
comment 6y ago · link · parent
Not trying to apologize for hosts or hotels in particular, I just feel like primary residence swapping is pretty harmless. Also, if hotel licenses are required, how is adding more hotels distorting the hotel market other than adding a tiny amount of fair and regulated competition?
comment 6y ago · link · parent
The original evolution of couch surfing that Airbnb started with was still cool and I like to be able to let my apartment when out of town. It's the rent seeking behaviour that distorts the housing market.
comment 6y ago · link · parent
I guess that what the article is on about. Writing on its own isn’t enough, the culture must be set top-down to include reading and value added communications as well.
I think a lot of workers who do not have a craft per se just want to coast and pretend to work, and get offended or embarrassed when they encounter serious contributors that make them look useless.
There is an attitude toward the writer of “if you know the topic so well, then just handle ‘it’ and get ‘it’ done”. Unfortunately their idea of “it” has nothing in common with what is described or advocated in the writings.
comment 6y ago · link · parent
comment 6y ago · link · parent
However, I became more and more turned off by the modern company of success porn bros who use it as a kind of macho way to justify not caring about others. This is not the truth of it, as Stoic ethics is about concentric circles of concern emanating outward (family, friends, community, country). I wish there was more focus on that.
comment 6y ago · link · parent
27.
Lenovo will start offering ThinkPads with Linux pre-installed(techspot.com ↗)
6 points · by chartpath · 6y ago · discuss
comment 6y ago · link · parent
comment 6y ago · link · parent
Lately I have started using FastAPI in Python, which uses Pydantic to enforce type hints at runtime. This saves a lot of manual checking code (e.g. "if input_data["mykey"] == "unhappy path": raise ValidationError").
This was the same annoyance in Node.js because the types are so flimsy and manually checking is really boring. Tests are great but if you can have correctness while rapidly prototyping that would seem to be a win.
Is there a great TS lib to do runtime type reflection like Pydantic?