Ian Bicking: the old part of his blog

Re: Ideal Web Application Layout

I tend to think of resources in the RESTful sense, so if anything, I would put my objects into a "resources" folder, and my templates into a "representations" folder. Static files (images, scripts, styles) would reside in sub-folders of the "static" folder.

My two cents,

  1. Daniel Burr
Comment on Ideal Web Application Layout

Comments:

Good point. Like I said, I didn't really like resources, but then I don't like static either (though that's actually what I've been using up to now). It defines it purely by its source... which is kind of okay -- I'm not obsessive about this kind of naming -- but I feel like there should be some better name. media might be a good name -- it seems a bit odd for CSS and Javascript, but even there it's not entirely bad. Or perhaps separate out Javascript particularly (along with other programmer-centric files like an XSLT stylesheet). This helps separate files out by roles; at least for those people who work in a collaborative atmosphere, there's a significant practical difference between Javascript and CSS/images, in that it's a very different group of people working with them.

# Ian Bicking

Agreed, "static" isn't too hot either. I think I'll just bite the bullet and go with "mimetypes", and categorize the static content in that way. I could see this approach becoming painful if you had a lot of different types, but for my usual scenario, there would just be text/javascript, text/css, and image/png; not too terrible, I think.

# L. Daniel Burr

But then you are just duplicating the file extensions in the directory layout. DRY, and all that. Some people are anti-file-extension, but I'm actually not in URLs (and definitely not on disk) at least insofar as the extension indicates the content type of the response, not the content type on disk.

There's so many ways to cut it, maybe "static" is the best because it's just the least complex.

# Ian Bicking

Like everything else in software engineering, this depends on your needs.

Have one js file that everything needs? One simple .css file that everything uses?

Sure, stick them in static.

Have a bazillion php files, each depending on a complex system of rules to generate the various CSS files it's using? Things get more complicated.

# Bob Joad