RESTful Everything - Towards a Complete Resource-oriented Workflow
Location: Salon 4
When using RESTful routes, developers do not need to figure out what actions controllers should have, how to name them and where to put them. For all this there are conventions. When naming helpers and CSS classes, however, developers and designers are still on their own. The best developers will manage to give their helper suite a DSL-like consistency and expressiveness, but especially on large projects with many developers, names are often times made up in a ad-hoc fashion when and where they are needed, duplication and inconsistencies are likely to creep into the code, and non-semantic classnames into the markup and stylesheets.
What worked for us
- All our links and foms are given standard CSS classes that combine a noun (the resource name) with a verb (a CRUD action).
- The links an forms are created using helpers that are themselves named with a combination of a resource name and the CRUD action they are triggering.
As simple as this pattern is, it has great benefits downstream, such as:
- Near-perfect separation of presentation and semantics
- Shared resource-oriented vocabulary between developers and designers, leading to improved communication
- Many more possibilities for designers to give elements default styles and behaviors that just work out of the box for rapid development and prototyping with late and minimal designer involvement.
- A consistent story running through the entire MVC stack – and it’s the story of your application’s functionality!
I will then walk through practical examples of how the resource-oriented naming pattern allowed us to:
- Write more compact, yet expressive views
- Use contextual selectors to write more elegant, expressive CSS
- Use CSS3-selectors to elegantly declare application behavior in LowPro behavior sheets
- More effortlessly navigate the DOM tree in LowPro behaviors and other dom scripts.
To wrap it up, I will introduce our plugin (due to be released in April) for generating resource-oriented helpers
adva Business Software
Ingo Weiss is lead developer at Metaversum(twinity.com) in Berlin, Germany. Before that, he designed and built web applications and interactive educational experiences at WGBH, Catapult Thinking, and as a consultant in Boston, USA. He also taught Interaction design and Rails application development, among other classes, at Northeastern University.