Inside Paulo Abrantes' head
[ start | index | login or register ]
start > 2008-02-29 > 1

Software Developing: Studying The Bliki Domain Model

Created by pabrantes. Last edited by pabrantes, 128 days ago. Viewed 565 times. #6
[diff] [history] [edit] [rdf]
labels

Software Developing: Studying The Bliki Domain Model

The bliki concept has always been interesting. Merging the capabilities of a wiki platform with a blogging platform is a breakthrough because it allows a user to create various content that may or may not be a blog entry in a rather simple way. This isn't a new concept, according to Martin Fowler it's around since 2003(>>information from wikipedia), although it's not a widely used piece of software. Nowadays it's very usual to use blogging software or wiki software, but somehow the fusion between those two types of software seems to be forgotten by the general user.

When I started using SnipSnap and later developing code for it, not only my interest for blikis grew but also, allowed me to understand and put in practice the concepts that exist in this kind of software. SnipSnap isn't complete or perfect but learning how it works was a pleasant and instructive experience.

Lately, I've been looking into other blikis software in order to understand what is really the business logic and the underlying model. This post summons up the ideas and model I've thought.

This time example code isn't being provided, because it doesn't exist. The ideas below are purely conceptual and there is currently no source code implementing them. In my opinion, it seems a good model, but different people have different views from the problem so the objective of this post is to create discussion regarding the topic.

I've broken down the model into three parts, they are the Entry Model, the Meta Data Model and the Access Control Model. I'll be addressing separately to each one of them.
Readers should pay attention that some relations are only interesting in one of the models, so in order to save visual space those relations won't be represented in the other two models, but that doesn't mean it's not there.

The models below were designed with a domain driven design philosophy, anyone interested in learning more about such kind of architecture may read the following posts:

Let's now start with the entry model.

The Entry Model

This part of the model is the actual bliki's core. The Entry entity represents nothing more than information inserted by the User. In this kind of software three different types of entries were identified, they are:

  • Wiki Page
  • Post
  • Comment
The names are self explanatory, but that doesn't explain the logic that each one of this kind of entries contains.
For example, in my opinion, a Wiki Page has to support sub pages (not to mention history). The sub page concept should be understand as wiki pages children that create a page hierarchy. Also, I believe that any type of entry must allow - if permitted by the access control, of course - comments.
Some readers might be asking why isn't Blog listed as an entry. That happens because, a blog is nothing more than a container of Posts, it's not information inserted by the user but rather something that knows how to display some specific information.

entry-model But let's see in a more detailed manner the domain regarding the Entry Model that can be seen on the right.

The Entry entity has three sub-classes which are the types previously mentioned. Entries can contain other entries, which is the way to preserved the historic of entries. During implementation certain verifications need to be part of the business logic in order to only allow entries that are historic to be added in this relation. There's also another interesting relation in the Entry entity, any type of Entry allows comments, notice that this allows for comments to contain comments. At first this mind sound confusing, but it's actually the representation of a message thread.

Besides that, an Entry has an owner, which is a registered User within the bliki and an entity that represents all it's meta data called Meta Entry. We'll talk more about this last entity soon.

Regarding the Blog entity, like has been said it's not an Entry but a container of Posts. It also contains a list of editors, which are registered Users.

Finally there's the Wiki Page entity. This entity also uses the Composite Design Pattern allowing an hierarchy of pages. This entity can also be more specific such as a Wiki User Page, which is directly connected to the User or a Groovy Script Page.
A Groovy Script Page would contain Groovy code - more about Groovy in >>Java Programming: Getting your code spicy with Groovy - that would be executed at runtime. Although it sounds a shiny feature it's probably useless and it doesn't really need to exist in the model, that is why it was chosen to be represented with dashed lines.

The main ideas used when creating this part of model were the following:

  1. There are three different kinds of entries;
  2. Every entry has an owner;
  3. Every entry can be commented;
  4. It's good to have message threads support in the model;
  5. Every entry has historic;
  6. Every entry has meta data;
  7. Wiki Pages have to allow hierarchy;
  8. Wiki Pages may be extended for more specific behaviour such as pages for bliki's users.
Meta Data Model

From the three, this is probably the simplest model. The idea of this model is to understand what is the Entry's meta data and how it should be placed in the model. The Meta Data entities identified were the following (although there may be more):

The Meta Entry entity exists because if this meta data entities were directly connected to the Entry when a new version would be created the meta-information would have be copied (not actually copied since it was only references moving around). The problem with that - besides information not being centralised - would be the duplication of meta information creating strange scenarios.

meta-data-model For example, imagine a certain Tag T1 connected to an Entry E. After edition of E, there would be E and E', if the Tag was directly connected to the Entry both E and E' would be tagged with T1, that means T1 would have two entries but they were actually the same entry but in different versions!

Also, upon the presentation of the Access Control Model we'll see that there is once again the need to have an entity that represents not only the current version of the Entry but also all its historic.

Even though meta data entities have been presented, it wasn't yet explained what is a meta data entity. An Entry object regarding the information it holds contains a limited set of explicit - somehow directly inserted into the system - and implicit - in a way the system infers it - of information regarding the entry but without actually being the information it holds, hence called meta information or meta data.

Other examples of meta data can be the number of views a certain entry had, the number of editions, among other parameters that themselves can be part of the actual Meta Entry and do not need to be represented by an entity.

Regarding the guide lines that were used when creating this part, there was only one the Meta Model must be transversal to the Entry historic.

Access Control Model

This part of the model defines the access control for the bliki's >>CRUD operations. The access control is defined through rules, which have been limited to three different types:

  • User Rules
  • Group Rules
  • Role Rules
Each one of this kind of rules contains a tuple. One is the operation, the other is the User, Group or Role according to the access rule type.

access-control-model Like it can be seen in the model on the right a Group is nothing more than an aggregation of Users. Also, since a certain User should be able to be in more than one group the relation between both entities is many to many.

Another concept introduced with the Access Control Model is the Role. Every User has a set of roles. Examples of roles in this sort of applications may be, for example, admin, editor, blogger among others.
Defining access control using roles can be seen has defining access control for groups where the groups are defined by the system instead of the User.

The current model does not support composition of rules but that may be an interesting feature to add.

The main concerns when creating this part of the model were:

  1. The entry access control is transversal to the historic
  2. It should be able to define access control for a given user, group of users or a role
  3. The operations that are submitted to access control can be reduced to CRUD operations
Final Thoughts

By no means this model is being presented as the model. This is only a result found for the question "how is a bliki domain model?". It's not perfect, it may be flawed or have things missing. It actually should be seen as a first draft and it's totally open for discussions about the subject.

Even thought while writing this post there was the effort to see all the blikis that exist in order to summon up the knowledge that each piece of software contributes it's impossible to be sure that everything was seen - most likely it wasn't - and nothing was overlooked - most likely there are things overlooked. Once again discussion about the subject is probably the best thing to be done.

I'm also providing the >>complete model image for anyone interested.

Finally, I suggest the reading of the >>wikipedia blikis page.

Hope it was an interesting reading.

Icon-Comment m4ktub, 127 days ago. Icon-Permalink

I won't discuss the accuracy of the model you purposed because, obviously you're better informed than me about real life requirements, works, and works not in the bliki world but some questions came up to me.

When coming up with a domain model you need to define a certain granularity threshold so you don't end up modeling words, characters, bytes, etc. Do you have a specific metric for this case, that is, have something like "That concept is too low level" or "That's over engineering" while drawing the model? (Note that I'm not suggesting you over engineered, on the contrary)

That was just a curiosity. About the domain models, why isn't post a wiki page? Are you already considering presentation issues here? "Converting" the concepts of the entry/meta data model into web pages requires a whole sub model do be described.

Other thing that came up to my mind what that you are sticking with "… and then we have the Blog, which is not an entry, that is a collection of posts..." and probably you live better with a generalization of what blog is. Imagine a vwiki. A site like youtube were all textual content are wiki fragments and the video is probably an attachment. Or a swiki. A social site were peoples profiles are wiki pages and relation between people are made through wiki links, labels, comments, etc. Or even a wikizilla. A bug tracking system were issues are wiki pages with comments and attachments and all (actually Trac is such a beast).

While talking about blog's concept generalization an epiphany about wiki fragments and composition was forming but never mind it's gone smiley

What I'm saying is that generalizing what Blog is in the entry model may bring a lot more potential, better prepare you for the presentation issue and generate a bag of new questions/problems.

PS: I can never remember snipsnaps's wiki syntax, bah

Icon-Comment pabrantes, 126 days ago. Icon-Permalink

First of all thanks for your comment smiley

Regarding your first question about the granularity threshold, I really don't have a golden rule, it's all about feeling.
Mainly I tried to model the "Language" used when talking about blogs and wikis logic where things like "Post" and "Comment" exist, but things like "text" or "image" don't (those collapse in information). But like I told you it was mostly about common sense.

About the domain models, why isn't post a wiki page? Are you already considering presentation issues here?
m4ktub

Well no, I'm not considering any presentation issues here, actually I haven't yet thought anything regarding presentation using this model.
The Post entity isn't a subclass of Wiki Page, because a Wiki Page may contain an hierarchy of other wiki pages, this means we can see a Wiki Page as a container. On the other hand, and in my opinion, the entity Post is an element. That means that I don't want to have an hierarchy of Posts inside other Posts, or Posts with other type of wiki pages. That's the reason why I didn't model Post as a Wiki Page.

"Converting" the concepts of the entry/meta data model into web pages requires a whole sub model do be described.
m4ktub

Couldn't agree more! That's something I still have to think about though.

Strangely your epiphany sounded very similar in some parts smiley But regarding the Blog being or not an entry.
When I started sketching this model, actually, the Blog was a subclass of Entry. But then I realised that a blog doesn't have historic, access control or comments. Those properties are only in the posts that are contained by the blog. That thought created a "driving force" to take the Blog out of the Entry class hierarchy and make him a collection of posts.

But like I said on the post this isn't The but a model. Model that can be flawed. If you would put Blog in the Entry class hierarchy, how would you do it?

PS: Regarding snipsnap'p wiki syntax you can always check, snipsnap-help smiley

Icon-Comment jff, 125 days ago. Icon-Permalink

Hi Paulo! Overall, it looks good, but I didn't understand properly the following part:

"For example, imagine a certain Tag T1 connected to an Entry E. After edition of E, there would be E and E', if the Tag was directly connected to the Entry both E and E' would be tagged with T1, that means T1 would have two entries but they were actually the same entry but in different versions!"

If you edit E, why would you get a different entry E'? And shouldn't entries with different versions considered different entries? And what happens if tags change from version for version?

Cheers, Joao

Icon-Comment pabrantes, 125 days ago. Icon-Permalink

Thank you for your comment João smiley

Let's see if I can clear the misunderstanding.

If you edit E, why would you get a different entry E'? And shouldn't entries with different versions considered different entries?
jff

If you see the model you'll notice there is a composite pattern applied in the Entry object, where is said it represents the historic. That means when you edit an entry E, you're actually creating a new one E' related with the previous where the only different is a higher version number and the information changed due to edition.

And what happens if tags change from version for version?
jff

I'm not considering such scenario. Mainly because I think that what really matters are the tags for your current content, not from some in the historic. Plus I also don't think the tags will change along an Entry history, most probably they'll stay the same or at most probably some will be added.
Of course I may be wrong.

Icon-Comment jff, 125 days ago. Icon-Permalink

Is is easy to find examples where you would want to delete tags from one version to another.

Also, am I correct in saying that if you delete a tag from one version to another, and then if you revert to the previous version, you'll loose the tag?

Maybe something's missing me smiley

Thanks, JFF

Icon-Comment pabrantes, 125 days ago. Icon-Permalink

Also, am I correct in saying that if you delete a tag from one version to another, and then if you revert to the previous version, you'll loose the tag?
jff

Yes, you are correct.
You're seeing the Tag as a concept that relates with the various version numbers independently and I'm seeing the Tag with associated to the conceptual entry, independent from its version number.
I see things the that way because to me Tags aren't version dependent.

Please login to www.pabrantes.net.
Who am I?
paulo-roca2My name is Paulo Abrantes AKA pabrantes and I'm a software developer. I'm currently employed at >>CIIST working as a Java developer in >>FenixEDU.

This blog is mostly about Java programming, domain driven design and snipsnap bliki developing. Everything written in this blog is my personal opinion and it may not reflect the opinions of my employer and co-workers.


Blog subscription
subscribe by rss subscribe by email

Links
>> Home
>> Paulo's Profile
>> Post History
>> Add to Technorati Favorites
>> Paulo's Photo Gallery
>> WishList
>> Posting without Login

Search Blog
Fellow Bloggers

Recent Posts

Java Programming: Bytecode Injection
Intermission: Sorry For Downtime
Software Developing: Studying The Bliki Domain Model
SnipSnap Developing: Trying to settle a roadmap
System Administration: Load Balancing with Apache
Blogging: Two years have passed
Software Developing: The SnipSnap Saga
Java Programming: Getting your code spicy with Groovy
Software Developing: Fluent Interfaces
Software Developing: Implementing a ShoutBox on SnipsSnip
Software Developing: SnipSnap, SnipIt and SnipSnip
Java Programming: Proxies and Access Control
Java Programming: Proxies and References
Java Programming: References' Package
YALM: Yet Another Layout Modification

For older posts, please refer to post-history for a complete Post History

Logged in Users: (0)
… and 13 Guests.
This is a modified version of snipsnap.org created by >>Paulo Abrantes