June 22nd, 2004, 12:09 AM
Java Batch Creator
At last I've got this program to a working version. I'm sure there is still a lot of stuff that I can add to it, and it has by no means been exhaustively tested.
The program is designed to generate batch files to run and (if specified) compile java programs when the java bin directory and some other information is specified. I haven't provided any documentation with this "build", but I will do when I fix it up a bit.
Please note that the run.bat file provided in the zip archive will not work, you will need to edit it to run the program (or run it in your ide or however you would normally run programs). It is fairly ironic that you will probably end up using the program to generate a batch file to run itself :P
- I intend to implement the DefaultListModel class in JBC.java instead of using my own custom built list to make the code simpler and most probably more efficient
- I am thinking about allowing the user to specify the names of the files that the program outputs. (there is already support for this in JBC.java)
- I would like to add an option to keep the console visible after each batch script has run in order to support certain command line programs that do not do this by default.
- I'm going to have to do some error checking on the paths at some point in time, could get strange bugs.
I'm sure that there are other changes that I could make and features that I could add, but I can't think of them at the moment, and please remember that this is designed to be a very basic program. I am not sure if it will run and complex programs.
I hope that someone uses the program and finds it useful. If you try it, could you please reply with some comments about the program, any bugs, etc.
June 22nd, 2004, 04:04 AM
One thing I noticed is that you made a method called doFileIntro() and only used it once when I believe you could have used it for each batch file. Was there something I missed that prevented this? I guess it really doesn't matter, works the same both ways. Just seems odd to type something out when you have a method that does the thing that's typed out. Overall it looks pretty good. I haven't actually run it yet I just read the code in JBC.java. Keep it up, you seem to be doing well with java.
June 22nd, 2004, 04:06 AM
The first things on my mind when reading your code are this:
Telling me your default constructor does nothing useful when I can read what it does is pointless. I'd be more interested in why you are setting everything to null/0. Is there some specific reason for it? Will it break if I change it?
You also have plenty of comments such as:
public method to remove a package from the list
We can all see that the method is public by looking down a couple of lines.
You need to add some proper data validation to your mutator methods. You are just taking a parameter and passing it right to the object variables without verifying if the data is indeed valid.
A prime example is-
public void setPath(String path)
this.path = path;
I don't quite understand why you are doing empty println's. It would be more efficient to simply add a \n to the preceding line.
In jbcgui.java you may want to look into creating a singleton class to hold your 'global data'. Check out 'Design Patterns' from Addison Wesley. There are plenty of other references out there as well.
I'd recommend picking up the Kernighan and Pike book 'The Practice of Programming'. It is an excellent book for learning better coding practices.
Not too bad.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
June 22nd, 2004, 08:36 AM
h3r3tic, the reason that I only used it once was that I was testing it to check that it would work before using it changing all the code to use it, but I forgot about it And thanks for the reply, Juridian, I'll definitely have a look for that book. I think the reason that I've done some of the things that you've pointed out is that it's the way we were taught at uni and I haven't learned a better way, but hopefully I can check out that book.
To be honest, I'm not quite certain why I did those empty println's...I can't have been thinking right at the time
Thanks a lot for the replies