To be clear, I'm not looking for opinions but rather facts based on actual in-the-field usage of different file structure types.
In researching, before asking this questions, I've seen many posts about what the right folder structure is for a web application. For example, I'll see someone list where the following should go: css, js, html, images, php. But, I haven't seen anyone go into much deptch about what the static directory structure should look like.
I have a lot of images in form of static/images/mustang_2017_front.jpg
using Ford vehicles for example. Is it best to keep them in this flat file format or use a hierarchical folder structure such as static/images/mustang/2017/front.jpg
. All the images are the same type for each car (e.g front, side, rear, top). Also, though I'm asking about images, I think the naming conventions standards apply to static files in general.
Option 1- flat
static/images/mustang_2017_front.jpg
static/images/mustang_2017_side.jpg
static/images/mustang_2017_rear.jpg
static/images/fusion_2017_front.jpg
static/images/fusion_2017_side.jpg
static/images/fusion_2017_rear.jpg
Option 2- hierarchical
static/images/mustang/2017/front.jpg
static/images/mustang/2017/side.jpg
static/images/mustang/2017/rear.jpg
static/images/fusion/2017/front.jpg
static/images/fusion/2017/side.jpg
static/images/fusion/2017/rear.jpg
Here are some of the benefits I can think of for each approach, but they're from a human perspective. Is one of the options easier to work with in code? Does it matter much? I just don't want to be setting myself up for something that's not scalable in the future.
Option 1- flat Benefits
- all files have all information in the name
Option 2- hierarchical Benefits
- from a human perspective it's easier to manually navigate and find what you're looking for using a hierarchical folder system instead of having a large number of files all in the same folder
To be clear, I'm not looking for opinions but rather facts based on actual in-the-field usage of different file structure types.