Path: csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Good Fowler article on ORM Date: Sat, 12 May 2012 21:53:37 +0200 Organization: albasani.net Lines: 78 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 nv+RLT5QfRhJJoVGz/Kjx/cYhfubsTNYYrfMjCD9Iib8TqFtvOCZLN2Riqns6LhaTYzJduZMNlK71mNizluDSzxfF4sP3bNiiEZxtufcfj3ebrSSlmz9BIkaDrxGlVGP NNTP-Posting-Date: Sat, 12 May 2012 19:53:37 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="PsZoomJyTrTIRE9/ixqspnoVBqMeJIw5S2Iwy/FvbePISe8Zw3IezC4S4hgeB8S2WfepAoFrXNWQFCDBwxwDvCdj6lvlHKx6cPT1dVlFl/vBsHshR2Z9EHogyHBj5Otc"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120429 Firefox/12.0 SeaMonkey/2.9.1 In-Reply-To: Cancel-Lock: sha1:yda4PmG88w3omNUIrCwglo15j18= Xref: csiph.com comp.lang.java.programmer:14493 Lew schrieb: > I don't think I get your last paragraph here. What pain? What additional > classes? Why? The discussion was about some custom HashMap, call this class XXX. If one does use inline loops such as: for (int i = 0; i I'm willing to lay odds that for your use cases > the difference made by accessors and mutators is > not the low-hanging fruit. For gambling you can go to Las Vegas, or if you are up to something more serious, you could educate yourself. First of all originally Android didn't have a JIT. See for example: http://www.youtube.com/watch?v=ptjedOZEXPM There might still be devices around without a JIT. Second for my setter/getter claim you might want to read this page: http://developer.android.com/guide/practices/design/performance.html There is a section about Avoid Internal Getters/Setters. I copy the essential part for your eyes here: "In native languages like C++ it's common practice to use getters (e.g. i = getCount()) instead of accessing the field directly (i = mCount). This is an excellent habit for C++, because the compiler can usually inline the access, and if you need to restrict or debug field access you can add the code at any time. On Android, this is a bad idea. Virtual method calls are expensive, much more so than instance field lookups. It's reasonable to follow common object-oriented programming practices and have getters and setters in the public interface, but within a class you should always access fields directly. Without a JIT, direct field access is about 3x faster than invoking a trivial getter. With the JIT (where direct field access is as cheap as accessing a local), direct field access is about 7x faster than invoking a trivial getter. This is true in Froyo, but will improve in the future when the JIT inlines getter methods." Bye