Welcome Guest, Not a member yet? Register   Sign In
How to structure my CI project
#1

[eluser]Frank Liu[/eluser]
Hi All,

What is the best practice for structuring a CI Project?

My group has about 10+ people. Each person could potentially contribute to a portion of the website (some silly web tools). Should each person create his own application folder, where he will have a complete set of mvc+helpers+config, or each person manage their own mvc files in a single app?

I would prefer the first approach since then each can manage their own portion with their own version control system. However, if so, how do we share certain things among applications. For instance authentication. In order to do it properly, we really need "libraries" for authentication, models for storing user data and controllers/views for login/logout/user management pages. Is there a clean way for me to reuse these across different apps? In Django, sharing across apps is built into the python language, i.e. just import packages/modules. In php/CI, it's not apparent how to achieve this. Ideally, maybe something like

$this->load->model($model_name, $app_name);

Currently I am doing silly things like symlink the model/view files around. But this somehow feels dirty.

In addition, is there a recommended way to store media files like js, css, img files? The way i am planning to do this is to create a media file in each app and again symlink them into a central static file server directory. This way, each app folder is completely self-contained. Is this proper?
#2

[eluser]jedd[/eluser]
Hi Frank,

This is a pretty big question.

Are you using an SCM at all? With that number of people I reckon the complexity of using things like trac and git become worth the complexity. git would solve a lot of collaborative problems, but how elegantly it does it (or rather, how much work there is for the guy bringing the bits back together at the end) depends on how well you can portion out the different lumps of work.

Having, as you say, each person running '... their own version control system ...' seems a little .. 1980's.

As for re-usable modules, this is always a challenge (and explains why there's regular threads on here about plug-in-able modues for auth, permissions, forums, etc) because every project is different. I put all my authentication stuff into a model, with a few related bits in MY_Controller and my generic helper - putting it all in a library may well work better for you, but you still have the underlying problem ... and that's only resolved if you guys have good communication, and a cleanly documented API to your common codebase.


As to central storage of js, css, and img files .. symlinks work well, as you observe. Attempts to stick with identical js (for example) across applications means that you're willing to do full testing across every app that uses a given lump of code if you decide to change that code at some point. Trade-off time - is that better than, effectively, maintaining several forks? So much depends on the discipline of the guys doing the coding I suspect. Oh, unless by static you meant read-only?




Theme © iAndrew 2016 - Forum software by © MyBB