News for hackers. Stuff that matters.
Re:The overhead of abstraction in C/C++ vs. Python/Ruby by userbinator on Saturday October 18, 2014 @06:57PM (#8476622)
You don't code for the machine, you code to be read by another human (possibly you) in the future.

This is one of those sayings (along with the one on "premature optimisation") that I believe has caused huge amounts of resource wastage over the years, and made much software orders of magnitude more inefficient that it could be. Only the exponential growth in hardware performance has hidden that waste, but that is (fortunately?) coming to an end.

Despite humans writing it, code does not exist mainly to be read by humans. It exists to be executed by a machine, to solve a real problem for its users. Your users do not care about your source code. They want a small, fast and efficient application that does what they want. The majority of useful code is executed far more than it's read or written.

program what need to be done in a way that a fellow stranger could understand

This is vague. I agree with you that writing purposely obtuse code for no other reason isn't a good idea, but you should also be exploiting all the power your programming language has to offer when it can make your code simpler and more efficient. I believe that if someone else using the same programming language cannot understand your code, then they should improve themselves so they can.

See also: http://www.linusakesson.net/programming/kernighans-lever/

Re:The overhead of abstraction in C/C++ vs. Python/Ruby by RedNifre on Sunday October 19, 2014 @06:17AM (#8477840)
No, you code to get the job done in an optimal way which usually means for the minimum amount of cost.

Given that the cost for a developer is roughly constant while computation time gets cheaper, this means that nowadays it's best to write code that is quick to modify and thus cheap to modify. The way to do this is to make the code easy to read.

(There are exceptions where you end up writing difficult Fortran code on a supercomputer, but usually "You don't code for the machine, you code to be read by another human (possibly you) in the future." is a good rule of thumb for efficiency.)

Re:The overhead of abstraction in C/C++ vs. Python/Ruby by svalorzen on Sunday October 19, 2014 @08:57AM (#8478119)
While I understand and agree with what you say, this is generally the reason why I never open Facebook, but instead use Pidgin. This is why I don't like YouTube, but instead prefer youtube-dl + mplayer. This is why I'm far more likely to read HN comments versus opening a random webpage, or why I cannot multitask in my not-top-of-the-line smartphone.

I have an old laptop which 8 years ago worked just fine, and is now being more and more useless; not because it is degrading, rather because programs are degrading around it. It's like the world is devolving in an effort to churn out as much crap as possible.

When I open multiple programs which ought to be simple and things start to lag out, I feel a bit disrespected by developers which to avoid any kind of effort took it out on me cutting out what I could potentially do.