News for hackers. Stuff that matters.
Re:My time with Rails is up by smitherfield on Sunday May 22, 2016 @02:55PM (#11749753)
I agree with the author that abstractions should be optional, whenever possible.

However, just because something is heavily abstracted doesn't mean it's a bad approach, at least from a productivity standpoint. Without certain things being heavily abstracted, we'd go insane.

Just as

  User.create(params[:user])
gets translated to thousands of lines of Ruby, so also

  CoolClass.new('foo', 3)
gets translated to thousands of lines of C, and

  printf("It's %d degrees today in %s.\n", temperature, city);
gets translated to thousands of lines of assembly.

Are they all heavy abstractions? Yes. Is it oftentimes very nice to be able to use heavy abstractions? Also yes.

Re:My time with Rails is up by phamilton on Sunday May 22, 2016 @05:20PM (#11750332)
To me the point isn't so much separation of concerns as it is separation of side-effects.

printf has a well design side effect (printing to stdout). Coolclass.new has an expectation of an instantiation of object in memory. If Coolclass.new also called an external service, then that would be a violation in my opinion. Thankfully, we generally don't do that.

User.create is not only capable of tons of side effects (just like Coolclass.new) but it is encouraged to do so (via callbacks and such).

Re:My time with Rails is up by narag on Sunday May 22, 2016 @03:19PM (#11749856)
There was a recent article about Julia that discussed how a printf in C translate to very few instructions in assembler.

Also I would like to point that "translates" is a little misleading word. There are two ways of implementing an abstraction from a higher level system to a lower level one.

You can generate code or you can write a runtime framework that does the work dynamically. Although from the higher place both may seem the same, there's a huge difference between them that has consequences.

Re:My time with Rails is up by MegaDeKay on Sunday May 22, 2016 @03:58PM (#11750009)
The link to that article is below. printf in C tranlates to a few lines of assembly in preparation for a call to sprintf. That in turn will have a lot more instructions in assembler.

http://zverovich.net/2016/05/13/giving-up-on-julia.html

Re:My time with Rails is up by hackerboos on Sunday May 22, 2016 @07:08PM (#11750682)
Indeed and OP is mixing up language implementation and standard libs with a framework.
Re:My time with Rails is up by smitherfield on Sunday May 22, 2016 @03:27PM (#11749880)
>There was a recent article about Julia that discussed how a printf in C translate to very few instructions in assembler.

I wouldn't doubt it; compilers have become amazing at optimizing. But printf is hundreds of lines of C, at very least: http://opensource.apple.com//source/Libc/Libc-1082.20.4/stdi...

Re:My time with Rails is up by narag on Sunday May 22, 2016 @05:47PM (#11750427)
Well, hundreds is not the same as thousands ;-)

And most important, a call is not the same as the implementation of the called function, my point to begin with, please see my comment in the context of yours.

Re:My time with Rails is up by smitherfield on Sunday May 22, 2016 @07:22PM (#11750725)
Per cloc it's actually 1093 lines of C (plus some more in the printf.c file), and generally speaking hundreds of lines of C is the equivalent of thousands of lines of assembly.

In any case, the complexity of the called function is exactly what we're discussing — it's why the author objects to "User.create(params[:user])"