Live data from Hacker News

Introducing Mutations: Putting SOA on Rails for security and maintainability

developer.uservoice.com

11–20 of 27 posts

Re: Introducing Mutations: Putting SOA on Rails for security and maintainability

#11

I almost fell off my chair laughing when I saw "Rails" and "Security" and "Maintainability" in the same sentence. A quick search here itself on HN will show you how immature and security-hole ridden Rails is. Built for, and by, HIPSTERS!

You do a pretty good job portraying yourself as an idiot.

Re: Introducing Mutations: Putting SOA on Rails for security and maintainability

#12
post #3

I'm glad to see rails devs are finally coming to their senses and exploring other patterns for building applications. SOA, command objects, etc. have been a pretty common pattern in "enterprise-y" frameworks for awhile. This is making rails look more like grails, which I think is a good thing.

It's not new in Rails apps actually; it's only new if you've been reading vocal blog posts (including the ones a few years back bashing design patterns etc).

At least for the apps I've been maintaining as a freelance, quite often they had services of some kind and other classic patterns.

Many Rails developers I know come from a Java and/or .Net background, so this is not really a surprise :-)

Re: Introducing Mutations: Putting SOA on Rails for security and maintainability

#13

Having transitioned from Django to Rails nearly a year ago, this post reminded me of django forms[1]. When I used django, I didn't think much about them, but moving to Rails, I felt something was missing. Why do validations live only/primarily on the model? Doesn't it make more sense to do validation higher-up the chain to filter mistakes and potentially harmful input? Also a good point about the `attr_accessible` co…

> attr_accessible suffers from context blindness: you’re frequently going to have an end user UI and an admin UI. You want admins to have access to more fields.

This is exactly why edge Rails is moving towards strong_parameters, where these are enforced by the controller rather than the model.

Re: Introducing Mutations: Putting SOA on Rails for security and maintainability

#15
post #9

Looks like typed function to me.

That's exactly the analogy I was going for. You don't want your general ruby code to be typed-checked, but it's actually fairly important to make sure your user inputs are checked, especially until Rails battens down its hatches.

Re: Introducing Mutations: Putting SOA on Rails for security and maintainability

#17
This seems like a great idea! I have a few thoughts that comes to mind, perhaps others can chip in:

- How can this be used in tandem with strong_parameters; should ensuring the structure of params be a responsibility of the controller or the mutation (I'm leaning towards the former)? [1]

- How can validation duplication between models and mutations be avoided? In the example 'string :email, matches: EMAIL_REGEX' was used, but presumably one will still validate the email in the model. I'm guessing there are solutions to this, perhaps the existing model validation can somehow be used?

[1]: https://github.com/rails/strong_parameters

Re: Introducing Mutations: Putting SOA on Rails for security and maintainability

#18

This seems like a great idea! I have a few thoughts that comes to mind, perhaps others can chip in: - How can this be used in tandem with strong_parameters; should ensuring the structure of params be a responsibility of the controller or the mutation (I'm leaning towards the former)? [1] - How can validation duplication between models and mutations be avoided? In the example 'string :email, matches: EMAIL_REGEX' was…

You could probably write something like:

User.email.validation

Similar to that query project.. Can't remember the name now :-)

Post reply on HN