Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Resource confusion Date: Sat, 28 Jan 2012 22:43:01 -0800 Organization: albasani.net Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net Oj1yK7qME/44jckbixkdy61oKf5Q/9QEE10McVZcKLoLcRY23wJuJF62ISvW+rFHFEJGRDgV1Umfa5mUCwJxDM7UO/MiNhsLheTQYH4dCJY3RIRoGZmqkr8XgjeAqwFC NNTP-Posting-Date: Sun, 29 Jan 2012 06:42:59 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="H7u5ahPd3XDgmcn9r1HZPUC4GuRh384O9kKrsT9wGfDFqSj3Rz+m7EE7xChUkDynTLBEc6lGmoN0EI+S26RwMICvuS549nAkXCaAga2fsVSRTN5aosZ9xPYEKZDpPrBR"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111229 Thunderbird/9.0 In-Reply-To: Cancel-Lock: sha1:NnrV8RCd8zCVisdMvOh3nBvcLoY= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11630 Novice wrote: > In all honesty, I have never seriously looked at classloaders and have no > real idea why there are all various different ones and when I should be > trying to use one programmatically. I basically had troubles reading a > file from my file system some time ago, googled, and found a post with an > example indicating that toClass().toResource() was a good idea. (A > specific mention of classLoader may have been in there too.) I never > really understood the issue properly but that code got me out of trouble > for the original situation and I've imitated it several times without > really understanding it. Learning more about these classloaders is on my > To Do list; maybe I need to move it up the list ;-) The term for this style of programming is "cargo cult programming". Programming by superstition is not a winning strategy. Everything in programming is explicable. There is an answer. Be confident of that. So never, ever, ever accept "I never really understood the issue properly", much less rely on code you don't understand to get you out of trouble. At least not for very long. "I've imitated it several times without really understanding it" is criminal. Criminal. That's not how a programmer works. > Thanks again Arved! I think I'm out of trouble now.... Not yet. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg