Hacker Newsnew | past | comments | ask | show | jobs | submit | shinzui's commentslogin

It’s amazing how many of those types of problems are easily avoided or solved with event sourcing and CQRS.


Agreed, event sourcing is a pretty good match for call flows. You could first store every call leg / conference / recording / etc. webhook Twilio sends you as an event and then derive the state of the final "call" concept from those pieces of data.


The premise of the article is flawed. I read a lot of code, and that's how I learn and discover new things.


The author seems to be unaware of TypeID. You can use TypeID and ignore this article.

https://github.com/jetify-com/typeid


Is this particularly widely used? I don't think I'm aware of TypeID either. I don't see why the author's pretty light solution is inferior to this library.


Because TypeIDs are compatible with UUIDv7 and are supported by libraries in many languages.


I'm a big fan of the similarly obscure TagURI for unique identifiers https://taguri.org/


Or rather, the article is the explanation of typeid?


Underscore has usability drawbacks.


Like what?


Depending on the font, it can collide with underlining (as in hyperlinks). I also once had a case where the dashed line a document viewer displayed for a page break hid underscores that happened to be on the last line of the page, causing the recipient to misinterpret the documentation.

In proportional fonts, underscores are generally wider than spaces, creating larger gaps between the underscore-separated parts than between the surrounding space-separated words. E.g. in "AAA BBB_CCC DDD", "AAA"/"BBB" and "CCC"/"DDD" are closer together than "BBB"/"CCC". In some fonts the difference is quite substantial. This makes for incorrect/unintuitive visual grouping.

You have to press Shift to type them. On mobile keyboards, underscore is usually one extra layer removed. For voice dictation, it's also longer than "dash" or "minus".


Regarding the last paragraph, people are reading these ids not (very rarely) writing them.


It's 'oldskool' _ although, frankly, if someone can't find it on a keyboard, they should be condemned to a life full of auto-correct errors.


So your IDs are now tightly bound to whatever "types" you've currently decided you have, forcing a narrow view of what an entity is and making the entire system extremely brittle to change? What is a "type" even supposed to be? This is forcing a doubling-down on an already problematic design principle: that every entity is exactly one type of thing and these types of things are completely different than those types of things and obviously you can just make the perfect set of types that will never change if you think think really hard and everyone will agree on what each type means and they'll never change and that will never be a problem.

Jesus, what a nightmare.


A quick glance of the repo shows that the "type" is just a prefix. You can do whatever you want with it. Basically the same thing as what the article suggests, no?


You face the same issues with table names though. So do you not name your tables?

The solution to your entity problem should be the same. You do the reasonable, practical thing, and rename/refactor if they drift away from the original mental concept.


> You face the same issues with table names though.

Exactly right. You've succinctly stated the biggest problem with almost all modern database design.

> So do you not name your tables?

I do, but that name does not represent a Type of Entity, where all entities therein are Exactly Thus, and all entities everywhere else are Absolutely Not At All Thus. Instead, it represents a statement I want to make about entities. Any "natural" meaning you put into your identifiers about what they are is defeating the point of the identifier.

> You do the reasonable, practical thing, and rename/refactor if they drift away from the original mental concept.

And now all of your IDs that are "in the wild" have expired. Can I still submit a request using the old ID, before you renamed Employee to WorkPerson and then to MobileLivingBeing and then to PossiblyMobilePossiblyLivingBeing? And it's not "if" they drift away, it's "when". And it's not just that they change over time, it's that they change from one perspective to the next. You can never have two distinct disciplines of the business ever referring to the same entity, because they don't agree on what the types mean. That bears repeating: you can never have two different disciplines both referring to the same entity unless they agree on what the types are, and they don't, because their terms have different meanings. Do your accountants and your maintenance people and your capital planning people and your corporate leadership all agree on exactly what a "facility" is? Because if they don't, they literally cannot even refer to the same entity. Good luck with your microservices.


All I'm getting here is you're against names and labeling things. But you don't provide any solutions and since a heap of untagged and unlabled or in any other way annotated data seem so obviously strictly worse I doubt that's what you're actually suggesting?


As I said: the name represents a statement I want to make about entities. Naming things is fine. I'm against categorizing things.


Hurl is better than any of those GUIs. You can version your Hurl files and use them for CI/CD.


The title should have been breaking up with Angular. I posit that they would have had a much different experience using react with relay and graphql.


Lens is one of my favorite libraries, but I can understand why optics, in general, is a divisive topic. Like many things in Haskell, you won't appreciate optics without suffering through a steep learning curve.

Optics don't just save you a few keystrokes. Instead, they make tedious code that you would never write trivial. And more importantly, they're composable. So it's impossible to appreciate their effectiveness without using them on a real-world app. For example, I've worked in an app with three layers, each with its record types, and without the lens library, the pain of converting between records would have been insufferable. Instead, most developers would couple the three layers together to avoid the problem, which makes the codebase brittle.


Do you know of an application I could look at to see this first hand?


DDD offers a lot of benefits regardless of the programming paradigm. We heavily use DDD in Haskell.


Can you provide some (online) resources on DDD + functional?


Scott Wlaschin wrote a good book on this topic “Domain modelling made functional” and you can find his talks and articles online. I think this is a decent introduction, https://techleadjournal.dev/episodes/79/


Thanks a lot!


It's worth noting that Basecamp's architecture relies on vertical scaling, which can get very expensive in the cloud.


How so? Email is a fairly embarrassingly parallel problem.


DHH’s preferred architecture is a rails monolith with a single database behind it that you keep scaling vertically. I believe both Hey and Basecamp are still using that architecture.


DevOps (the term), like Agile, made sense when it was introduced but lost its meaning as the industry evolved.


I use nix-darwin to automate that.


More details please.


nix-darwin currently does not support that directly, but there is an open PR to fix that. For my dotfiles, I added the module from the PR with some slight modifications. You can find the code below.

https://github.com/shinzui/dotfiles.nix/blob/master/modules/...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: