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

When storing data, particularly when stored in a relational model, it's quite often better to make sure the data is properly normalized[0]. However, normalized data in the way that suits the data model might not be the more convenient way to operate on it from the perspective of your domain logic.

Additionally, the data types in your data model are limited by what your data layer supports, but on the domain side you might want to have richer data types.

ORMs make it easier to obtain the data in a shape and in types that are useful to you from a domain model perspective, while still storing the data in a way that's useful for the database side of things.

Example 1:

I want to store Users which have a `name` and `date_of_birth` property in a table. However, when operating on that object in the domain side, I might want to have instances of a User class which might expose a method such as `isOfLegalAge()`, which would let me know whether that user is old enough to, let's say, sign a mortgage contract.

A ORM makes it easier for me to get back an instance of a User class (which can have useful methods), instead of having to operate on a database row structure, which would give me strictly data.

Example 2:

A given Product, which has a `name` and a `price`, might be supplied by a Supplier, which has a `name` and an `location`. When fetching a user from a database, I might want to have an object in a shape such as:

  Product {
     name: string
     price: number
     supplier: {
        name: string
        location: {
           city: string
           country: string
        }
     }
  }
However when I store it, a Product would have a reference to a `supplier_id`, which points to a row in the Supplier table. The supplier's location's city and country would be a city_id and country_id, each of which referencing a row in a City table and a Country table.

So from a data model representation it might look more like this:

  Product {
     id: number
     name: string
     supplier_id: number
  }

  Supplier {
     id: number
     name: string
     location_id: number
  }

  Location {
     id: number
     city_id: number
     country_id: number
  }

  City {
     id: number
     name: string
  }

  Country {
     id: number
     name: string
  }
The ORM would map between these two representations.

[0] https://en.wikipedia.org/wiki/Database_normalization


You don’t eat plants? That’s interesting, could you share more?


No sugar and no plants means something like keto/carnivore diets.


Yep. I started reading the zerocarb subreddit more than a decade ago. And decided to try carnivore (with a few plant foods) August, 2022. So far, so good.


I thought the apple thing was understood to be a Latin pun between “malum” (evil) and “mālum” (apple). Isn’t it so?


Ah yes, hence "maleficarum" being an alternate name for AppleTalk. :D

(Source: I made this up.)


In any case sounds like you dodged a bullet :-)


It's 2025, I've used PHP professionally maybe for a few months out of the last 20 years, the languages I use mostly don't have `::` as a token, and still, I find it really hard to refer to it as anything other than Paamayim Nekudotayim :-)

Old habits die hard I guess...


For those of us who weren’t around at the time, could you d on what made it good? Thanks!


what made it good?

Less good, more fun. To 'prove' that you were over 18 you had answer a series of multiple choice questions [1] about pop culture that most kids almost certainly wouldn't know. Pre internet, finding the answer was surprisingly hard without asking an adult. The main result was that 10 year old me knew a surprisingly large number of obscure facts of about US culture, like who Spiro Agnew was and that Ronald Reagan once starred in a movie with a monkey.

Eventually we found out that you could press some magic key combination to skip the question all together.

[1] https://allowe.com/games/larry/tips-manuals/lsl1-age-quiz.ht...


LLM knows, thus the children know. Parents know, thus the children may easily know. It sounds fun but its practical value is questionable.


They asked questions grown ups would know but likely not kids. I remember one questions about The Beatles for example.

https://allowe.com/games/larry/tips-manuals/lsl1-age-quiz.ht...

Edit: Added link


Initially when I moved to Germany I thought it was a bit of a hassle to have to go to the post office for PostIdent; now I actually miss the elegance and privacy of that system in other countries.


Also copying from my iPhone and pasting into my Mac is so practical it feels like straight up science fiction


Learning things for fun and not just for profit. Physical development, learning a new sport. Spiritual development, meditating, observing. Engaging in arts, creating, exploring. Helping the less fortunate, volunteering, teaching. Traveling, learning about different cultures, different languages. Cooking. Spending time in nature, watching animals, birds, mushrooms, sunsets. Photography. These are just some examples, the list is endless :-)

Personally I’ve grown a lot from gardening and weightlifting. Having children made me more human.


I was about to ask whether supporting Egyptian is in the roadmap, then read the comments and I'm happy to discover that's already Egyptian :-)


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

Search: