Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In the article:

I was expecting a discussion about boilerplate but the author writes about how ugly/bad is code that does a lot of operations in one line.

Then he introduces the concept of "proportionality", and according to it, assembler must be the best language since the program statements are directly proportional to the operations to be performed...

Suddenly high level programming is no longer good stuff...

Meanwhile no real discussion about boilerplate!!

Whenever your code shows implicit patterns that get repeated but cannot be abstracted away using code, you have boilerplate and boilerplate is almost always a bad thing. Your choices are then:

1. Pretend those patterns as a good thing.

2. Switch to a more powerful language and destroy the boilerplate either because it isn't necessary anymore, or because you can abstract it away with, for example, a macro.



    > Then he introduces the concept of "proportionality", and
    > according to it, assembler must be the best language since
    > the program statements are directly proportional to the
    > operations to be performed...
    >
    > Suddenly high level programming is no longer good stuff...
Looks like you didn't understand what he meant in that section if you think he implied Assembly is better than high level languages. It's not that 1 line of code should do exactly 1 unit of work, but rather that if 1 line does 100 units, then 10 lines should do 1000.

Function calls are exempt from that, because everyone understands that a function can do arbitrary amount of work, and one needs to know what it does (by reading its name and documentation). The cost is considered to be a "function call".

Yes, Assembly also has high proportionality, which is a benefit to it. But it doesn't mean all other languages are bad. These are tradeoffs.

The point is that it's a beneficial property of a language when you have code length that better corresponds to the amount of work it's doing.


> but rather that if 1 line does 100 units, then 10 lines should do 1000.

Why they should? It has no reason to be that way.

If anything, 1 line should do 1000, if possible. Some lines will do 1, others 10, others 5, others 100. "Proportionality" adds no value and, quite the opposite, discourages programming at the highest level possible.


> "Proportionality" adds no value

I think it helps improve readability of the code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: