Mitch Hartner

Greenhorn
+ Follow
since Feb 04, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mitch Hartner

Thanks for the replies. Ilja, I have no problem adopting the latter philosophy. How does one decide what arguments, if any, should be passed into a constructor?
I've been reading a lot lately (on Agile development, Domain Driven Design, Test Driven Design and a myriad of other OOAD topics) and for the most part have been left with more questions than answers.

In Robert Martin's excellent Agile Software Development, just about all the classes in his code samples use read/write properties. No explanation is given for why this approach is taken.

This seems to run contrary to the idea of data integrity, which would seem to suggest that as few class properties as possible should be made writable. I don't want to expose my classes to the risk that clients will (out of negligence or incompetence) corrupt my object's state by making all properties writable.

I guess my ultimate question has to do with object creation. Before doing all this reading, my philosophy was to design classes with entirely read-only properties and a non-default constructor that took the parameters needed to create the object.

But this approach assumed that that objects were responsible for creating themselves. Robert Martin's book in particular illustrates a new (to me) approach in which objects are created by factories. This seems to require that many, if not all, of a class' properties must be read/write so that the factory class can set the object's various attributes. Given this pattern of object creation, what's the point of having non-default constructors, since class initialization is being orchestrated outside of the class in question?

I look forward to reading people's responses.
I'm wondering how persistence of nested business objects should be handled.
For example, lets assume I have an (oversimplified) class design as follows:

Employee
| |
Address Name

In other words, an Employee class which is composed of both an Address and Name class. Address is a discrete class which can be saved independently of Employees (eg. Customer class also contains an Address). Per best practice, I have a DAO that only concerns itself with loading and saving Address objects:

class AddressDAO{

public static void save(Address addr){

//save address object

}

public static void delete(Address addr){

//delete address object

}

public static void add(Address addr){

//add address object

}


public static Address get(String key ){

//get address object

}
}

I similiary have an EmployeeDAO class that laods/saves Employee objects. My question: is it appropriate to simply call AddressDAO.save from EmployeeDAO.save? Is there a cleaner approach?

[ November 06, 2008: Message edited by: Mitch Hartner ]
[ November 06, 2008: Message edited by: Mitch Hartner ]
Thanks to all who replied.
Thanks for the suggestion. I've seen lots of examples of Interpreter but none that are real world examples. Any suggestions?
I want to build a lightweight and ultra fast data query layer (i.e. read only) and I have a few design related questions. First the rules of the game, this is strictly JDBC, and the use of Hibernate or other ORM frameworks is not acceptable (client rules). The layer will return simple ArrayLists of POJO data structures. This is for an HR system, so some example POJOs might be: Employee, Job, Salary, Department.

There will be at least one class that acts as the search provider for each POJO type. For example, I might design an interface IEmployeeSearchProvider that returns lists of Employee POJOs and would define multiple methods:

public interface IEmployeeSearchProvider {

public ArrayList<Employee> GetEmployeesByName();
public ArrayList<Employee> GetEmployeesByDepartment();
public ArrayList<Employee> GetEmployeesByManager();
public ArrayList<Employee> SomeMethod1();
public ArrayList<Employee> SomeMethod2();
public ArrayList<Employee> SomeMethod3();

}

Depending on what type of filters need to be applied to the data being retrieved, a given class implementation of IEmployeeSearchProvider could constrain the results appropriately. For example, class AllActiveEmployees would implement IEmployeeSearchProvider, and implement each of the methods such that only Active employees are returned.

The problem with this approach is that I'm defining mutltiple methods in the interface that search provider classes must implement even if they aren't interested in doing so. Throwing a MethodNotSupportedException in those cases when a class has chosen not to implement a given method seems like a hack. Surely there's a cleaner approach?
[ October 28, 2008: Message edited by: MitchieA ]
I'm trying to figure out the difference between re-starting a server and republishing to a server. I want to minimize the times I need to restart the WSAD server based on code and other resource changes that I make. Also, what exacly is a synchronized server?

Thanks!
18 years ago
I studied and passed the SCJP certification in anticipation of some java development coming my way at work. I've done some limited programming using struts and tomcat (very basic servlet stuff). I suppose the next logical is to learn more about servlets and J2EE. The frameworks used at work are Hibernate, Spring, and Struts (for UI). Should I spend time learning J2EE before diving into the framework specific stuff? What books would bring me up to speed on J2EE?

Thanks
18 years ago
Hey all,

I've googled this to death but still can't for the life of me figure out how to debug against Tomcat/Apache with Eclipse. I/'m running the latest version of eclipse and tomcat and am trying to step through some Spring samples. The samples build fine and I can navigate the application using a web browser. Now I just have to figure out how to debug using Eclipse. JDK is 1.5

Thanks!!
Hey all,

I've googled this to death but still can't for the life of me figure out how to debug against Tomcat/Apache with Eclipse. I/'m running the latest version of eclipse and tomcat and am trying to step through some Spring samples. The samples build fine and I can navigate the application using a web browser. Now I just have to figure out how to debug using Eclipse. JDK is 1.5

Thanks!!
18 years ago
've installed the latest versions of Eclipse, Tomcat and the Spring-IDE. Being fairly new to java, I'm still not super comfortable with the concept of building/running web apps and the various entries that must be made in the classpath file to make everything run smoothly. So I was wondering what I need to do get to get the petclinic app to run both with and without debugging (obviously) from within Eclipse. I've read the readme.txt and the petclinic.html but these docs, while immensely helpful, didn't answer my sepcific questions.

Here is a list of relevant installation locations

1. Eclipse --> C:\Eclipse
2. Spring Framework with Dependencies --> C:\Eclipse\Spring
3. PetClinic --> C:\Eclipse\Spring\samples\petclinic
4. J2SE Dev Kit 5.0 --> C:\Program Files\Java\jdk1.5.0_06

I don't see any errors in Eclipse for the petclinic package which means (I think) that all import statements and references are resolving fine. I just need to figure out to get Eclipse to run/debug the app. Any help would be appreciated. If I'm posting to the wrong forum I apolgize in advance and would be happy to move this post as directed!
Edit/Delete Message