tag:blogger.com,1999:blog-6637736252081011583.post6032316149682714010..comments2023-10-23T11:13:47.199-07:00Comments on Daily Vim: Text Editor Tips, Tricks, Tutorials, and HOWTOs: Be a Better ProgrammerTravis Whittonhttp://www.blogger.com/profile/14592647486468034166noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6637736252081011583.post-22934646467508469412008-04-21T07:25:00.000-07:002008-04-21T07:25:00.000-07:00Next time I'm doing some Python coding, I'll check...Next time I'm doing some Python coding, I'll check it out. Thanks for the tip!Travis Whittonhttps://www.blogger.com/profile/14592647486468034166noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-24181117441724500782008-04-18T03:26:00.000-07:002008-04-18T03:26:00.000-07:00If you're using the interactive Python shell a lot...If you're using the interactive Python shell a lot you should give ipython (http://ipython.scipy.org/moin/) a try. It is a nice extension of the default Python shell with all the default functionality, as well as many new nifty features.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-85200492712584782532008-04-17T11:15:00.000-07:002008-04-17T11:15:00.000-07:00You can get the equivalent of an interactive shell...You can get the equivalent of an interactive shell for browser-based Javascript with Firebug's console. Firebug has saved me uncountable hours debugging Javascript.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-65238167040901989392008-04-17T10:23:00.000-07:002008-04-17T10:23:00.000-07:00Thanks for the comment. Actually, I do use excepti...Thanks for the comment. Actually, I do use exceptions quite regularly; although, I didn't mention them in the post. Generally speaking, if I can handle an error in the context of a method, I will. If the failure will raise issue with the normal runtime operation of the program, I use try/catch, begin/rescue/end, etc...<BR/><BR/>How heavily they're used, is generally a matter of programming style, language, and preference in my experience. I worked on some Java code recently and employed exception handling much more rigorously than I usually do. When in Rome...<BR/><BR/>Like most idioms, they make sense in some situations and don't in others.<BR/><BR/>function sum(a, b) {<BR/> return (int)a + (int)b<BR/>}<BR/><BR/>The above isn't real code but in the "imaginary" language, assuming casting invalid data to an int would result in a zero, there's no possible input that would raise an exception.<BR/><BR/>Something like databaseConnect() has a lot more potential for error. In that kind of context, I'd almost always utilize exceptions to simplify flow.<BR/><BR/>So like most things, it depends, but thanks for raising a good point and visiting the blog!Travis Whittonhttps://www.blogger.com/profile/14592647486468034166noreply@blogger.comtag:blogger.com,1999:blog-6637736252081011583.post-74108574891915314392008-04-17T09:40:00.000-07:002008-04-17T09:40:00.000-07:00Interesting article, thank you very much !Also I h...Interesting article, thank you very much !<BR/><BR/>Also I have one question :<BR/>Did you considere raising/throwing exceptions instead of returning error codes ?<BR/><BR/>Exceptions allow to seperate the error flow from the normal flow, which make it easier and safier to identify/handle errors, instead of having them spread out all around your code.<BR/><BR/>Also by using exceptions you do not have to test for return code at each function level : you only catch exceptions and handle errors in your key entry points.<BR/><BR/>Exceptions make you write less code (and less bugs as a consequence), and safer code by clearly seperating the error flow. It also make your code more readable.<BR/><BR/>Also I have to admit that not every language support exceptions ...<BR/><BR/>Perl as a "home made" exception handling. Python, Ruby, Java, C++, C# ... have a more conventional one. I do not know about lisp ...Anonymousnoreply@blogger.com