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

It is a bit weird.

However, a friend of mine was a professional Smalltalk programmer. He claims that his median line count of methods, over his 17 year career, was 4.

It is harder to do in other languages--it seems that C would be on the order of 10.

Clearly it is a rule that can lead to complexity of too many methods, compromising whatever gain smaller methods give you.



> median line count of methods

Auto-generate getters and setters for every instance variable and that will drag the average down. (Maybe a lot of those getters and setters should not have existed.)


Not part of smalltalk.


fyi the Cincom Smalltalk IDE New Class dialog shows these fields and checkboxes—

     Name: MyClass
     Superclass: Core.Object
     Instance Variables: anInstVar anotherVar

     Create methods:
         Accessors
         Initializer
         Subclass responsibilities

"Accessors" aka getters.

    ~
See 1996 "Smalltalk with Style"

page 113 get method

page 117 set method

https://rmod-files.lille.inria.fr/FreeBooks/WithStyle/Smallt...

    ~
"After the creation of the class StUser, it is highly recommended that you perform automatic creation of instance variable accessors. One possible way to do this in Squeak is to use the context menu on a class among the entry more.... There, you can find create inst var accessors. Select this command to have all accessors created."

http://www.hpi.uni-potsdam.de/hirschfeld/seaside/tutorial?ch...

etc etc




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

Search: