Considering which way to go about architecture :)

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
penkomitev
Forum Newbie
Posts: 6
Joined: Sat Dec 26, 2009 10:40 am
Location: Plovdiv, Bulgaria

Considering which way to go about architecture :)

Post by penkomitev »

Hello guys!

My name is Penko, from Bulgaria(Europe in case it doesn't sound as known).
I am planning to write an introductory post at some later moment, so I am heading directly to the question.

This is the situation - I have to develop a large web-based application for a customer of mine. The task is the system to be able to handle the organization of the whole company. My customer is disappointed with what is available currently on the market and therefore wants something developed in accordance with his needs.

It's clear he is going to demand new modules in the future, so choosing the right expandable-friendly architecture is from a great importance in this case. I will try to do it OOP as much as possible, so everything keeps structured.

Because of the plugins prerequisite, I am thinking of a special directory whether these plugins(modules) are going to be stored.
I am pondering something like this for folders structure:

* models
* controllers
* images
* css
* js


I think I have to dublicate the same structure in plugins directory as follows:
Addon/models
Addon/controllers, etc...

But how would I overcome the URL issues with some much include(''), from different folders. There will be images, other resources in views and it would be unknown what their full URL is.

The needed page would be controller by a GET parameter, having given also the controller name. However, one thing lacks with these GET parameters. There is no module name. I did some tests by creating a function which first seeks in core/controllers/GETPARAM.php and if not found, scans the entire plugins directory until it finds a controller with that name is a folder corresponding to a module located in the plugins directory.

Everything is okay until it gets more complicated. I considered the situation when having to deal with images, needed in all controller views. This means, for every single resource(image, etc), I have to first understand where it's located because we all know the URL handling problem in PHP when it comes to complex directories and sub-directories and after that load it. Without having even started the system, I guess I will have performance issues and I could have unfortunate moments when I am stuck somewhere in code and get annoyed by the impossibility to program something because of a previous mistake in organization.

I know it's far more easy to have static folder structure and every file is at the corresponding place and I would really go for that solution if I don't find the right way to do plugins-friendly structure. Because the freedom to develop extensions is wealth, I try to stop on that solution, but if its implementation will make development a nightmare, I will deny to use it.

I suppose this became too long to read, but I hope you are still reading it . This post is probably more like a discussion of suitable architecture rather than a direct question.

What architecture would you choose when having to deal with different modules, which on their hand can have multiple controllers, each having multiple views, etc... By modules understand -> Finance, Deliveries, Tasks, Customer communication, Warehouse...

The reason I am heading for plugin architecture is for the sake of simplicity of further development and of course the ability for third-parties to add modules without having to interact much with the folders structure and just add their module to a new folder in the modules folder and it's ready for use.

I know it's complex, I know I didn't perform the best explanation , but I hope you can share some experience with me regarding this architecture issue.

Regards,
Penko
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Considering which way to go about architecture :)

Post by Christopher »

Most current frameworks support modules, which are separate MVC directory trees.
(#10850)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Considering which way to go about architecture :)

Post by josh »

I use Zend Framework to manage my modules.. Javascript & CSS go in the layouts/ folder and usually are not specific to any single module. I have a controller called the FileController that proxies access to images & css. If all your images & css can be public and don't need to be protected by any PHP scripts, just put them in public_html
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Considering which way to go about architecture :)

Post by alex.barylski »

Use Joomla :)
penkomitev
Forum Newbie
Posts: 6
Joined: Sat Dec 26, 2009 10:40 am
Location: Plovdiv, Bulgaria

Re: Considering which way to go about architecture :)

Post by penkomitev »

Haha, only not involve Joomla, because things are pretty good so far and they are about to get worse :P).

The Zend Framework-using suggestion is probably worth trying, will think on that :).

Penko
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Considering which way to go about architecture :)

Post by josh »

I think you should consider using Joomla too, that was a good suggestion.
penkomitev
Forum Newbie
Posts: 6
Joined: Sat Dec 26, 2009 10:40 am
Location: Plovdiv, Bulgaria

Re: Considering which way to go about architecture :)

Post by penkomitev »

Yes, I just wanted to say I have bad memories about Joomla :).

However, I will take a look in case things are changed since I last tackled with it.

Penko
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Considering which way to go about architecture :)

Post by alex.barylski »

Yes, I just wanted to say I have bad memories about Joomla
You will have equal bad memories with Zend when your finished.
Post Reply