6 ms·
I would love this! In fact the QML format would not even be a terrible way to write non-UI applications, I'd think. Something like MySqlDataBase { i
by stabbles 7y ago
I would love this!
In fact the QML format would not even be a terrible way to write non-UI applications, I'd think. Something like
MySqlDataBase {
id: default_db
host: ...
}
UserController {
items_per_page: 20
formatter: UserFormatter {}
repository: Repository {
table: "users"
database: default_db
}
}
is definitely more easier to follow than the linear version
auto default_db = std::make_shared<MySqlDataBase>("...");
auto userformatter = std::make_shared<UserFormatter>();
auto repository = std::make_shared<Repository>("users", default_db);
auto controller = std::make_shared<UserController>(20, userformatter, repository);
especially when you do some kind of constructor injection with nested objects. The declarative tree structure of QML is great.
- dkersten 7y agoYes! You can already do it, but you pay a lot of overhead in unneeded QObject/QQuickItem features that you don't need, so if they can improve that, and it sounds like they're working on it, then I think that would be fantastic.
- halflings 7y agoIt doesn't look as bad if you skip the intermediate variable declarations, since you're not re-using those variables elsewhere. (the QML structure only works as long as this is the case, e.g clear nesting of instances)
- dkersten 7y ago> clear nesting of instances You can have references (default_db in the example) to instances to have indirectly nested instances too.
- deleted 7y ago[deleted]
- p2t2p 7y agoBeen there, done that, SQL queries in JSP. Trust me, you don’t want your business and data access layers mixed with your presentation
- Octoth0rpe 7y agoThat's not what they're suggesting though. The suggestion is to be able to implement business / data access layers in the same style/language that people are implementing their presentation. That the two would be intermixed could certainly be an intended consequence / anti pattern, but I don't think it's inevitable.