News for hackers. Stuff that matters.
Re:Functions Should Be Short And Sweet, But Why? by tunesmith on Wednesday January 22, 2014 @03:05AM (#7101397)
I think some of the perception of how extreme it is has to do with what IDE the coder is using. For instance, in IntelliJ I can have the mouse on a method name and hit a keystroke to go to that method definition, and then another keystroke to go "back" to where I was. That's really helpful for jumping around and following a logical train of thought that goes through several small, one-concept methods - even across files. But, if I were having to deal with an IDE or editor where I was having to string-search and scroll, it'd be maddening and I'd wish for longer, more self-contained (multiple-concept) methods.
Re:Functions Should Be Short And Sweet, But Why? by henrik_w on Wednesday January 22, 2014 @03:35AM (#7101508)
I have the same experience. I coded C++ in Emacs for many years, then switched to Java in IntelliJ IDEA. I definitely write shorter methods now in Java, than I did in C++ (and it's for the better in my opinion). Navigation in general really is so much better in an IDE. More details in "Programmer Productivity: Emacs versus IntelliJ IDEA" http://henrikwarne.com/2012/06/17/programmer-productivity-em...
Re:Functions Should Be Short And Sweet, But Why? by gbog on Wednesday January 22, 2014 @03:23AM (#7101462)
There is another way, we do not need to be either in a big spaghetti blurb or infinite micro onions spread all over the place in multiple files.

With some work and some luck:

- all functions are short enough but all of them do something more than just passing things around.

- there is never any ambiguity on where a function's implementation is to be found. (In Python, I prefer "import x.y.z" then "x.y.z.myfunc()" than using "from x.y.z import myfunc", for this reason)

- like-minded functions are grouped together.

- functions are nice enough (read: testable and tested enough) so that there is rarely a need to check its code to use it.