Results 1 to 4 of 4
Thread: Object Oriented
- 03-29-2009, 04:34 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
- 03-29-2009, 05:53 PM #2
Well, it's a pretty contained piece of code, but what I would do is following:
- It's very bad idea to hardcode paths in a program. Every time the path changes, you have to change the program, recompile , etc. Why not get the path from a sort of properties file (LimeWire.prop?). That way, if the path changes, you can change the property file without recompiling the code. You can also store the regex patterns in that file (same advantage as explained before).
- Breakout the comparation/search part into a method (or into another class if it can be used by other classes).
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 03-29-2009, 06:36 PM #3
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
thanks for the reply CJSLMAN.
ave a clue where to put the regex expressions in here!! can anyone help please?Last edited by GraemeH; 05-05-2009 at 08:34 AM.
- 03-29-2009, 07:50 PM #4
Member
- Join Date
- Mar 2009
- Posts
- 20
- Rep Power
- 0
To make it more OOPy you do need to make the code part of a class definition so an object can be instantiated. But then main will look almost stupidly simple, something like
The only class method there is doStuff(). But your example is so straightforward, and it doesn't interact with other objects, that you could put all of the code in the constructor and do without other methods if you wanted to, and it would be automatically run when the object is created. If it interacts with other objects you should have method functions like getValueOne(), setValueOne(), saveWorld(), etc., which let other objects communicate with it and tell it to do stuff.Java Code:public void main(String args[]) { LimeWireAnalyserDownloadDat lime = new LimeWireAnalyserDownloadDat(); lime.doStuff(); }Last edited by glhansen; 03-29-2009 at 07:52 PM. Reason: Fix the code brackets.
Similar Threads
-
how to pass an arraylist from an object back to the parent object that it was created
By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 06:14 PM -
Object- Oriented guide?
By sciguy77 in forum New To JavaReplies: 4Last Post: 01-18-2009, 03:33 AM -
Is JAVA completely object-oriented???
By venkateshk in forum New To JavaReplies: 2Last Post: 11-17-2008, 09:17 AM -
Oriented language
By pawankumarom in forum New To JavaReplies: 1Last Post: 09-08-2008, 01:12 PM -
Question about java object oriented Language
By lenny in forum New To JavaReplies: 3Last Post: 07-26-2007, 03:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks