Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In my opinion this whole problem is one of the strongest condemnations of OOP. Even if OOP really were a great way to model your data, to express relationships and property types and such (setting aside all the questionability of that claim), it's all just going to end up in a database anyway. Unless you're using a denormalized database like Mongo, or the bulk of your application state is non-persistent, your perfectly thought-out OOP model is at best going to be a terrible approximation of the real data model and you're much better off using a language/paradigm that lets you just treat data as data.


> Even if OOP really were a great way to model your data, to express relationships and property types and such, it's all just going to end up in a database anyway.

Of course. But when you operate on it. When you end user is typing into a screen. When you're validating the contents. You're doing in the application, not in the database. RAM is where the data lives when it's being acted on.

It's like saying your Word processor should have no internal data structures different from how the file stored on disk.

OOP is a great way to model data sotred in RAM and operated on. And an ORM is a great tool for persisting that structure to disk as needed.


What makes you think that the DB will always by the dominant data store for a business object?

Business objects need a lot more, from rendering, processing, email sending, notifications, etc.

All those things are well approximated by an object and poorly approximated by SQL.


Everything you can build with OOP can be done with FP and vice-versa. So the question is which one's strengths you'll most benefit from.

OOP's strengths surround modeling nested object structures and encapsulating state and logic within opaque containers. If you're primarily writing data to/reading data from a relational database, everything gets flattened and exposed. So you have to ask yourself what you're getting from it at that point.

Rendering and processing are well-suited to FP. "Email sending" and "notifications" are vague, but I see nothing about SQL + FP that makes those harder.




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

Search: