News for hackers. Stuff that matters.
Re:The Repeated Deaths of OOP (2015) by smitty1e on Sunday June 06, 2021 @07:35AM (#27412416)
> Enough with the ECS advocacy however.

Entity/component/system sounds like model/view/controller.

But I like to think of data/logic/presentation. The point being that keeping these dimensions orthogonal is more imoprtant than how they are labeled.

Re:The Repeated Deaths of OOP (2015) by orthoxerox on Sunday June 06, 2021 @08:04AM (#27412574)
ECS is not MVC. Components are data, systems are logic AND presentation, entities are lifetime management.
Re:The Repeated Deaths of OOP (2015) by ehnto on Sunday June 06, 2021 @08:02AM (#27412560)
They are quite different concepts and certainly in practice.

At it's barest, a controller organizes models and renders them into a view.

Again simplifying, an entity has components which describe it's functionality, and the entity can get passed through a system. The entity is the concept of the thing, and the components are it's features. The system uses the features to make decisions about how the entity interacts with the system.

I've never seen MVC used in anything but single-run applications that end with an discrete output. Whereas ECS is more often used in software with a perpetual state and loop, such as game engines.

Exceptions abound.

Re:The Repeated Deaths of OOP (2015) by dragonwriter on Sunday June 06, 2021 @08:06AM (#27412584)
> I've never seen MVC used in anything but single-run applications that end with an discrete output.

MVCs original use was GUIs, which are not “single run applications with a discrete output”, but instead “software with a perpetual state and loop”. Yes, its since been adapted to web use, which usually fits that single-run description, but still...

Re:The Repeated Deaths of OOP (2015) by vbsteven on Sunday June 06, 2021 @09:12AM (#27412926)
Single run VS state+loop is not the best description of the distinction between MVC and ECS. I look at it like this:

In MVC a typical interaction goes like this:

    -> INPUT: user interacts with view
    -> view triggers controller action
    -> controller updates the model
    -> controller passes model to view
    -> OUTPUT: view changes
    -> (rinse and repeat)
The important part here is that there is a single input that flows through the steps and generates output. This maps well to web frameworks where the input is an HTTP Request and the output is the Response. It also maps well to GUI frameworks where the input is a user interaction event and the output is changes to UI on screen. The perpetual "state and loop" for triggering the next input from the previous output is implementation detail and doesn't really matter for the pattern.

ECS is different because it doesn't have discrete interactions converting input->output. Instead they are built up out of a number of systems all interacting with eachother. User inputs enter a system and that triggers a complex flow of other system interactions, eventually generating 0..N outputs.

Disclaimer: I have lots of experience using MVC in various domains, not that much with ECS.

Re:The Repeated Deaths of OOP (2015) by ehnto on Sunday June 06, 2021 @08:21AM (#27412656)
That's interesting, I knew it was a pattern older than it's use in the web but hadn't given it much thought. There's certainly nothing inherent in either design that limits them to either use case.
Re:The Repeated Deaths of OOP (2015) by slver on Sunday June 06, 2021 @12:28PM (#27414198)
Keep in mind the "web" use of MVC originates with Ruby on Rails. Which actually significantly misunderstood what MVC is...
Re:The Repeated Deaths of OOP (2015) by layoutIfNeeded on Sunday June 06, 2021 @08:36AM (#27412726)
>I've never seen MVC used in anything but single-run applications that end with an discrete output.

Wut? Every desktop GUI framework in widespread use is some variant of MVC (i.e. MVC, MVVM, MVP, whatever…).

Re:The Repeated Deaths of OOP (2015) by slver on Sunday June 06, 2021 @08:14AM (#27412619)
> Entity/component/system sounds like model/view/controller.

Maybe to someone who has no idea what ECS is. ECS is not three things named "entity", "component" and "system".

Instead you have entities separated into components which are transformed by one or more systems that operate on all of them in bulk.

There's literally no overlap between ECS and MVC.

> But I like to think of data/logic/presentation.

It's OK to think however you find it useful for yourself. But data/logic/presentation isn't MVC either.

If I have to use these terms, it'd be rather:

- model: data+logic

- view: presentation output processing

- controller: presentation input processing & mapping to model(s).

Re:The Repeated Deaths of OOP (2015) by smitty1e on Monday June 07, 2021 @04:07AM (#27420213)
> model: data+logic

My point regarding orthogonality is that lif is better when the state is pure. Just the database table and its rows.

The logic functions operating on that state are better kept to map, filter, and fold as much as possible.