• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thought process to do a task using Java  RSS feed

 
Dave Hyer
Greenhorn
Posts: 12
Eclipse IDE Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

As I am reading HeadFirst Java, I figured I have some simple tasks I need to do on my work computer. Why not do it and learn some java eh?

I will say up front I am not looking for code. When I run into problems, I will post it here. Here is my situation:

I work for a big company doing tech support. Our CRM tool uses xxxxx,xxx.xxx for the case id numbers. I want to create a list of my currently open cases and put it in a file. Read the file contents into an array.

Now I have some eclipse workspaces where I do my work for my customers. I want to generate a list of the workspaces and compare it to my active case list. If there is an open case, then leave the workspace directory alone. If there is not an open case, then delete it.

I am going to assume I am going to be doing a String compare as this is not a straight up int comparison. Or should it be an int comparison if that is easier?

So my code will take the 1st case id in the open case array, and go through the list of workspaces. Once it goes through the list, and either skips or deletes, should I remove it from the array and move all the other id's up by one? When I was trying to learn Perl years ago, that seemed to be the thing. Wasn't sure if that was correct here.

And the list of open cases will get shorter with each pass. Plus I need to reread the remove any deleted workspace id's from that array. I am assuming that is faster than trying to reread the directory contents?
To me, the recursion and array manipulation will be the tricky parts.

I am looking for any suggestions on if this process is too convoluted? Is there a better way?

Thanks
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stop thinking about arrays, recursion, Strings, and ints.

Think about the problem in English (or whatever your favorite natural language is). Pretend you are talking to a young child. Try and explain to them what you need to do, and how they should do it step by step.

If you begin by thinking in terms of arrays, Strings, and recursion, you've already locked yourself into an implementation.
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple approach is to write down the steps in plain english. Steps are such that a non technical person can understand them clearly. Once that done, then start
converting each steps into the code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!