Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Design Question Date: Tue, 20 Dec 2011 07:42:10 -0800 (PST) Organization: http://groups.google.com Lines: 48 Message-ID: <9703975.362.1324395730498.JavaMail.geo-discussion-forums@preg20> References: Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 173.164.137.214 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1324396145 2911 127.0.0.1 (20 Dec 2011 15:49:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 20 Dec 2011 15:49:05 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10902 On Monday, December 19, 2011 11:38:09 AM UTC-8, Gene Wirchenko wrote: > On Mon, 19 Dec 2011 00:13:07 +0000 (UTC), Novice > wrote: > > [snip] > > >Or is there a better way? > > KISS (Keep It Simple, Stupid). > > Why bother with classes? What do they give you? Is it very > much? It is important to answer this. > > When I was taking my degree, I had a course on operating systems. > One assignment was to compare the performance of various algorithms > for CPU allocation. One of my classmates tried the OOP approach. He > ended up having to scrap his program and start over. He did not > complete the assignment. My approach was to write procedural code. I > saw no need for classes and so did not use them. My program worked > fine. The instructor was impressed with the layout of the output. So you are a better programmer. Doesn't mean that procedural is better than OOP. > OOP is fine, but you appear to be trying to use it for the sake > of using it. OOP is a tool. Use a correct tool correctly. +1 But understand that "OOP" is just a buzzword for "good design". If you follow good design practices, some people might accuse you of using object orientation. > So again, what does using classes buy you? Or do they just > gratuitously complicate your program? "Using classes" != "object-oriented programming" The answer is that they buy you a lot, and do not gratuitously complicate your programming, unless you design them to do so. Any good introductory text on object-oriented programming will explain the benefits better than a Usenet post can. > There are a number of acceptable answers. If you are just > learning OOP, using it could be a good exercise in using a simple > example so you can be sure you understand. This does not mean that it > is, in general, a good approach for your problem. And yet it is. -- Lew