Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


The module management mess

Of modules and men

As you are probably aware, DNN’s extensibility model allows me to create a “module” which is delivered as a zip file, uploaded by the host user, and then instantiated on a DNN page. You’ll then see a rectangular box appear on the page with whatever I invented in that box (the “container”). What you may or may not realize is that actually three “things” were created when you installed the module and two more things when you dropped it onto a page. The three things that were created when you installed the module were a “package”, a “desktop module” and a “module definition”. The two things that were created when you instantiated the module were a “module” and a “tab module”. Say what? Yes. In a couple of clicks there are now 5 things at play whenever you look at the box with its awesome content on your site. So for the noobs and as a refresher for those not daily buried in DNN programming, here is a small glossary:

Package A package is any zip file that can be installed into DNN. It includes, but is not restricted to modules. I.e. skins and authentication providers are also packages. You can even have a package with just a dll that you want installed. Packages are recorded in the “Packages” SQL table. This is where you’ll find fields like version and manifest.
It’s also important to note that the package is the latest addition to this list. Before the entry point for installation was the desktop module.
Desktop Module A desktop module (the “desktop” bit is heritage from the IBuySpy days where we might also want to target “mobile” modules) is a complete module. It has an ID (“Module Name”) which you must never change as DNN uses it to keep track of it during upgrades. It also has a version and a path to where it is installed.
Module Definition The module definition tells DNN which ascx to load and when. So typically you’d have a default ascx to render when you first come to the page and some edit ascx to load whenever you click the edit link. The module definition is specified in the module’s manifest and the data is stored in ModuleDefinitions and ModuleControls in SQL (the latter contains all the ascxs).
Module So when you instantiate the module (i.e. add it to a page) a record is created in the Modules table in SQL, telling DNN which module definition this is. Not more? Well, a few more details, but basically that’s it. The Module ID that is generated serves as a hook to the data associated with the module (e.g. ModuleSettings).
Tab Module “Tab” modules? Yes. “Tabs” are IBuySpy lingo for “pages”. And the Tab Module is actually a record of a specific module on a specific page on your site. You may have seen DNN’s ability to copy modules where you “reference” the original? That is actually creating a new Tab Module off the existing module. The data then remains the same in both instances as mostly data hooks into the Module ID.
Tab modules have their own ID (TabModuleID) and their own settings (TabModuleSettings). This is also the place where the title is set and other properties you see in the module settings screen.

The messy bits

The above has grown organically over the years. And it is not hard to see where the architects have been jumping through hoops to get it to do what they wanted. So there is duplicate data between Desktop modules and Packages (version, path) for instance. There are legacy bits of data with their own history. E.g. originally there was no “FolderName” in desktop modules and the “ModuleName” was taken to be the folder name. Older modules (like my own DMX) still carry the module name as a path (“Bring2mind\DMX”) so the module would install to the desired place. There are more oddities that have crept into this system. But one major source of pain is that the technical implementation of this system (i.e. those 5 entities) are reduced to two entities on the front end. Users manipulate modules and are happily unaware of what is happening behind the scenes. And this is all fine when we’re dealing with a module like the HTML module. But it gets messy when we look at more complex scenarios.

Complex modules

With “complex”, here, I mean: modules that need more than one “box” on the site to work. A common example is a shop module. A shop module typically has some kind of browser (i.e. where the user looks up the product of desire), a cart (giving the user feedback on what he/she has clicked to buy) and some form of checkout (payment, yeah). It is undesirable to have all this in a single box. So DNN has for long supported this notion of “multiple module definitions per module”. In your manifest you’d list the various definitions and when a user would instantiate the module, DNN would add each definition to the page. And this is where things get quite messy. It can be quite overwhelming to a user to see all these modules appear on the page at the same time. Like the page just took a hit of buckshot. Boom. The page is suddenly filled with boxes. And the title of each box should give a hint as to what each box does.

The old Blog module took this approach. If you instantiated version 3 on a DNN page this is what you’d see:

image

As you can see, the module titles give some clues as to what each is for, but if you’re new to the module, it is all quite baffling. The idea is to then move these boxes around on the page so it will look a bit more presentable. With the main content in the main part of the screen and the auxiliary content on the side.

The problem with the “multiple definitions per module” model

The biggest problem is not that the plethora of modules on the page can be confusing, however. The biggest problem is that DNN has no way of managing them individually. That is: the DNN UI is all about modules, not module definitions. For instance: let’s assume that after instantiating the old blog module we have no desire for the categories box as we’re not using those. So we can click “delete” from the module dropdown and it’s gone. Now, let’s assume that a few years later you want to reverse this decision (and you’ve emptied the recycle bin). There’s no way to do that. You can’t say: add the categories definition back to this page. You can only add a completely new instance of the module to the page (eeeew).

The other scenario where this becomes poignant is when your definitions should typically go to different pages (e.g. shopping module with checkout on a different page). Although you can go to the module’s settings and make it hop to another page, it is unnatural. The “DNN way” of doing things is to go to a page and add the module you want to the pane you want. Again, this is where the DNN UI is lacking in its ability to control individual definitions.

In my opinion this has been a major oversight in the implementation of modules and module definitions. You may say “o, edge case”. And you’re not necessarily wrong. But as a module developer you want to cater for all scenarios, even the unintended ones. And this is one where we’re stuck. So in version 4 of the blog module (when I first contributed code) I decided to add at least a management panel to the main module definition so users could add the parts individually:

image

The other workaround is to create a package with multiple modules. Since packages were introduced in DNN 5, this is now a possibility. NBStore (the most successful open source store for DNN) uses this approach. Naturally this leads to bloating of the module list. You end up adding modules to the list of modules that you’re only likely to use once:

image

I find we’re left jumping hoops here. It’d be better if we all sat down (well, maybe not all of us) and had a long hard think about how this should work. I.e. how should the end user work with “complex” modules and how can we implement this in a way that is consistent across the UI and the technical domain?

Blog version 6

A final note on how I’ve approached this for the new blog module. In the new blog module I’ve done away with the multitude of definitions. As mentioned above I find them confusing to the end user and just not well implemented in the core. It also becomes quite a mess managing a whole bunch of ascx files that belong to different definitions. More code to manage = more vulnerabilities.

One of the main objectives in the rewrite was to allow the module to be “templateable”. That is: it should be easy for others to adapt the display of the module’s content to suit their needs. And realizing that the other module definitions were mostly rehashes of the same data, the approach has been to deprecate the existing definitions in favour of templates. So a category list becomes a template. The “archive” (actually a calendar where you can browse back to older posts) becomes a template. Etc, etc. And the main view becomes a template, of course. Here’s a screenshot of my dev installation:

image

Equally you could pump it out to a TimelineJS template:

image

The possibilities are endless (well, almost). So how does this wire up? Well, there is now just one definition that is pretty minimal. A few management ascxs and the main templating ascx. This has made it somewhat easier to keep an overview of all the controls. The module now keeps its data per module (and no longer “per portal” as before) which means that every “slave module” has a module setting pointing to the “master module”. I.e. the module where the data is:

image

You also get a dropdown which template to use and whether to restrict the data to a particular blog, author or category. These settings are stored as TabModuleSettings. Meaning that even if you copy the module, you can still set this individually. I’ve kept the button to add new definitions of the module on the same page as the main module:

image

So it should still be easy to add the calendar etc to the same page. But with the new module, once you’ve instantiated the module, you now only see the main definition on the screen and you begin working from there.

Now I have no illusions about the fact that this is not how everyone would like things. We have to jump through hoops and every module developer has their own opinions on this. So when the bar stools start flying late at night during one of our awesome conferences, it could well be because we’ll probably not be able to agree on a single approach. Which is why I hope we can open the debate before the conference Winking smile, while we’re still at safe distance from each other (just kidding, we’re all very pacifist people, us developers, right?).

Comments

DnnModule.com
Great blog. Yes, it is not a easy thing to handle multiple module controls in DNN. For example, we have over 14 sub modules in our Classified Pro 7.9 (a e-commerce module which supports store, auction and classified ads) package. We choose the same way as NBStore to package all these 14 sub modules, but customers always feel confused when meet so many module definitions. We are still looking for a more straightforward method to handle this dilemma.
DnnModule.com Monday, November 4, 2013 11:31 PM (link)
Han
Peter, great blog post and very good explanations about what's going on behind the scenes concerning module instantiations.

I've used your latest blog module quite a bit and I really like the approach you took with this "complex" module. I think it's less clutter and more intuitive than other approaches I've seen so far. Great work!

Han
Han Friday, January 10, 2014 3:10 PM (link)

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out