>>5
I was >>2
Please don't lump me in with >>4. Even if you want to call me an idiot, I really hate those ironic style posts or whatever they're called.
>>6
I am not calling you an idiot. I just find it hard to believe that some guy from the imageboards just found this wasteland, made his very first post with noko, and requested comments on some shitty Java code. I can be wrong, of course, but it looks too much like the average not so well-crafted shitpost.
Name:
Anonymous2013-01-12 2:56
>>4
LLLLLLLLLLLLEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLL
E/PROG/IN MEME LE /PROG/RO
XDDDDDDDDDDDDDDDDDDDddddd
Name:
Anonymous2013-01-12 9:00
>>5
``Falling for this''? When will you niggerkikes realize /g/ are a bunch of actual retards? When will you realize not every single fucking retarded post on the Internet is a troll?
Name:
Anonymous2013-01-12 12:33
Sigh... Alright, let's go through this.
First, if this isn't actually a troll post, then I must commend your effort in explaining the rationale behind your design decisions, it gives us me more information to help you improve. If you are trolling, then for fuck's sake, what are you doing with your life.
On to the matter...
public class ComCalc extends validMethods {
You are misusing inheritance. Inheritance should be used to define a hierarchy of types, like a taxonomy, where every characteristic of the super class is present in the extending class.
Here, you are merely using it for reuse, as I very much doubt that validMethods is actually meant to be a definition of one of these billing app things.
Instead, you could have just put it in a separate class, from which to call its methods. But in this instance, you didn't even need to do it. The validations wouldn't be used in another class, they were specific ComCalc only.
For more complex and varied operations, look up ``first class functions'' and the ``strategy pattern''.
On a side note, classes in Java are customarily written with a leading UpperCaseLetter, and variables with a lowerCase.
int usrCount = 0;
It's not necessarily ``bad'' that you did this, but it's quite a bit weird that you were counting the number of people who went through your application and input their sales... and welcomed them back... when you never stored who came for the first time and who returned!
public void start()
There are many ways to structure and interpret design a graphical application with user accounts, and I reckon that you chose to do it like this because it was the simplest way to accomplish it, i.e. with a series of dialog boxes. In the future, you should look up the ``MVC pattern'' and layered architectures, which are quite intuitive. Though their implementation may not be when you start up (it's sometimes fault of the tools, though).
}else{
JOptionPane.showMessageDialog(null, "Sorry, the name you entered contained an invalid character");
start();
}
On the flip side, I don't know if you realize it, but you understand recursion! Which is commendable, and makes me suspect this is a troll post.
On the other hand, if you don't know it yet, this program only has a limited number of runs. You see, for each successive call of start();, a new stack frame is created, that is to say, there's a structure which the computer uses to keep track of the functions which you are calling, so that when one finishes the caller can keep on going, and it's called a stack, because they pile up. This stack has a limited space, and it will run out since the start() function never returns and is called over and over.
This doesn't have to be so with a computer, though, look up ``tail call optimization''. Under other circumstances, your program would run just fine.
Either way, it would have been clearer to express your application with a single loop here, than with recursion to start from two separate functions.
Lots of other stuff.
The functions are sometimes gratuitous, but they are well constructed; they do only one thing and they don't affect the rest of the program other than for the values they return. This is a sign of very good design which means that IHBT.
Also, try to keep you coding style consistent, you mixed brace styles here and there.
Any faults in this code are because of poor Java style on your part, other than that, it's a well written program. Try to keep you comments few and informative, though.
Name:
Anonymous2013-01-12 13:05
OP here. >>2
Fuck you, faggot. >>7
Cool story bro >>10
tl;dr but thx.
>>11
What a little piece of shit, I can't believe it. That's why you should never help kid in the first place. Just beat the crap out of them on sight.
Name:
Anonymous2013-01-13 11:55
Sorry everyone,
I am the OP and I have a wife and kids who do not appreciate me. I am deeply sorry if I hurt anyone by that statement. I will keep your advice in mind before writing me next program. Thank you.