Re: advise on best practices guides and projects
Tom Forsmo wrote:
When I was programming C, I studied the Apache2 web server code and
learnt a lot about how to make good C code and . Now I want to do a
similar thing in java [sic]. I was thinking maybe the Tomcat server could be
a good project? any other ideas.
Buy and read /Effective Java/ by Joshua Bloch. Dozens of little tricks, tips
and best practices for Java, in the format of Scott Meyers's /Effective C++/.
It's very specific to Java, yet represents well general O-O principles.
Its easy for me to solve problems in c, but when I do it in java, [sic] I end
up debating questions about
- should I go for strict lyering of the interal architecture,
Go for good encapsulation and programming by interface. Often that does mean
layers, but not fractally and not always.
with its requirements for domain model transformations
If you understand what that phrase means, then you're fine doing that.
- or should I try to a more monolithic design
This is not just a Java question, but a programming one. Should you go for a
monolithic design in Visual Basic programs?
- Some layers/methods end up being passthroughs to a lower layer.
Thats not good, because it adds a layer of complexity to the code
eventhough it adds clear separation of layers.
Passthrough constitutes complexity?
If the layer does nothing, are you sure it's a real layer?
If the layer is separate from the one above it, and separate from the one
below it, and does nothing, doesn't it stand to reason that with its removal,
the other layers would still be separate?
- what can be a dto and what should be a domain object
Is "DTO" an acronym for something?
Modeling is a big subject. But you did ask the one question that sums up the
entire discipline, so I'll give you the answer, since actually it's relatively
simple and will save you years of experience or graduate school, whichever
comes first. In most natural languages the domain, reality, is modeled via
nouns, verbs and attributes. In formal analysis the principles apply
similarly - value objects are the nouns, transformers are verbs, and members
are attributes. Identify the nouns, verbs and attributes of your domain model
and translate them to the cognate structures in your app design.
- there is the question of objects with domain logic and data (i.e.
smart objects). when and why do I need smart objects? I tend to
Sometimes, when the domain boundaries smoothly admit of such encapsulation.
The class design will reflect the domain analysis - if inherent attributes of
the noun involve member verbs, then your class will sport methods.
separate things into code objects and data objects which I think
is contrary to "real" OO design.
"Real" O-O design is what gets the job done on time, on budget and in a
maintainable and extensible architecture, free of bugs.
Don't lock your dogma in your karma in the parking lot on hot days.
- how to represent results to be returned from a tier or dao
Result result = tier.execute();
- how to pass arguments to and from tiers and strategies.
Result result = tier.execute( new Argument [] { arg1 } );
Similarly for Strategy.
- should the data be represented as a collection or just a plain array
Collection, except for sometimes.
I am a little bit tired of all these questions.
*You're* tired! I'm in this business decades and still asking the same
questions. Get used to it.
Read the Sun tutorials first. They are occasionally a bit superficial, but
cover the gamut. Their terseness is an advantage for first reading.
Others will jump in with specific books, besides the essential /Effective
Java/. Books will help. Read books. Also, IBM DeveloperWorks online has
many, many articles and tutorials that are superb.
--
Lew