On Tuesday, 3 September 2013 at 01:18:16 UTC, Manu wrote:
On Monday, 2 September 2013 at 03:14:38 UTC, Manu wrote:
On 2 September 2013 04:00, bearophile <bearophileHUGS@lycos.com> wrote:
Manu:
Except that you can _read the class definition_.
Seriously, how do you quickly read and understand the API through the
noise?The noise increases if you have to repeat the class name for each method
:-)
Look, I'm just giving an account of the collective experience from our
weekend. None of us could find anything easily in each others classes, or
quickly get a reasonable overview of it's design and how it worked.
This leads to needless conversations, asking the other person about it,
and
all those questions that I should be able to understand at a glance.
This WILL affect productivity in the office.
The reason was that functions were polluting the class declaration. 9
times
out of 10, when I look at a class declaration, I want to know what it is,
what it has, and what it can do.
Code folding? It's a pretty standard feature of most editors since forever.
I think I've repeated myself 3 or 4 times here, but one more time for good
measure...
Requiring IDE assistance to make code _readable_ seems completely fail to
me.
1) You're not always reading code in your IDE, often in commit logs, diff
windows, emails, chat clients.
for some people, all of those things are emacs.
There's a different between and IDE and an editor, but it's a pretty blurry line. There are lots of people here(myself included) who don't feel the need for a full blown IDE, but I'd be surprised if (almost) anyone here used an editor that didn't support such basic things as code folding.2) With so much hate for IDE support, it seems like a massive contradiction
to say that an IDE should be required to make code readable.
anyway, in the end it's a trade-off.
Definitions inside class:
-you know where it is (never ends up in a different file etc)
-declarations always in sync
-it clutters the signature
solution: code folding or go-to-next-function or minimal documentation. Worst case you can scroll and you'll know if you've got to the end of the class then it's not there.
Definitions seperate:
-clear class signature
-no idea where to find implementation
solution: go-to-definition. Worst case you have to go through separate files searching for a definition by eye. Even if it has to be in the same file, you have no hint where.
Both cases require some editor features in order to be ideal, but if you don't have those tools (e.g. in all the other places you've mentioned*) then it's just a choice between having to scroll a bit some of the time or having to occasionally go on a blind code-hunt.
*A lot of people use version-control aware editors to do a lot of what you're talking about e.g. view a diff.