Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #10395
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | Lew <lewbloch@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: state design pattern: question: inner or outer class: which is better? |
| Date | Wed, 30 Nov 2011 19:10:33 -0800 (PST) |
| Organization | http://groups.google.com |
| Lines | 42 |
| Message-ID | <371153.148.1322709033282.JavaMail.geo-discussion-forums@prnu24> (permalink) |
| References | <4cb57cb9-f87c-4409-9e35-184bdc661f48@l24g2000yqm.googlegroups.com> <4652620.1006.1322680967944.JavaMail.geo-discussion-forums@prfi36> <40add71o90o9p31s9mo3sj468vaj12cb1k@4ax.com> <1854299.24.1322692136633.JavaMail.geo-discussion-forums@preu18> <6addd7tdm8pt96l8sda3spi13cvii3pmi6@4ax.com> |
| Reply-To | comp.lang.java.programmer@googlegroups.com |
| NNTP-Posting-Host | 67.218.107.93 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1322709033 20593 127.0.0.1 (1 Dec 2011 03:10:33 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Thu, 1 Dec 2011 03:10:33 +0000 (UTC) |
| In-Reply-To | <6addd7tdm8pt96l8sda3spi13cvii3pmi6@4ax.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=67.218.107.93; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10395 |
Show key headers only | View raw
Gene Wirchenko wrote: > Lew wrote: >> Gene Wirchenko wrote: >>> Lew wrote: >>> [snip] >>> >>>> As with non-inner nested classes, if the type is needed by any other class >>>> and its semantics are not tightly bound to those of the proposed >>>> outer class, a standalone class is probably more appropriate. >>>> >>>> If the semantics are tightly bound to the proposed outer class, and the sprite >>> state does not depend on the outer class instance's state, then a >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> I do not follow this. Please explain. >>> >>> nested class might be appropriate. >> >> If an instance of the prospective nested class does not use any of the instance > state of the prospective outer class, then it should not be an inner > class, but it might be a candidate for a nested class. >> >> If it does depend on the state of the outer-class instance, for example if it > references an instance variable of the outer-class instance, then it > will have to be an inner class. This follows directly from the > inability of a static member to access an instance member. > > Thank you. It was a terminology issue. I got this from Oracle: > "Nested classes are divided into two categories: static and > non-static. Nested classes that are declared static are simply called > static nested classes. Non-static nested classes are called inner > classes." Are these the definitions that you are using? Yes. I should have said "static nested class" vs. "inner class"; thanks for the reminder. I use the definitions in the JLS, <http://java.sun.com/docs/books/jls/third_edition/html/classes.html> <http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.5.2> but forgot to specify "static" when I said "nested". Thanks for having me clarify and, along the way, refresh the rigor of my terminology. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
state design pattern: question: inner or outer class: which is better? John Goche <johngoche99@googlemail.com> - 2011-11-30 09:22 -0800
Re: state design pattern: question: inner or outer class: which is better? Lew <lewbloch@gmail.com> - 2011-11-30 11:22 -0800
Re: state design pattern: question: inner or outer class: which is better? Gene Wirchenko <genew@ocis.net> - 2011-11-30 14:04 -0800
Re: state design pattern: question: inner or outer class: which is better? Lew <lewbloch@gmail.com> - 2011-11-30 14:28 -0800
Re: state design pattern: question: inner or outer class: which is better? Gene Wirchenko <genew@ocis.net> - 2011-11-30 15:03 -0800
Re: state design pattern: question: inner or outer class: which is better? Lew <lewbloch@gmail.com> - 2011-11-30 19:10 -0800
Re: state design pattern: question: inner or outer class: which is better? Gene Wirchenko <genew@ocis.net> - 2011-11-30 19:23 -0800
Re: state design pattern: question: inner or outer class: which is better? Roedy Green <see_website@mindprod.com.invalid> - 2011-12-02 01:47 -0800
Re: state design pattern: question: inner or outer class: which is better? Lew <lewbloch@gmail.com> - 2011-12-02 07:27 -0800
Re: state design pattern: question: inner or outer class: which is better? Arne Vajhøj <arne@vajhoej.dk> - 2011-12-02 21:32 -0500
csiph-web