Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: 64-bit hashing function Date: Tue, 22 Apr 2014 08:15:02 -0700 Organization: A noiseless patient Spider Lines: 39 Message-ID: References: <5354c699$0$6708$9b4e6d93@newsspool2.arcor-online.net> <45i9l9tq8ng6dk1lbfoc97tcj5gbd09iu7@4ax.com> <5354f836$0$6715$9b4e6d93@newsspool2.arcor-online.net> <34kal9pept6fvrf6226lbcpe9j03nd5eh7@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 22 Apr 2014 15:15:21 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="30374"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2TkHFSGAK0qG/AFJ08Pdx6lBob/D+Wyw=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: Cancel-Lock: sha1:Um3ZrQk/PvMiveBpVxtNDYq8Iew= Xref: csiph.com comp.lang.java.programmer:28181 On 4/21/2014 9:05 PM, Roedy Green wrote: > On Mon, 21 Apr 2014 11:46:06 -0700, markspace > wrote, quoted or indirectly quoted someone > who said : > >> Way too many static methods here. What happened to instantiating a >> class like normal folks? > > Because I am not prepared at this early stage to think about multiple > instances. Before I released it, I would have to do that. I don't see how you test though, given the way you've designed your code. Re. your previous question, "What are the alternatives?", just make an object that calls the methods in its ctor: public class Lazy { public Lazy() { load(); addShutdownHook(); } private load() { // load database... } private addShutdownHook() { // add hook... } } The next thing I would do is make "load()" package private and final, and take a parameter for an InputStream, so I could inject some test vectors into it. Stuff like that makes testing much easier and faster.