Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6652
| Date | 2011-07-29 17:32 +0200 |
|---|---|
| From | Silvio <silvio@moc.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Really "BIG" class name wanted |
| References | <37e4697b-5aab-42ef-a1e5-3ce5a6d866a8@e15g2000yqd.googlegroups.com> <j0rok2$t9e$1@dont-email.me> <environment-20110728170428@ram.dialup.fu-berlin.de> <00f3e49b-fb85-463b-bc8f-9de92c6b9445@fq4g2000vbb.googlegroups.com> |
| Message-ID | <4e32d28e$0$23922$e4fe514c@news2.news.xs4all.nl> (permalink) |
On 07/29/2011 02:28 PM, Ross wrote: > I'm really confident that what I am doing is a really good idea. A lot > of things that were tricky and/or non-intuitive or complicated have > suddenly simplified right down, and it's a much, much, better > structure program now than before I had this class. A fair number of > classes which before had long and complex argument lists in their > constructors now take one argument. And I find that when I find that I > DO need access to the properties from one particular class, I just get > them from this "central" object, and don't have to go around changing > constructor calls elsewhere. > I went down that road a couple of times and in all cases what looked like a good idea at the beginning has resulted in an enormous amount of tightly coupled code and shameful regret in retrospect. Each time I started with utility classes/interfaces like A, B and C and depending classes AU1 (using A), ABU2 (using A and B), ACU3 (using A and C), even an ABCU4 (using A, B and C) and a whole bunch of AUn, BUn and CUn classes. So far so good but to get rid of classes with multiple parameters I created a wrapper O (short for Omega, I love descriptive names) around A, B and C. Along with that all U classes became OU1 to OU28. Simple and clean, at first sight. But where my xxxUnn classes could first be subdivided looking at their dependencies this was no longer possible. Things exploded when utility classes D, E, F and G where added to O. I even discovered a way to make matters even worse. I got annoyed by using o.getA().aMethod(..) and decided to lift some A methods (along with some B, C and G methods) to O to allow o.aMethod(..). Brilliant stuff. Long story short: Some 8-10 years later I will never do this again and have even gone through some horrible refactoring processes to revert my accomplishments. It turned out I needed some of the Unn classes for something separate and could not afford to carry all the other users with me. Nowadays I use Scala. This language allows me to implement interfaces A through G in a single class O (just like Java does) BUT it also allows me to be specific about the dependencies in my U classes: class U19(session : A with B with E with F) class U2(context : A with G) and allows instantiation of Unn with an O object as long as it implements all of the mentioned interfaces (which it obviously does) WITHOUT messing up the dependency graph. That was a cowardice move but I will never look back (OK, except when I need to dive back into the Java code). I wish you good luck! Silvio
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Really "BIG" class name wanted Ross <rossclement@gmail.com> - 2011-07-28 03:20 -0700
Re: Really "BIG" class name wanted Patricia Shanahan <pats@acm.org> - 2011-07-28 03:38 -0700
Re: Really "BIG" class name wanted Roedy Green <see_website@mindprod.com.invalid> - 2011-07-28 04:01 -0700
Re: Really "BIG" class name wanted markspace <-@.> - 2011-07-28 06:35 -0700
Re: Really "BIG" class name wanted Ross <rossclement@gmail.com> - 2011-07-29 05:28 -0700
Re: Really "BIG" class name wanted markspace <-@.> - 2011-07-29 06:36 -0700
Re: Really "BIG" class name wanted Robert Klemme <shortcutter@googlemail.com> - 2011-07-29 15:55 +0200
Re: Really "BIG" class name wanted Tom Anderson <twic@urchin.earth.li> - 2011-07-29 14:56 +0100
Re: Really "BIG" class name wanted Tom Anderson <twic@urchin.earth.li> - 2011-07-29 15:08 +0100
Re: Really "BIG" class name wanted Silvio <silvio@moc.com> - 2011-07-29 17:32 +0200
Re: Really "BIG" class name wanted Silvio <silvio@moc.com> - 2011-08-01 13:47 +0200
Re: Really "BIG" class name wanted lewbloch <lewbloch@gmail.com> - 2011-07-29 09:25 -0700
Re: Really "BIG" class name wanted lewbloch <lewbloch@gmail.com> - 2011-07-29 23:08 -0700
Re: Really "BIG" class name wanted Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-30 11:24 +0000
Re: Really "BIG" class name wanted Patricia Shanahan <pats@acm.org> - 2011-07-30 06:10 -0700
Re: Really "BIG" class name wanted Gene Wirchenko <genew@ocis.net> - 2011-08-01 16:22 -0700
Re: Really "BIG" class name wanted Lew <lewbloch@gmail.com> - 2011-07-31 02:29 -0700
Re: Really "BIG" class name wanted Lew <lewbloch@gmail.com> - 2011-08-01 14:22 -0700
Re: "$" in class names reserved [was: Re: Really "BIG" class name wanted] Wayne <nospam@all.invalid> - 2011-08-02 02:33 -0400
Re: Really "BIG" class name wanted Ross <rossclement@gmail.com> - 2011-07-29 05:37 -0700
Re: Really "BIG" class name wanted Bent C Dalager <bcd@pvv.ntnu.no> - 2011-07-30 22:42 +0000
Re: Really "BIG" class name wanted thoolen <thoolen@tholenbot.thorium> - 2011-07-30 23:38 -0400
Re: Really "BIG" class name wanted markspace <-@.> - 2011-07-31 20:32 -0700
Re: Really "BIG" class name wanted Silvio <silvio@moc.com> - 2011-08-01 13:54 +0200
csiph-web