Larger Scale Application Structure

I have a JEE enterprise resource planning system that my group at my job has been working on for a while now. We only have a few people, so it is very time consuming. We are currently exploring the idea of re- writing our system in Rails. We decided to take a RESTful approach.

In organizing our application we looked at each module. For example, Customers, Quotes, Sales Orders. We consider these 'documents'. Documents are sort of like packages of related models. For example, sales_orders have many sales_order_line_items and sales_order_line_items have many sales_order_line_item_delivery_schedules. We then broke our models down into namespaces that relate to their related documents. For example, we have models like: Customer, Customer::Bill, Customer::Ship, Customer::ship::Account. We use nested resources (RESTful specific) to refer to a things inside the namespace. For example, you can't access a customer billing address without references the customer like: /customers/:customer_id/bills/:id.

We also have a lot things we call 'lookup objects'. For example, customer_ship_accounts belong_to shipping_method. There are shipping methods like UPS, FedEx, etc. But shipping method is not only used with ship_accounts it is also used directly in other modules. In the case of lookups the models are defined like: Lookup::ShippingMethod, but their table names are like: shipping_methods.

Our main goal was to make things as simple as possible compared to our old application. We wanted everything organized and we wanted to write as little code as possible. We didn't want to depend on javascript in our interface. We thought it would be nice if we had an API out of the box.

All in all, it is working out quite nicely. The scaffold_resource generator has a few bugs when it comes to models with namespaces so deep, but we are working through them and eventually we plan to write a generator based on scaffold_resource that helps us more.

To be honest, we haven't tackled that yet. We are still proving that we can efficiently develop a large scale application using Rails compared to our previous framework.