Getting both better internal and external APIs into Drupal 7
Hello, list. I saw Dries' blog post about the State of Drupal presentation, and I looked through the presentation (for those of you who haven't seen this, it's at http://buytaert.net/state-of-drupal-presentation-september-2007). There is a list, titled "Drupal 7 killer release". It contains 11 items, three of them developer items. Two of them, #9 and #10, are about better APIs. You might scream at me for this, but I think having better APIs would be best solved by converting everything (users, comments, terms) to nodes. However, nodes are too heavy. They have a big hit on performance. My proposed/ideal solution would be to make the node more light-weight. Put fields (CCK-style) and access in it, and that's it (no title, body, extra fieldsets). Beyond that, each type can customize everything. Furthermore, things like content types would be moved specifically into the thing that used to be called nodes. This requires putting CCK or something like CCK in core. While these together may be beyond the scope of a single release, they would bring more power into Drupal, and bring uniformity with them. Back to APIs. To successfully implement them, nearly everything would need to turn into fields. That includes modules like event - it just needs to add fields to a node. The import/export API only needs to deal with nodes fields (since everything is made of nodes and fields), unlike the one done in SoC. The web services need to do the same. Only very complex data types/additions need to implement a hook_webservices or hook_importexport (or maybe we can combine them). Please respond with your criticisms! dmitrig01
a) field API is coming. once CCK D6 is out, we will examine the situation. b) There is already talk and code how to add relationships to schema API thus making node loads (mostly) one query. Some are considering on-demand loading. c) Also there is talk and code on how registry module hooks. This will also bring some benefits. d) I plan on working on code to load multiple load at once. Removing body & friends buys us nothing. Turning into user nodes - nay. User profiles -- maybe. Comments -- yes. Regards, NK
I am proposing removing body, title, revisions, and anything like that from the base object of node. Those get added specifically to what is now node. I also agree with the fact that users can't/won't be nodes, but I think profiles should. However, that would require nodes (profiles) to be bound users - this could be viewed as good or bad, depending on how you look at it. Dmitri On Dec 29, 2007 1:29 PM, Karoly Negyesi <karoly@negyesi.net> wrote:
a) field API is coming. once CCK D6 is out, we will examine the situation.
b) There is already talk and code how to add relationships to schema API thus making node loads (mostly) one query. Some are considering on-demand loading.
c) Also there is talk and code on how registry module hooks. This will also bring some benefits.
d) I plan on working on code to load multiple load at once.
Removing body & friends buys us nothing. Turning into user nodes - nay. User profiles -- maybe. Comments -- yes.
Regards,
NK
Dmitri G wrote:
I am proposing removing body, title, revisions, and anything like that from the base object of node. Those get added specifically to what is now node.
I also agree with the fact that users can't/won't be nodes, but I think profiles should. However, that would require nodes (profiles) to be bound users - this could be viewed as good or bad, depending on how you look at it.
I think revisions are currently integral to nodes and must say. Titles are currently required for administration purposes. Titles must stay, but there should probably be a good way to get programmatic titles. The fact that we have at least 4 implementations of node profiles floating around contrib suggests that there is a lot of impetus in doing this. And comments are, I think, very important. There are a few critical forum features that require that forum replies have all the privileges of nodes.
On Dec 29, 2007 1:58 PM, Earl Miles <merlin@logrus.com> wrote:
Dmitri G wrote:
I am proposing removing body, title, revisions, and anything like that from the base object of node. Those get added specifically to what is now node.
I also agree with the fact that users can't/won't be nodes, but I think profiles should. However, that would require nodes (profiles) to be bound users - this could be viewed as good or bad, depending on how you look at it.
I think revisions are currently integral to nodes and must say.
They are to the types of nodes we have now, but I'm proposing that those could be in the Drupal 7 version of what are nodes now, because I'm not sure it would be best
Titles are currently required for administration purposes. Titles must stay, but there should probably be a good way to get programmatic titles.
Again, the titles will be specific to the D7 version of what nodes are now. The node will get re-defined :D The fact that we have at least 4 implementations of node profiles
floating around contrib suggests that there is a lot of impetus in doing this.
Agreed. If we do it in core, then it will be more integrated. And comments are, I think, very important. There are a few critical
forum features that require that forum replies have all the privileges of nodes.
Again, the node will be re-defined. I am proposing that the node will really really change
Dmitri G wrote:
I think revisions are currently integral to nodes and must say.
They are to the types of nodes we have now, but I'm proposing that those could be in the Drupal 7 version of what are nodes now, because I'm not sure it would be best
Titles are currently required for administration purposes. Titles must stay, but there should probably be a good way to get programmatic titles.
Again, the titles will be specific to the D7 version of what nodes are now. The node will get re-defined :D
I disagree with both of these positions. Revisioning has little to do with types of nodes; it has to do with administration of nodes and must be at the lowest level in order to work. If you try to move it, you'll just break it and we'll lose very important features. Likewise with titles, I'm not sure that it's likely to be possible to administer any kind of node system without titles of some flavor. I disagree that the node system should change that much.
better APIs would be best solved by converting everything (users, comments, terms) to nodes.
Let's clarify the problem and look at the various options folks have taken or mapped out. Currently we have various different object types (nodes, users, terms, etc.), each with their own distinct APIs. Of these, nodes are most fully developed and have various properties and features (an access system, revisions, etc.) not available to other objects. Problems: a. Difficulties, duplication, barriers, etc. introduced by having distinct APIs and custom methods for each object type. b. Non-nodes are second-class objects, lacking much of the powerful node APIs. Potential solutions: 1. Parallel implementations. Create parallel implementations for other object types, giving them the functionality that nodes have. E.g., a taxonomy access system similar to the existing node_access one. 2. A node type for every object type, a node for every object. Create special node types to extend other objects, e.g., a 'user' (or user profile) node type, enabling non-node objects to receive node properties. The various node profile approaches fall into this category. 3. Everything's a node. Make everything a node, with specific object types (e.g., users) extending the node object. 4. Generalize node APIs. Take a lot of what currently is node-specific and generalize it so that it can be applied to any object type. E.g., rather than the node access system, an access system for any object type. A potential example to work from here is the search indexing API, which, while implemented only for nodes in core, nonetheless tracks a search 'type' that could be any object type. 5. New base object type. In addition to 4, introduce a new minimal base object type that all object types (nodes included) extend. Of these options: 1 and 2 have often been tried and, I think, most developers would agree they are at best only stop-gap solutions. 1 doesn't address problem a (difficulties, duplication, etc.). 2 introduces various problems of synchronizing, automating, etc. 3, everything's a node, is understandably attractive but has limitations that have been pointed out: nodes come with a lot that may or may not be applicable to other object types. Which in my view leaves us with 4 and 5 plus any other approaches creative minds may add to the list. Henrique Recidive and I worked with approaches 4 and 5 in sketching out ideas for D7 data APIs in "Data APIs for Drupal 7 and web services support", http://groups.drupal.org/node/6767 and "Active Records, a possible approach for consistent Data APIs", http://groups.drupal.org/node/6772.
Users as nodes has 3 modules at least in contrib: - bio: the most straight forward of them. - node profile: a more complex way. - usernode: the original concept. The need to customize how profiles look is the driver here, plus cck and views. Core profile should go away soon, replaced by node + cck. As for revisions, if we can turn them off on a node type basis, it would be a huge performance boost in many cases (avoiding extra joins). -- Khalid M. Baheyeldin 2bits.com http://2bits.com Drupal optimization, development, customization and consulting.
participants (5)
-
Dmitri G -
Earl Miles -
Karoly Negyesi -
Khalid Baheyeldin -
Nedjo Rogers