How to design a class for managing file path ?
Posted
by remi bourgarel
on Stack Overflow
See other posts from Stack Overflow
or by remi bourgarel
Published on 2010-04-23T07:58:51Z
Indexed on
2010/04/23
8:03 UTC
Read the original article
Hit count: 311
oop
|best-practices
Hi All
In my app, I generate some xml file for instance : "/xml/product/123.xml" where 123 is the product's id and 123.xml contains informations about this product. I also have "/xml/customer/123.xml" where 123.xml contains informations about the client ... 123
How can I manage these file paths :
1/ - I create the file path directly in the seralization method ? 2/ I create 2 static class : CustomerSerializationPathManager and ProductSerializationPathManager with 1 method : getPath(int customerID) and getPath(int productID) 3/ I create one static class : SerializationPathManager with 2 method : getCustomerPath(int customerID) and getProductPath(int productID) 4/ something else
I'd prefer the solution 3 cause if I think there's only one reason to change this class : I change the root directory.
So I'd like to have your thoughts about it... thx
© Stack Overflow or respective owner