News for hackers. Stuff that matters.
Re:On logic in a Rails app by TylerE on Monday December 24, 2012 @10:54AM (#4963148)
This sounds rather...performance killing.

Too much abstraction is way way worse than too little, as well.

Re:On logic in a Rails app by tinco on Monday December 24, 2012 @11:03AM (#4963178)
No it isn't.

Too much abstraction can always be refactored down to less abstraction. (Too much abstraction means that there's abstraction that is unnecessary, thus it can be cut away.)

Too little abstraction means your code is too closely coupled. When the code is fresh and small, then ofcourse it's not hard to abstract out a method to DRY something up. But when your code is big and old this will quickly approach infeasability, which is the reason many projects fail.

I would go as far as saying that the science of software engineering exists because your statement is false :P

Re:On logic in a Rails app by andybak on Monday December 24, 2012 @12:34PM (#4963461)
So you're saying that the arrow of refactoring generally points in the direction of less abstraction?

That directly contradicts my experience where most refactoring introduces abstractions when they are needed.

Re:On logic in a Rails app by ncallaway on Monday December 24, 2012 @01:24PM (#4963632)
My interpretation was that he was saying the arrow of refactoring is <i>easier</i> when refactoring in the direction of less abstraction.

I suspect he agrees that generally the arrow points in the direction of <i>more</i> abstraction. This would be the problem he thinks exists.

Not sure where I stand on either side of this; just trying to clear up what I saw as a miscommunication.

Re:On logic in a Rails app by tinco on Tuesday December 25, 2012 @08:52PM (#4967826)
Yes. Usually when programming one encounters problems that are solved elegantly by introducing abstraction. The parent argues that doing this too eagerly results in a big mess that should be avoided by being cautious with abstraction. I argue the converse, being too cautious with abstraction can result in a big mess and you should be eager to abstract.

Of course there is a golden path in the middle, but it is closer to my side ;)

Re:On logic in a Rails app by TylerE on Monday December 24, 2012 @01:12PM (#4963592)
I have one word for you: InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButton
Re:On logic in a Rails app by programminggeek on Monday December 24, 2012 @01:54PM (#4963722)
Too much abstraction or indirection will certainly lead you down that path, but that is not really what I would advocate at all. With Obvious the goal is to make it feel obvious what the system is doing. No big complicated inheritance systems. Instead it uses a bit of indirection via dependency injection and reflection to make the data plugs swappable. Nothing too crazy or complicated.
Re:On logic in a Rails app by programminggeek on Monday December 24, 2012 @11:06AM (#4963189)
It doesn't hurt performance in any noticeable way. Your database plugs are passed into the actions. The plugs are designed to do only what you want them to do, so you can tune them to your hearts content. In fact, I would argue it is far easier to tune a query in Obvious than it is in a traditional ORM which hides the query from you.

This is done via simple dependency injection, which is pretty standard in many other languages outside of ruby.