Re: XStream versus XMLEncoder



Mark Space wrote:
GArlington wrote:


Eclipse has option to generate getters and setters. And constructors
with (or without) parameters.
....
You do get a compile time error (or warning) if your private (I set
all vars private, unless they HAVE to be NOT private) vars are not
accessible.

And again, having all of the above (setters AND default constructor)
does not mean that YOU have to use them. In your program you can just
ignore them...

Not really. You still have to maintain them, write test cases against them, they still bloat your code and make downloads longer, etc.

This seems to me to be a basic POJO vs JavaBeans pattern discussion. Both have their place. Design the software the way it should be designed. Don't try to justify doing only one thing because "it's always no-cost." It'll cost somebody something.

In the ground of being behind Mark's advice is the notion that the class you wrote will be used.

Many of the gripes or suggestions for change with Java have to do with consumers of classes feeling like they don't have to worry about no steenkeen checked exceptions, or setters, or whatever. From the point of view of the *designers* of those classes is the concern that some client will, in fact, ignore that checked exception or call that setter. The designer may wish to close that loophole so that consumers of the class need not concern themselves with it, nor risk the consequences. Thus, declare a checked exception; consumer classes at least will not be surprised by them. Make the class members immutable; the client can ignore many threading issues and has no risk of constructed values suddenly, mysteriously changing to code for.

Client programmers may grumble that they know perfectly well how to construct an object completely before use, but just let their colleague forget to and they will curse the API writer's name for letting such a thing happen and how hard it is to debug and why, oh, why didn't they have the sense to make that member final?

--
Lew
.



Relevant Pages

  • Re: Finding records with a form
    ... The search functions start with a label with a yellow background (I could ... Both combo boxes would show both Client and LoanNo in them. ... it's been fun transmitting some of my forms design paradigm. ...
    (microsoft.public.access.formscoding)
  • Re: A Design Problem
    ... to improve my OO design skills (should be easy to ... I want to provide a set of C++ classes which will enable client (of ... -> In each toolbar there will be some tools. ... a Tool does not have so the exception is unnecessary. ...
    (comp.object)
  • Re: TDD and Refactoring
    ... Given a design with more than one poor qualities, ... > refactor that gives a small but leading benefit. ... Been doing that on the GUI, where it makes a real difference. ... and divert that single client to use the new model. ...
    (comp.object)
  • Re: Joes AsyncSocket Example
    ... data across the thread boundary and pushesit on the socket. ... the point of Joe's example was how to use CAsyncSocket ... According to this design, the winsock stack converts network events ... there's nothing in the code that limits a client in any way. ...
    (microsoft.public.vc.mfc)
  • Re: I need help with my project, please help
    ... which makes no sense - or perhaps the instructor ... For each client you will need to create an Access database that will ... Design a database that contains the needed information, ... purchase (make your test data so that it can reflect more than one ...
    (comp.databases.ms-access)