SNK3R's Java Program - Help? (in Off-topic)


SNK3R March 7 2006 6:49 PM EST

Hey, there. I've been working on my own little RPG game written in Java for fun very recently. I've been able to overcome most of my errors up until a few days ago, and I haven't been able to fix my compile errors. Considering I've only been learning Java for about a month or two now, I'm looking for some help as to why I'm getting the error so I can advance my program.

Enough of the babbling, the three files below are the .java files, so, obviously, you'll need to compile them. Level1Battle will not compile correctly, but MiniGame and Randomization will, but I'm posting all 3 files here since they're going to need to be called from each other. The main file is MiniGame.java. I removed the call function for Level1Battle since I was getting compile errors in that .java file, but that's what will be happening eventually. The errors I'm receiving are due to (I think) the fact that the program does not know where to get the information from. I've tried multiple lines of code to try to get it to be called, but it just seems like it won't work. Please note that there are currently (from what I can see) only two types of compile errors: 1) the hero string from MiniGame needs to be called but can't be found (it's not in the code, but I've tried calling it) & 2) all randomization damages, etc. can't be found via the Randomization class.

I'd appreciate any help, but don't just fix it and say, "Here you go." I'd appreciate an explanation of what you did and why you did it and what I left out that was creating the error, or even just some hints on how to solve it. And if you can't help, thank you for just reading this. ;)

[T]Vestax March 7 2006 7:10 PM EST

Open source project? And your idea of version control is a forum... I suppose.

QBPixel Sage March 7 2006 7:14 PM EST

I may take a look into this later.

[T]Vestax March 7 2006 8:39 PM EST

For those that might be perplexed with what version control means:

Version Control is a method to keep track of the many versions of a software program. It becomes difficult to coordinate the evolution of a program when multiple people are given access to the code and are able to make updates or changes. For example:

Person A puts up a version of a program.
Person B & C download the copies.
Person B then puts up her version of the program with her changes.
Person C then puts up his version of the program with his changes.
Person C could effectively overwrite Person B's changes.
Otherwise, player A might need to find a way to reconcile both sets of changes.

The reconciliation process will be complicated if both submissions end up changing the same sections of code. Therefore, may I suggest a slightly more structured system for making changes.

1) Have people document. Advise people to document clearly what they do. If they change a line of code then they should note which lines and which version of the code was modified. Then state why these changes were made. Have people submit only the lines that were actually changed rather then a whole new copy of the entire document. State a line number or group of lines, and then what is to replace these lines. It'd suggest you recognize only the lines of the original document, not line numbers as you work from top to bottom. Just keep a copy of the unchanged document open in a text editor for reference.

2) Numbering helps. Keep a version numbering system so that people can easily reference what version they made changes to. I simple method is to give each file it's own number that starts at 1 and counts up whenever a change is made to it.

3) Calling dibs. It would also be helpful if people could state what they will start working on once they find something to do. This is not necessary, but is a good way to keep two people from working on the same issue. Don't work on another person's problem just because you think you can do it better. Just wait for them to submit and then see if you can improve it.

4) Make copies. Keep copies of your source files in separate folders that go through the entire history of the program. You don't want to make a change, find out you messed the whole thing up, and then have nothing to roll-back to. It would also be bad to find out that someone made changes you might really want but used a really old version for their line references.

I could go on about ways to improve version control, but I think that's more then what you wanted to hear already. Of course, you don't need to do any of this. It is a bit extreme if only 2 or 3 people end up submitting changes every couple of days or so. Yet, if people submitted changes on a daily basis, you would have a headache keeping one change from breaking something that might have worked before. Version control is no joke. People make lots of money designing programs that deal with just this issue.

Good luck and I'll take a look later on.

Maelstrom March 7 2006 9:19 PM EST

I'm visiting relatives for the next week, so can't test the code. Bump this thread on the 14th, and I'll try to take a look ;)

AdminJonathan March 7 2006 11:00 PM EST

btw, svn-hosting.com provides a very reasonably priced hosted version control service.

SNK3R March 8 2006 12:37 AM EST

Thanks to everyone who is helping me. Vestax's point of version control is quite genuine, I will agree. However, for this size of help that I need and for the few people that may or may not work on it, I won't quite implement anything too big yet. If you do end up working on it, please do post here, though, to let us know if you're going to check the coding. If in the near future I need further help with my game as it may progress to be more complex, I may construct some form of version control for us to deal with. I thank you Jon for directing me to a nice service; I'll definitely check it out if things don't work out well for my programming needs and if I may need help with coding problems. :)

Considering that I have extremely limited knowledge in Java so far and my thought process is quite more advanced, I do see some possible problems lying ahead, but I won't worry about them until it happens.

Again, thank you to everyone so far, and if you have any additional comments or questions (perhaps you don't understand something?) about my coding, don't hesitate to ask. If I get some time between the rest of my exams this week, I'll see if I can look over my coding even more to see if I can find what's going on unless someone else can help me pinpoint my error(s).

AdminQBnovice [Cult of the Valaraukar] March 8 2006 1:39 AM EST

I think the programmers might be trying to suggest using a VCS mostly as it's a good habit to get into, with any luck in a little while you'll be have so much code you'll desperately need it. Knowing how to use it, and having used it from the begining might be of some help at that point...

PoisoN March 8 2006 6:55 AM EST

I'd suggest using Eclipse, a very nice and helpful editor. I'm not very good explaining java errors in English, but here are some tips:

1. Consider using packages. (a Link: http://jarticles.com/package/package_eng.html )

2. You create a string object named hero in your MiniGame class. But it is just visible within minigame/ main. Try something like this:

public class MiniGame
{
public static String hero;
[more declarations...]

public static void main(String[] args)
{
[more Code...]


so the hero string object is now a string that can be accessed through MiniGame.hero (even better make a getter method and hero not public). Or pass it if you call a method that has to care about "hero" ie. class.method(String hero).

3. Same is necessary if you want to read "heroDishingDamageRandom1" and "experienceRandom1", "enemyDishingDamageRandom1"...

4. The first if loop, you access "Level1.enemyHP" - huh?

SNK3R March 9 2006 2:47 PM EST

Absolutely brilliant, PoisoN, thanks! I'm currently using TextPad for my editing since that's what we're using in my class. Is there anything beneficial to using Eclipse over TextPad?

I guess I made the common newbie mistake. At least, though, I know where my errors are and I'll unlikely do it again because I learned from it. It makes sense, though, if I make a public class static int not in the main, I can call it from any class.

Yeah, sorry about the "Level1.enemyHP." I was messing around with a much smaller file earlier and had it named as a class Level1, so I just trashed that. Needless to say, I was able to fix all the errors and continue with my programming. Thank you very much for your help, and I appreciate the way you helped me with it.

AdminJonathan March 9 2006 4:00 PM EST

"Is there anything beneficial to using Eclipse over TextPad?"

Is Mathematica more powerful than Windows Calc? :)

AdminJonathan March 9 2006 4:01 PM EST

... my mind absolutely boggles at the thought that someone would teach a class in java and not show students Eclipse. The humanity!

SNK3R March 9 2006 4:10 PM EST

It may have something to do with this only being her second semester teaching a Java course. Last class, she introduced us to applets after our test on methods, definitions, and basically the rough idea of how Java works through object-orientation.

P.S. Now I'm going to have to check up on Mathematica and Eclipse. ;)

QBOddBird March 9 2006 5:15 PM EST

forget Mathematica, go Maple 7 ~_^


and Jonathan, our Java teacher never showed us Eclipse either. The world is a mad place.

SNK3R March 9 2006 5:20 PM EST

I absolutely love Maple. After I was introduced to it about 1.5 years ago, I use it all the time to check everything.

P.S. I tried scoping out Eclipse, but I couldn't quite understand what I was doing. :)

[T]Vestax March 9 2006 5:23 PM EST

Eclipse has a SVN plug-in. :)

As for the way I learned it. Eclipse wasn't around then. I used notepad and command-line compiling. Honestly though, I still prefer IDEs with minimal features. I particularly HATE IDEs that try to do anything for me, even if its a necessary correction.

Stephen March 9 2006 5:27 PM EST

I'd recommend coding first at the command line or batch, then use a tool when you know how all the pieces fit together.

Some people, like Bartjan, remain at the command prompt their whole lives and eschew modern aids like a GUI. ;)

bartjan March 9 2006 5:28 PM EST

The year before my class they did the class 'Introduction to Programming' in Modula-2; for my class it was Pascal; the year after they switched to teaching programming in Derive and a year later they switched again, this time to Java. I had no problems passing it in my first attempt, but 1 guy in my class did have some difficulties with learning to program, so he ended up doing the class 3 times, in 3 different languages.

By the way, that was "Top Speed Modula-2", "Top Speed Pascal" and "Derive for DoS", 3 nightmare-inducing products...

bartjan March 9 2006 5:30 PM EST

Stephen: I do run my shells in a xterm ;)

AdminJonathan March 9 2006 5:50 PM EST

Eclipse is best learned with someone to show you the ropes. It's not small. If none of the TAs know what they are doing, see if there's a local java user group.

Seriously, two hours spent learning Eclipse will pay you back _at least_ those two hours _every day_ of your Java programming career. It's one of the best investments of time you can make.

Not that I'm endorsing inflicting any more Java on yourself than necessary, but if you're taking a class you don't really have a choice and Eclipse will save you a lot of pain. :)

PoisoN March 9 2006 8:08 PM EST

BlueJ could help you to understand Java(and the mystics behind it) too.

QBsutekh137 March 9 2006 11:45 PM EST

Where is the form builder? *smile*

Pretty slick tool, though...easy install on OSX and everything looks simple to use. Snappy too, not something I am used to from Java-based apps. Yeah, I know performance h jumped leaps and bounds -- it has been a while since I messed with Java tools...

[T]Vestax March 9 2006 11:52 PM EST

I hate BlueJ with a passion. Yet, I'm sure its more for personal reasons.

PoisoN March 10 2006 6:10 AM EST

Well then I'm happy for you, because this thread was not opened for your minimalistic feels Vestax :-D. @ Sutekh, check out Eclipse VEP.

[T]Vestax March 10 2006 8:11 PM EST

Okay, I've taken some time to review your code and think things over a bit. Needless to say you are heading toward a programing nightmare. Part of this is do to your lack of programming basics, and some of it is in the lack of a design. But I'm not about to pick on you, I think I know a way to build a very interesting and flexible game out of your concept. First some basics:

Separation of data from game mechanics. Having your program filled with all the text, conditions, responses, monster date, and events is a bad idea. The Java itself should be striped down to an engine and just an engine. You have a System.out.println() function for every line in the introduction and the tutorial. At this rate you will have a println() function for every single piece of text you can possibly output. This is needlessly tedious. The simpler solution is to develop an engine with one println function in a loop that handles all lines of text fed in from an exterior file. Then you can just perfect an game engine and then leave it be, never to make a println() statement ever again. I'll help you do this.

Data containers such as classes and arrays. I'm sure I could fill in a whole chapter on what these are, how to use them, and their benefits, but you will learn all this eventually. What I'm going to do is try to give you a broad picture of how these can help us. An array is a data container, it will store a list or group of data of all the same type, such as all integers or all Strings, into a single reference. Lets take the list of random numbers that you tried to generate as an example. Instead of doing this:
heroDishingDamageRandom1 = generator.nextInt(25) + 20;
heroDishingDamageRandom2 = generator.nextInt(6) + 1;
heroDishingDamageRandom3 = generator.nextInt(6) + 1;
heroDishingDamageRandom4 = generator.nextInt(6) + 1;
heroDishingDamageRandom5 = generator.nextInt(6) + 1;
heroDishingDamageRandom6 = generator.nextInt(6) + 1;
heroDishingDamageRandom7 = generator.nextInt(6) + 1;
heroDishingDamageRandom8 = generator.nextInt(6) + 1;
heroDishingDamageRandom9 = generator.nextInt(6) + 1;
We could do this instead:
heroDishingDamageRandom[1] = generator.nextInt(25) + 20;
heroDishingDamageRandom[2] = generator.nextInt(6) + 1;
heroDishingDamageRandom[3] = generator.nextInt(6) + 1;
heroDishingDamageRandom[4] = generator.nextInt(6) + 1;
heroDishingDamageRandom[5] = generator.nextInt(6) + 1;
heroDishingDamageRandom[6] = generator.nextInt(6) + 1;
heroDishingDamageRandom[7] = generator.nextInt(6) + 1;
heroDishingDamageRandom[8] = generator.nextInt(6) + 1;
heroDishingDamageRandom[9] = generator.nextInt(6) + 1;
Note the brackets around the numbers. That is a distinct feature of an array. It allows one reference to point to a host of variables, all of the same type, but with different values. Now that's not very cool, not until you realize that you can fill the bracket with either a constant or a variable. Meaning I could do this:
int count = 1;
heroDishingDamageRandom[count++] = generator.nextInt(25) + 20;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
heroDishingDamageRandom[count] = generator.nextInt(6) + 1;
The '++' after count increments the integer by 1 after the statement is executed. Now, I know what your saying, still not cool. Well, now let's mix in a control statement, like a loop of some kind:
heroDishingDamageRandom[1] = generator.nextInt(25) + 20;
int count = 2
while (count < 10) {
  heroDishingDamageRandom[count++] = generator.nextInt(6) + 1;
}
I left the first variable out of the loop because its value was to be different then the rest, but since variables 2 to 9 were all going to be assigned in the same way, I could place them into a nifty loop. The best part is that all you need to do is change two numbers and you can make this code create and store a hundred or a thousand or even a million random integers.

Now I'm not about to replace your code with this because that's not really the best way to use random numbers in the first place. Yet it serves as a good example. Now about classes. This is another thing we will certainly use. A class allows us to group data of different types, such as integers along with Strings, not just one or the other. They also contain the methods that act on that data and in essence they run everything that happens. You're already getting a taste of classes and learning that everything in Java is an instance of one, but you haven't yet learned a good way to separate your program efficiently, but you will.

I'm coming to the realization that I have already written a chapter or two. Just let me know when you have absorbed all of this and then I'll move onto my idea for structuring your program.

PoisoN March 10 2006 10:36 PM EST

An array starts with [0] ;-)

[T]Vestax March 10 2006 11:02 PM EST

I know, but I didn't want to scare SNK with numbers he may not yet understand. :)

SNK3R March 11 2006 12:34 PM EST

Arrays seem without doubt quite useful, to say the least. I will admit that my code that I posted is quite horrible. I understand that. However, I was waiting until I got my whole general basis for everything set to clean everything up. That's why I've spent the last day or so removing everything from main (thanks for that idea, totally forgot about it. ;) ) as well as separating all of my "sections" of my game.

One thing that I'll mention is that when I had submitted the code above, I was planning on using all 9 separate numbers randomization. However, I came to realize that my program would very quickly become obsolete or inefficient due to the fact that nothing was automated and it would all be up to me to keep adding more randomizations. However, when I was cleaning up my code and shifting things around, I came across something that works much better, in my opinion, than using the array idea. (Not that the idea was stupid or anything, just seemed a little obsolete once I found the new way to use it.) Basically in my battle code now, all I have is one round of fighting and I have it in a loop. So while the fight is still going, the rounds will just keep going until the fight has ended. I also noticed that before when I would call for a randomization number and I tried calling for the same randomization number, I would get the same number. That would have been extremely inefficient so you can see why I had at least 9 different randomization figures for each category of randomization (e.g., hero dishing damage, enemy dishing damage, experience reward). However, now that I have a successful loop for an infinite number of rounds, I also have the randomization grabber going an infinite amount. Essentially what I'm babbling about is that every time the battle loops over, it'll grab a new integer between the scale I set it to. This way I only need one randomization scale for each category, and each category will have different randomization values.

As per your lesson on arrays, I appreciate it. This has given me an idea where I can use arrays to randomize my String pattern for enemy occurrences. When I get to that point in time (which isn't as important, in my opinion, as finishing the leveling system I'm currently working on), I'll definitely come back to your arrays again and see if I missed anything that might help to cut down on excessive coding. I appreciate your help in teaching me some new things. It's always nice to learn something new to use in your code to make life much simpler. Also, I'd like to encourage you to make any other suggestions in my coding, but please note that the above code is pretty obsolete now that I have changed quite a bit in regards to functioning. I don't mind suggestions, but please do keep in mind I won't always use them if I don't see how they're going to improve anything. This can be an example for my randomization arrays since I found a much better way to call them. Thanks for the help so far, and I look forward to your next post regarding structuring my program. ;)

P.S. The only experience I've had with arrays so far is from reading the book so this helps in a sense that I can fall-back on an example that relates to me which is much easier to understand.

YOU March 11 2006 12:49 PM EST

Use "Dynamical System of Statistic" to generate randomness is much better.

SNK3R March 11 2006 12:51 PM EST

Care to explain?

YOU March 11 2006 1:11 PM EST

/*
* File: Randomness.java

* Description: Generate Random Number and show that it is belonged to some
* x-cycle of a Dynamical System.
* Created on March 11, 20062, 12: PM
*/

/* * *
* @author Haterz
* @version 1.0.1 */

import java.awt.*;
import javax.swing.*;
public class Randomness {
public double getx(String input){
double x= Double.parseDouble(input);
return x;
}
public double calcm(double x){
double m = Math.pow(2.0,x);
return m;
}
public double cycle(double x){
double c =Math.pow(2.0,x-2.0);
return c;
}
public double geta(String input1){
double a=Double.parseDouble(input1);
while ((a%8) !=3) a+=1;
return a;
}

public static void main (String args[]) {
Randomness r = new Randomness();
double a=r.geta(JOptionPane.showInputDialog("enter a:"));
double x=r.getx(JOptionPane.showInputDialog("enter x:"));

while(x<3) x=r.getx(JOptionPane.showInputDialog("enter x:"));
System.out.println("initial value of x is :" +Math.round(x));
double m=r.calcm(x);
double c= r.cycle(x);
System.out.println(" a=:" +a);
System.out.println(" m=:" +m);
System.out.println("This is an "+Math.round(c)+" cycles Dynamical System");
for( int i=0;i<c+1;i++) {
x= (a*x)%m;
//System.out.println("m is :"+ Math.round(m));
System.out.println("x is :" +Math.round(x));
}
}
}

//Hope this Idea helps you. Dont bother compile it. I did it really //fast but i hope you get the idea.

AdminJonathan March 11 2006 2:35 PM EST

please tell me you're not re-inventing java.util.Random

YOU March 11 2006 2:37 PM EST

why not lol

[T]Vestax March 11 2006 2:38 PM EST

Well the lesson above was just a warm up. You see, an RPG requires a lot of data in comparison to other games. In you standard RPG you have enemies, maps, armor, weapons, PCs, NPCs, enemy groups, events, spells/skills, items, and so on and so forth. Standardly you would have an object that represents each one of these things. A monster would be an object that has a name, stats, an image, and victory rewards. Then usually the designers of the program would make an array of this object (and array of a class is the big payoff) and each item in the array would be a different monster. RPG = a lot of arrays usually. As I said, my demonstration wasn't about random numbers at all, and it seems you found that out, but still lost track of why I started explaining them.

For your first project I don't think you want to go so far as to make an RPG like the one I explained above. I see your game as harking back to the days of text games. By eliminating graphics we have striped away a ton of weight from the game. Anyhow, I did notice a pattern in the game play that I hope you noticed to. The pattern was text, choice, text, choice, text, choice. Whenever you see a recurring pattern you should think loop.

My idea is to reduce the entire game to this one loop. The first thing this requires is an array. This array will be an array of an event object. The event object will contain an array of Strings for the text. It would also contain an array of another simple object. This object is nothing more then a pairing of a command with a new event (indicated by an integer value). When the command is entered you would check this list to see if the command matches the String in the object. If so then it changes the event to the matching integer. Changing the event is nothing more then assigning an int variable a new value. Now, that's not all we need. We will also need a way for the event to set variables such as the name of the hero. Yet, pretty much, that's 50% of the game mechanics so far.

I'm thinking that fights with monsters might have to be a different class of event. Something more complex. But the opening sequence, the tutorial, and the movement on the 'map' can all be reduced to this pattern of text and a choice.

Now for my chance to influence the game I suppose:

I think it would be great to be able to strip away the concept of menu choices. Instead of saying, "these are your options, pick one" I think the player should be able to try a wide array of actions at any point in the game. So instead of typing in "1" to fight and "2" to run, I could either "punch", "shoot", or "boot to the head" my opponents. Your overall strength determines the damage you do but you could get a bonus to your damage when doing the right move on the right opponent, or at the right time. That's just a thought.

YOU March 11 2006 2:49 PM EST

Anyway, on the serious note. Instead of System.println everything, I think you need to organize your project and potential update / idea. Here is some of my pointers:
1. Direction: Using Single Linked List Array.
pre: direction = n, s, e, or w. int[4]
post: direction added to direction array
Make sure you count[return] the number of move. This is important if you use turn based in your game.
2. World Class: Think of a small or huge chess board (call it "world A" for now) with rows and columns set [a,b]. The point of doing this is it can keep track of your every single move in the "world A". it can also randomly generate static building/obstacle/wall...into any particular [a,b]. You do want your character to move around in a world, instead of a dessert don't you?. Great thing is you can keep track of his previous move. You can also set entrance into world and exit out of world simply by setting certain row/column.
3. Move Class: move to row and column using direction. Return getLocation and get Location
4. Location class: create your world here with x columns, y rows. can use to call out many times for different level and different worlds with different settings.
Those are basics of your Minigame.java
I shall add more about Lvl1battle.java when i get back from shopping :D

SNK3R March 11 2006 2:56 PM EST

I appreciate your suggestions, but what you're suggesting is definitely going to require a much more complex system that I'm not sure I can handle right now. The only kind of thing I was going to try was to "randomize" the enemy the hero comes across as well as what kind of "attack" he does. This can be done quite easily, I think, to trick the user into thinking that there's a ton of pizzazz in the program rather than always moving north to encounter a gnome, for example. I was also planning to randomize when or not the character would jump into battle, which shouldn't be too bad since I can just check if randomization of x%, and if the number is true, then enable battle. Also, I was thinking about making a chess-board-like environment in which Haterz was talking about, but that just seems like a headache for a newbie's first program.

SNK3R March 11 2006 2:59 PM EST

By the way, Haterz, your example didn't help whatsoever. I have no idea what quite a few of those functions do so I'm quite lost when trying to read it.

[T]Vestax March 11 2006 3:10 PM EST

More complex indeed. Yet, the overall project would take less time. That includes the time spent learning how to do all of this. The biggest problem with students is that they want to just buckle down and start coding right away. They are too focused on immediate results. Still, that's the trait of an interested learner, so I should respect that. I'm still here for you and feel free to have me review code and give advise. If you want a special "Vestax Tutorial" on something then I might be willing to offer one up.

YOU March 11 2006 4:13 PM EST

i just finnished writing those 4 class less lines than what you have. LOL

SNK3R March 11 2006 4:23 PM EST

I totally didn't understand what you just said...

PoisoN March 13 2006 9:35 AM EST

Great stuff Haterz :-) let the user enter some numbers, do some operations to make it looks like an expert program ^_^. Imagine Diablo 2 would let the user enter 2 numbers for every random item dropping.

Don't panic Snikkar, you get most experience by trial & error :)

AdminJonathan March 13 2006 9:49 AM EST

"The biggest problem with students is that they want to just buckle down and start coding right away."

Ouch.

CB probably wouldn't exist if I'd tried to plan the whole thing out instead of just buckling down and coding. That is what makes programming so much fun: you can build something that works, and add to it gradually, instead of trying to get things 100% right the first time. (Which never happens anyway.)

Of course at that point I had a lot more experience than SNK... experience that came, for the most part, from buckling down and coding.

Thinking ahead is good. But it's so easy to get bogged down in "analysis paralysis." If you're going to err on one side of this balance, I think Just Doing It is by far the lesser of evils.

The other thing is that "the right point" of balance here is dependant to a huge degree on your existing skills. For someone just starting out, the point of diminishing returns from analysis come a lot sooner. For you, Vestax, it might have made sense to do more thinking and less coding at first. But SNK made the right choice for him.

[T]Vestax March 13 2006 1:29 PM EST

Well, I think you do have me mistaken, just a bit. As I am probably a bit mistaken myself. I'm not in favor of planning a project to 100%. In fact I, like you, am opposed to planning 100% of any project. My view is that planning should be proportional to the work that needs to be done. If you have a week to do a project that might actually take you the whole week, then use the first day to plan.

When planning feel free to write up a sample algorithm or a data container or just the overall structure of the program. For object oriented programs you'll want to pick out all/most of the classes you'll need and most of their members. I personally feel that these are things that don't need to be done in front of a computer. You would be surprised to find that writing code by hand is much more bug free. I often suggest going to a library or a group study room rather then your local area network when working with a group for the first day. If your by yourself then may I suggest you turn the computer off or at least the screen. That will help with the compulsion to type the whole thing up.

However, this should be for just that one day. After that you should buckle down and code. I have no problem with getting down to business. I just think that it could wait just a bit. The bigger the project the longer the wait. I personally do not plan 100% or even 90%. For me its more like 50%-40%, with about 25%-15% of that plan surviving till the end of the project.

As for some of the things I said, including the part you picked out, I was only quoting myself from when I was a student, which wasn't very long ago. I found myself excelling past my peers and taking infinitely less time then them in completing a project because I picked up a pen and some paper once in a while. I'd draw up diagrams, models, sample code, tables, and just plain old junk. Nothing that remotely resembled an entire program, but it helped. Yet, I suppose my projects by that time needed some planning just for completion of the assignment.

Then again I should note that not every program should be done the way I say it does. Not in the slightest. Prototyping is an awesome way to get something up and running right away. In a way you could say that CB1 was the prototype for CB2. It doesn't really matter if a prototype works well or not, or if it contains bugs. Its purpose is served when it helps iron out some of the details of the actual program. Different programs are better with different approaches. Plus, different people work differently. I suppose that work and class assignments should also be approached differently then personal side projects. Side projects need more tangible results sooner in order to build up the motivation to complete the program. You shouldn't need motivation for work and school projects. Also since assignments are held up to standards, it isn't all that helpful to have something as soon as possible when its still just an F.

Now I suppose I should apologize. It may indeed be the case that I confuse code from a novice with code that had no thought. With my experience I would make a program of a much different quality then SNK, even if I started to just randomly draw up some code. This is how things are now with me. I couldn't possibly say the same of myself 8 or 9 years ago, which was still a year or two after I first started to program. It was wrong of me, even on an unconscious level, to hold people up to standards that do not apply. Sorry.

All-in-all your approach to the program isn't all that different then when I tried to make my first RPG. In fact, the more I think about it, your program is the spitting image of what I was trying to create way back when. What I did create was highly unbalanced, yet mildly amusing. I couldn't expand it further then a few levels for a couple of reasons. First, the program was getting too complex and needed more and more upkeep with every change. Second, I had exceeded the maximum size of the program file because all my data was hard coded in it. :P (Program size was restricted to what the editor could handle.)

So good luck to you SNK and I hope to have some sample code for you soon that you might be able to cannibalize. :)

[T]Vestax March 13 2006 2:20 PM EST

Underview: Jon is right, I agree, I'm sorry, I did the same thing once.

Maelstrom March 15 2006 9:31 PM EST

"Seriously, two hours spent learning Eclipse will pay you back _at least_ those two hours _every day_ of your Java programming career. It's one of the best investments of time you can make."
--Jonathan, March 9 2006 5:50 PM EST

Wow. Such high praise of Eclipse from a fellow Emacs fan. I think I'll have to give Eclipse a chance for once.

You know, of the 43 replies to this thread, only 3 seem to try to answer your actual question. I just got back in town... did you still need help with something, or was the question answered?

sssimmo March 15 2006 10:15 PM EST

Jon - "If you're going to err on one side of this balance, I think Just Doing It is by far the lesser of evils."

Let's face it, coding is just plain evil. Dare I say "the devil's work??"

SNK3R March 15 2006 11:40 PM EST

The question was answered, Mael. Thank you for checking, though.

By the way, I appreciate your reply Jon. I was beginning to think, before your reply, that maybe I should have spent more time with the planning. However, things have been going pretty well, in my opinion, but I think each programmer has their own way of approaching a project.

Don't be too hard on yourself, Vestax. I really do appreciate different approaches to coding and learning new stuff, but just keep in mind I'm barely starting out if you do plan to help. ;)
This thread is closed to new posts. However, you are welcome to reference it from a new thread; link this with the html <a href="/bboard/q-and-a-fetch-msg.tcl?msg_id=001jfN">SNK3R's Java Program - Help?</a>