The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

database question

Hi!

it's been awhile since I've done db work. I know the answer's gonna be simple, but i just cant get my mind in gear this morning.

I'm putting together a system that generates websites. The three entities I'm having trouble with are Content, Pages and  Menus.

Content is essentially that, content for the templates. Pages are types of content, like products, or news. Menus are simply a list of pages that varies according to the content.

I'm not entirely sure how to represent all this in my database and object model.

any ideas?

thanks!
Guillaume Send private email
Wednesday, January 10, 2007
 
 
I'd advise you to download an open-source content management system like Drupal or Postnuke, or maybe DotNetNuke if you'd prefer .Net to PHP.  You may find that you can use one of these systems as-is, but even if you can't, these systems will give you an excellent reference for how others have solved the same problems.
D. Lambert Send private email
Wednesday, January 10, 2007
 
 
+1 to Lambert.

I'd also warn you that this is the kind of problem that sounds simple in theory, but quickly bogs you down in details. If you have the option, decline this kind of project. If you're still determined, you may want to focus on satisfying the requirements of a particular niche, such as websites for the Blind as opposed to being a one size fits all solution.

Keep in mind that even the placement of page elements (such as the navigator) is "content" as well. I'm not familiar with the specific frameworks Lambert recommended, but the "enterprise grade" ones I've seen actually take more of a libraries, executables and flat files approach instead of a database centric approach.
TheDavid
Wednesday, January 10, 2007
 
 
thanks for the info, but I've already went over these systems, but their implementation is very different than mine.

I'm not looking for a silver bullet. Just something that make it possible for the end users to be able to create menus easily and use these menus from the content pages.

Basically, i don't want my customers calling me simply to add a menu item in the navigation, or if they want to change the order in which they are displayed. http://script.alico.us have very cool controls do do some of the things I'm after.

Details: i use Smarty for templating and use nearly 100% CSS for layout and design.
Guillaume Send private email
Wednesday, January 10, 2007
 
 
Guillaume wrote:

  "I'm putting together a system that generates websites.
  The three entities I'm having trouble with are Content, Pages
  and  Menus.

  "Content is essentially that, content for the templates. Pages
  are types of content, like products, or news. Menus are simply
  a list of pages that varies according to the content."

I'm a bit confused by this: are you saying that you have something in the system called a "page" which doesn't represent a web page, but, rather, represents a type of content? Why are you calling it a "page" for heaven's sake? The definition of the term "Menu" is similarly confusing, and is only made more so by the indeterminate relationship to "Content".

Also, without knowing what sort of internal structure these entities have, I don't see any way to give meaningful advice. If these are atomic entities, then it would seem axiomatic that you would have one table per entitiy class (tables CONTENT, PAGE and MENU). If these entities are NOT atomic (i.e. they are composite entities with internal structure) then you need to implement tables that allow the appropriate internal structure, and we can't advise you on that without further explanation.

In all, It looks to me as if you don't have a very firm grasp on the requirements of this project, since your use of the project terminology is vague and confusing. I would recommend that you get a better description and understanding of the requirements before proceeding with further design work.
Jeff Dutky Send private email
Wednesday, January 10, 2007
 
 
All the entities are atomic, and have a seperate table in the db.

To be more precise, a 'page' is a TYPE of content. I agree the term can be misleading, and i'll be sure to clean that up a bit...

Here's a better analogy:

menu is similar to the list of links to the top left of this forum.

page is similar to the different forums here ( design, business, jos )

and content items are like forum threads

After playing around all afternoon, i've figured the best way is to have a field for the page and one for the menu in the content table.

When i instantiate a content object, i also create the proper menu object
Guillaume Send private email
Wednesday, January 10, 2007
 
 
"...menu is similar to the list of links to the top left of this forum."

What happens if your customer wants two menus?  Or a list of links on the right hand side and a list of links on the left hand side, with presumably empty space in the middle? Or a logout in one corner and a vertical menu on the other side?

It sounds like what you want to do is give your customer an HTML editor, but limit and control the things they can do, and save everything within a database.

The problem as we're telling you, is that a relational database (as opposed to a spreadsheet) is the wrong kind of storage mechanism because it doesn't allow very much flexibility... err... you can't dynamically define columns as you need them.

But, as I said earlier, it is doable if you deliberately define yourself to a narrow niche. You could for example set it up so that your customers can create forums, but that's all they will be able to do with it. Once you've defined a set of specific features and options that you will offer, it becomes very easy to come up with the database schema.

Assuming that you are creating forums, I think you've got the foreign key relationships backwards. "Page" should be the object du jour, and should contain "Menu" and as many "Content" as you need. It's probably easier to think of it as a "site" consisting of "pages", each one consisting of one "menu", one "logo", one "copyright", one "login", one "logout", and X number of "forum topics".  Each "forum topic" consists of another "menu", "login", "logout", etc etc and Y number of "forum posts".
TheDavid
Thursday, January 11, 2007
 
 
I'm researching the slightly similar concept of data model patterns. This link might be useful.

http://www.databaseanswers.org/data_models/index.htm

Cheers,
Franky
Franky
Thursday, January 11, 2007
 
 
If Page means an a view of your site that can be rendered in HTML, then it is useful to think of it as a Container.

Given that you use a forum metaphor, in such cases each Container would be considered a template, of which you are able to load other content data, which would include regular Content or Menu (a special type of content that is a list of links).
Yin-So Chen Send private email
Thursday, January 11, 2007
 
 
This sort of requirement has a way of quickly turning into a need for a full-blown content management system. Even if what they're asking for right now is simple, expect them to ask for more once they get it. I've been there. A couple of years later my simple, one-day project along those lines is now sitting at 46KLOC.

If I was you I would use an the shelf CMS unless there was some truly compelling reason not to.
clcr
Friday, January 12, 2007
 
 
thanks for the points of view! I've pretty much got it down now.

My only goal right now is to produce a limited cms. It's geared to ppl that are very new to computers, so i cant ask too much of them in that regard.

thanks!
Guillaume Send private email
Monday, January 15, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz