Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 10th, 2006, 7:27 PM   #1
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
My research into forum design

With all this talk of forums and community projects, I've found myself considering the best way to go about designing an extensible web-based forum system. It occurs to me that it may be a good idea for me to document this process. Someone else on these forums may make suggestions I hadn't thought of, and perhaps some people may find my approach to the development process to be of some interest. I also find that writing sometimes helps me to clarify my thoughts.

Research

The first step was to decide on a choice of programming language, as this would affect my search for useful tools and libraries. This choice is not set in stone, but it helps to make a sensible choice to save wasting one's time. I chose PHP, primarily for its ubiquitous nature and ease of use. A PHP based forum would be far easier to install than one coded in Python or Ruby, and developers may find PHP's realtively basic syntax easier to get to grips with.

Next came the hunt for suitable tools to make my life easier. I design web applications by trade, and I've found frameworks like Ruby on Rails to be valuable time-savers. Fortunately, PHP has some Rails-clones, and whilst they are nowhere near as advanced, they will save me from writing a lot of redundant code. The main web frameworks I found were: Symfony, CakePHP and Code Igniter. They take a similar approach to Ruby on Rails, and unfortunately for me, all suffer from the same flaw.

Problems with modularity

Let me clarify. In Rails, the web application is split up into a number of task-orientated directory. You have a directory called "models" where the database integration takes place, a directory called "controllers" which contains the internal logic, and so forth. All of the PHP frameworks take a similarly structured approach.

That's fine. It's very good practise to divide your code into discrete segments. The problem is that the way it is divided up does not lend itself to a modular approach. Ideally, one would want a directory for each module, keeping the code for each separate. Systems like Rails aren't designed for that purpose; often, there is only one folder for each task. One of the problems with many of these frameworks is that you can only have one "views" folder, meaning that your module's templates have to be mixed together in one directory. Not very modular!

Finding a modular solution

Two choices presented themselves. I could forget about the idea of using such a framework; or attempt to alter an existing framework to do what I wanted. The latter seemed more attractive, as it meant less work, but I wouldn't know for sure until I evaluated how easy the systems would be to change.

I didn't have time to go through the code of all three frameworks, so I made a choice and chose Code Igniter. It's the most lightweight of the three, and looked the most intuitive to use. Programmers unfamiliar with web frameworks would find it easier to understand then more complex solutions, and there would hopefully be less for me to do to get it to a modular state.

Examining the code

I took a look at the index script for Code Igniter, and my eye fell upon this:
php Syntax (Toggle Plain Text)
  1. /*
  2. |---------------------------------------------------------------
  3. | APPLICATION FOLDER NAME
  4. |---------------------------------------------------------------
  5. |
  6. | If you want this front controller to use a different "application"
  7. | folder then the default one you can set its name here. The folder
  8. | can also be renamed or relocated anywhere on your server.
  9. | For more info please see the user guide:
  10. | [url]http://www.codeigniter.com/user_guide/general/managing_apps.html[/url]
  11. |
  12. |
  13. | NO TRAILING SLASH!
  14. |
  15. */
  16. $application_folder = "application";
This was both good and bad news. The application folder is where a developer puts their custom code. Having a variable like this is good, because the application folder can be customized, and bad, because it limits the customization to just one folder. For a modular system, I'd need the ability to divide up the application folder into modules.

I looked through the file further and noticed that $application_folder was tied to the APPPATH constant. I grepped the Code Igniter directory structure for this constant, and came up with 44 matches:
jim@kuniklo:~/public_html$ grep --recursive APPPATH *
index.php:| APPPATH     - The full server path to the "application" folder
index.php:      define('APPPATH', $application_folder.'/');
index.php:      define('APPPATH', BASEPATH.$application_folder.'/');
system/database/DB.php:         include(APPPATH.'config/database'.EXT);
system/libraries/Exceptions.php:                include(APPPATH.'errors/'.$template.EXT);
system/libraries/Exceptions.php:                include(APPPATH.'errors/error_php'.EXT);
system/libraries/Language.php:          if (file_exists(APPPATH.'language/'.$idiom.'/'.$langfile))
system/libraries/Language.php:                  include(APPPATH.'language/'.$idiom.'/'.$langfile);
system/libraries/Config.php:            if ( ! file_exists(APPPATH.'config/'.$file.EXT))
system/libraries/Config.php:            include(APPPATH.'config/'.$file.EXT);
system/libraries/User_agent.php:                if ( ! @include(APPPATH.'config/user_agents'.EXT))
system/libraries/Router.php:            @include(APPPATH.'config/routes'.EXT);
system/libraries/Router.php:            if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
system/libraries/Router.php:            if (is_dir(APPPATH.'controllers/'.$segments[0]))
system/libraries/Router.php:                            if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
system/libraries/Router.php:                            if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
system/libraries/Loader.php:            $this->_ci_view_path = APPPATH.'views/';
system/libraries/Loader.php:            if ( ! file_exists(APPPATH.'models/'.$path.$model.EXT))
system/libraries/Loader.php:            require_once(APPPATH.'models/'.$path.$model.EXT);
system/libraries/Loader.php:                    if (file_exists(APPPATH.'helpers/'.$helper.EXT))
system/libraries/Loader.php:                            include_once(APPPATH.'helpers/'.$helper.EXT);
system/libraries/Loader.php:                    if (file_exists(APPPATH.'plugins/'.$plugin.EXT))
system/libraries/Loader.php:                            include(APPPATH.'plugins/'.$plugin.EXT);
system/libraries/Loader.php:                    if ( ! file_exists(APPPATH.'scripts/'.$script.EXT))
system/libraries/Loader.php:                    include(APPPATH.'scripts/'.$script.EXT);
system/libraries/Loader.php:            if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
system/libraries/Loader.php:                    include(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
system/libraries/Loader.php:                    $path = ($i % 2) ? APPPATH : BASEPATH;
system/libraries/Loader.php:                    if (file_exists(APPPATH.'config/'.$class.EXT))
system/libraries/Loader.php:                            include(APPPATH.'config/'.$class.EXT);
system/libraries/Loader.php:            include(APPPATH.'config/autoload'.EXT);
system/libraries/Upload.php:                    if (@include(APPPATH.'config/mimes'.EXT))
system/libraries/Hooks.php:             @include(APPPATH.'config/hooks'.EXT);
system/libraries/Hooks.php:             $filepath = APPPATH.$data['filepath'].'/'.$data['filename'];
system/codeigniter/CodeIgniter.php:if ( ! include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT))
system/codeigniter/Common.php:  if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
system/codeigniter/Common.php:          require(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
system/codeigniter/Common.php:          if (file_exists(APPPATH.'libraries/'.$class.EXT))
system/codeigniter/Common.php:                  require(APPPATH.'libraries/'.$class.EXT);
system/codeigniter/Common.php:          if ( ! file_exists(APPPATH.'config/config'.EXT))
system/codeigniter/Common.php:          require(APPPATH.'config/config'.EXT);
system/helpers/download_helper.php:     @include(APPPATH.'config/mimes'.EXT);
system/helpers/smiley_helper.php:       if ( ! file_exists(APPPATH.'config/smileys'.EXT))
system/helpers/smiley_helper.php:       include(APPPATH.'config/smileys'.EXT);
Fortunately, APPPATH isn't used often. More often than I would have liked, but not so often as to prove impractical to get around. Most of the files APPPATH resides in probably don't need altering. For instance, one probably wouldn't want each module to have its own error pages, so there's probably no need to alter Exceptions.php. Loader.php, on the other hand, looks like exactly the sort of thing I'd want to override...


If you've read this far...

That's where I'm up to as of writing. Unfortunately, my post has expanded into something far larger than I had anticipated, an oversight for which I apologise for. It all seemed so much more brief and straightforward in my head, yet when it comes down to writing it down, it all seems so much more lengthy. :o

If you've read this far, then I hope you found at least some of my post somewhat interesting.

Last edited by Arevos; Nov 10th, 2006 at 7:39 PM.
Arevos is offline   Reply With Quote
Old Nov 11th, 2006, 1:37 PM   #2
Iftikhar
Programmer
 
Iftikhar's Avatar
 
Join Date: Oct 2006
Location: London
Posts: 40
Rep Power: 0 Iftikhar is on a distinguished road
Send a message via MSN to Iftikhar
Look interesting. But so far I can see, you just choose the language to develop a forum software and tools that could be used in the development. This is fine, as if all decided to devlop in PhP. However the most important task is requirements Engineering. what kind of features, database design, if you are gone a use database etc. For that I suggest that all people should send a list of features, or some body send all the basic features of a forum software and other people give suggestions on them. This way features will add slowly.
__________________
Iftikhar Ahmed Khan
For doing an experiment on programmer's mood please visit http://uxisfyp1.brunel.ac.uk/cspgiak
Iftikhar is offline   Reply With Quote
Old Nov 11th, 2006, 2:34 PM   #3
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 904
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
I think a much more useful kind of modularity would be along the lines of what has been achieved with Expression Engine. EE uses add-on modules for even some of the most basic features, making it extremely extensible. I think this sort of modularity is much more useful and practical than dividing your code via the MVC paradigm you describe, although the two could certainly be combined.
titaniumdecoy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Black Art of Video Game Console Design lostcauz Book Reviews 0 Apr 26th, 2006 8:31 PM
Design Forum Section. hoffmandirt Community Announcements and Feedback 21 Mar 22nd, 2006 1:47 PM
New Design & Forum Bday big_k105 Community Announcements and Feedback 21 Apr 12th, 2005 10:54 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:23 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC