tag:blogger.com,1999:blog-5638372.post113570088290854567..comments2023-10-10T05:22:56.347-05:00Comments on binkley's BLOG: Emulating static importBrian Oxleyhttp://www.blogger.com/profile/06617364377560752378noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5638372.post-1135801222909795262005-12-28T14:20:00.000-06:002005-12-28T14:20:00.000-06:00I'm sorry, Anonymous, you feel that way. I consid...I'm sorry, Anonymous, you feel that way. I consider it a matter of taste, not a religious issue. If you do not like static import, do not use it. I hope it does not bother you over much.<BR/><BR/>And why save 10 characters? Because it is an example. A lengthy class where the improvement in readability is significant is too long to post in a blog entry.Brian Oxleyhttps://www.blogger.com/profile/06617364377560752378noreply@blogger.comtag:blogger.com,1999:blog-5638372.post-1135758728092086492005-12-28T02:32:00.000-06:002005-12-28T02:32:00.000-06:00This is exactly why people didn't want static impo...This is exactly why people didn't want static imports. What have you saved, ten letters ("UIManager.")? How many times do you call "setLookAndFeel"? Once? It's meant for *repetitive* symbol accesses, like Math.this(Math.THAT + Math.whatever) * Math.somethingElse(), and it's not even really meant for that, either.<BR/>I hope the people reading your blog don't do what you've done.<BR/>See http://java.sun.com/docs/books/tutorial/java/interpack/staticimport.html<BR/>"Note: Use static import very sparingly, if at all. It's useful for situations when you need frequent access to a few static objects from one or two classes. Overusing static import can result in code that is difficult to read and maintain, because readers of the code won't know which class defines a particular static object. Used properly, static import makes code more readable by removing class name repetition."Anonymousnoreply@blogger.com