Tips on code organization

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
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Tips on code organization

Post by Live24x7 »

Developing my most complex php script so far.
As the number of files and code get larger the question of how to organize them comes up

so far i have 4 folders

1) user manageent folder - logins/logouts
2) the core processes folder
3) the design folder (Views)
4) classes

I am not looking for any specific tip..but rather any thing that you have learned over the years with experience as to what works best.

Things like:

what should be placedin the root folder and what goes into separate folder ?

and anything related to this.

thanks
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Tips on code organization

Post by social_experiment »

if you haven't already done this take a look at existing cms for ideas on file structures
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: Tips on code organization

Post by Live24x7 »

thats a nice suggestion will look at wordpress or joomla structure
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Tips on code organization

Post by Celauran »

You'd probably do better to look at the file layout of a PHP Framework. Most CMSes I've encountered are frightfully poorly written. They're good at what they do, but I wouldn't use them as references for best practices.
Live24x7
Forum Contributor
Posts: 194
Joined: Sat Nov 19, 2011 9:32 am

Re: Tips on code organization

Post by Live24x7 »

Thanks ..Inspecting the code structure of CI - and i see reasons why MVC is better for code modification and extensibility
Post Reply