users@glassfish.java.net

Objects vs. Static vs. performance vs. structure

From: <glassfish_at_javadesktop.org>
Date: Sun, 18 Apr 2010 02:26:22 PDT

Hello,

I have a question about performance in Java EE.

I have a Dynamic Web Project where I sumbit a form that sends
info to a Servlet and servlet filters out some data from a XML file according
to submitted criteria.

Now, I have 2 choices:
1. create classes that define data filters and have common interface to use in the Servlet
2. no objects, I have static functions that define how to filter the data

And I may reuse those filters and also I may make more of them (+ with interface would also be that I can hold necessary filters in an array and apply them without having to write each one in some "if" clause manually)


Examples:
1. interface has a method "boolean applyFilter()" - true when data passes as OK false when REMOVE
2. have class with static functions "boolean filterIntegerRange(a,b,c)", "boolean filterString(a, b)"



Question: [i][b]Which option looks the best to you?[/b][/i]

Thanks
[Message sent by forum member 'urmas']

http://forums.java.net/jive/thread.jspa?messageID=397613