On Dec 10, 11:15 am, "Just Another Victim of the Ambient Morality" <ihates... / hotmail.com> wrote: > This is interesting but kind of overkill. Checking for a contract is a > non-trivial, especially if you want to keep duck-typing. This would > increase programmer effort so much that it would become comparable to > programming in C, I think... Sure, but you asked ;) > > Why do you have troubles like this? How big are your methods? Keep > > them small and this, I think, would be very rare. > > They're not that big. Having said that, it's often hard to keep a > method definition too small 'cause, well, sometimes there's a lot to do! > Sometimes there's a lot to do that's inherently related and splitting that > up would serve no logical purpose other than to keep the method definition > small. Finally, I've actually worked with entire programs where no function > body was more than six lines of code. It wasn't understandable nor easy to > work with. It was extremely difficult to tell what any function did and it > was difficult to modify code to do something else. I don't think > artificially keeping method definitions small necessarily solves anything... Nah... Sure, a lot of small methods requires a little more tracking around, but if they are named well and organized well the whole will be much easier to work with and understand. The method names should actually help self document the program, not obscure it. When you divide a problem into small components it becomes much more manageable and easier to test too. > > The most annoying bug I ever have is tracking an errant "end". > > I've had this problem, before, but luckily it's quite rare for me. > Perhaps it's because I've gotten into the habit of typing out my loop bounds > before filling in the loop body. I've always considered this a bad habit of > mine but perhaps it's not so bad... Of course it is fairly rare (it usually occurs during refactoring, not first write). But when it does happen I haven't found a better way to track it down then to just look for it or comment out sections of code, which sucks. Highlighting would help, but alas my editor does not support it --even so, it wouldn't completely solve the problem. T.