|
|
Back to UserFriendly Strip Comments Index
|
I need a Java joker/wildcard | by Spisefisken | 2001-07-04 05:05:02 |
|
String.indexOf() | by IByte | 2001-07-04 05:13:04 |
|
Thanks again | by Spisefisken | 2001-07-04 06:03:53 |
|
What's SavitchIn? (n/t) | by IByte | 2001-07-04 06:25:55 |
|
Oh I forgot to mention | by Spisefisken | 2006-11-19 12:55:59 |
|
Still no clue, but.... | by IByte | 2001-07-04 06:51:07 |
|
I found the bug myself | by Spisefisken | 2001-07-04 07:12:25 |
|
Future of your code | by DustyX | 2001-07-04 08:18:17 |
| Better yet, get back to basics |
by Schol-R-LEA;2 |
2001-07-04 09:50:19 |
You probably will need to refactor the whole thing, to be honest. No big deal; fortunately, its a pretty small class. Here are the things I'd want to know before I could give any advice, starting with a few general questions:
What is the purpose of this class? Is it a standalone program, or part of a larger application?
What is the best tool for the job? Ae you using the right language? The right file format? The right input format? The right algorithm?
What are the characteristics of this class? What actions can an object of this class take? What kind of data does it work on? What are its class variables and instance variables? Its class functions and instance functions? Where is it visible?
What are the objects of this class for? What are their life spans? Where are they visible?
Does this class perform a service for another class? Could it be replaced by a function in that other class?
What are the steps of the process? Which steps can be separated out? Which steps are repeated more than once, and can you abstract them into a separate function?
To get a little more specific:
What is the program used for? What is HLR, and why are you adding it to a file (I think I may be a bit confused on this part)? What is the generated file for?
Why do you have the data entry code in the class initialization, and not in a separate function?
What do the numbers you are comparing the input string against represent? Could you use a data structure (i.e., a Vector, as DustyX suggested earlier) to hold them? Could you read them into such a data structure from a file when the class initializes, (also as DustyX suggested)? Do you need the data at all, or is there a pattern to it, such that a function could used instead?
From what I can see, this might be done better written in Perl (if you know it), or using a regex camparison; are there reasons you couldn't use either of those tools?
These are just the questions that come to mind right off the top of my head. If you can answer them for us, we could probably help some more; for that matter, you probably won't need any more help anyway.
One more thing: I advise you to drop what you are doing and go buy a copy of Programming Pearls by Jon Bentley. Right now. It is all about this kind of thing, and full of valuable insights into the craft of programming.
HTH. |
|
[ Reply ] |
|
|
[Todays Cartoon Discussion]
[News Index]
|
|