peerigon / alamid

Framework for RESTful JavaScript web applications that run both on the server- and clientside.
http://www.alamidjs.com
MIT License
23 stars 3 forks source link

Rework directory structure #161

Open jhnns opened 11 years ago

jhnns commented 11 years ago

alamid currently forces a rails-like directory structure like

I've following tj's components now for a while and I agree that it's better to think in self-contained components (like tj points out here). So instead of dividing our classes by their type (model, views, pages), you'd divide them by their domain (typically named after the model):

As you notice, Pages are very app-specific and therefore in their one pages folder.

This structure allows you, to write components that are used across several apps which is a common use-case I think. Imagine an application that has a frontend and an admin interface (like Wordpress). These two applications share some components, but you usually wouldn't implement both interfaces into the same application.

meaku commented 11 years ago

I don't think that components always have their own model. Many components share a model or might not have a model at all.

jhnns commented 11 years ago

That's true, but I didn't meant that every component needs a model.

meaku commented 11 years ago

We should decide about this issue before we freeze the API. This would be a big change imho.

jhnns commented 11 years ago

Yep, this needs to be discussed sync.

jhnns commented 11 years ago

There's currently also no place to but base-stuff like base-pages or base-services.