tag:blogger.com,1999:blog-9604963.post6193962925972854483..comments2023-03-29T21:05:16.669-07:00Comments on The Hitchhiker's Guide to ...: Browse the code vs. RTFMTorstenhttp://www.blogger.com/profile/13672530882350688873noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-9604963.post-88929692768336107642009-03-20T08:00:00.000-07:002009-03-20T08:00:00.000-07:00Hi Michael,>static typing is not necessarily ug...Hi Michael,<BR/><BR/>>static typing is not necessarily ugly<BR/><BR/>Agree that it's not necessarily ugly and beauty is in the eye of the beholder. But there are two reasons this can be seen as ugly code. One is the drawback of static typing (method with the same name for each type) and the other is that there are additional methods - one for an option and one for another boolean option. Maybe only one parameter with an extensible configuration object could have helped here ;)<BR/><BR/>I've seen ugly code in Java, C#, C/C++, ... and even Smalltalk. But guess where I've found more examples.<BR/><BR/>API descriptions are good - but an intention revealing name in addition is definitely a timesaver! Do you think you will always remember the full API description and differences between all these methods when you hunt for bugs and step over such a method in the debugger later ...Torstenhttps://www.blogger.com/profile/13672530882350688873noreply@blogger.comtag:blogger.com,1999:blog-9604963.post-76768888412283688462009-03-20T05:18:00.000-07:002009-03-20T05:18:00.000-07:00Amen brother.A well learned skill for Smalltalk de...Amen brother.<BR/><BR/>A well learned skill for Smalltalk developers is knowing how to browse, seeking senders, implementers and even test cases to see and understand how an object works.<BR/><BR/>Smalltalk teaches us to think of the code as something living and dynamic. I often use the metaphor of asking an object questions to understand what it does.Unknownhttps://www.blogger.com/profile/04561334174996530914noreply@blogger.comtag:blogger.com,1999:blog-9604963.post-29972088778650841872009-03-19T13:24:00.000-07:002009-03-19T13:24:00.000-07:00Smalltalk does lend itself nicely to "descriptive ...Smalltalk does lend itself nicely to "descriptive coding", but it can also be done almost as well in other languages like Java by using good function and method names.<BR/><BR/>The example you give for the drawbacks of static typing is not necessarily ugly; each of the setContext methods might have a different behaviour depending on the type of its method parameters. It could always just have taken Object as a parameter. What does suck in Java is that primitive types such as int, bool and so forth aren't subclasses of Object.<BR/><BR/>Also, reading API descriptions doesn't suck any less than having a second browser open for looking up class protocols.gulikhttps://www.blogger.com/profile/13284010440797843195noreply@blogger.com