What's with unorganized code?

I’ll say my main reason for this code being less than “godly” is that it’s function is as hard to determine as it is. Readability goes beyond code style.

How would I improve the readability any more than this?

As for the formulas, should I put each parameter for the drawing method on a separate line with comments
for what each object in the formula does?

That’s what [javadoc] comments are for.
Comments in general are a good idea, but starting with self-documenting variable names is also good.

It’s a function, not a formula, by the way.

 g.fillOval(tFill.n*(spacing)+offset, tFill.v*(spacing)+offset-(size*(spacing/2))+((size-tFill.n)*(spacing/2)), (spacing), (spacing));

Sure that may be a function, that’s not what I was referring to.

tFill.v*(spacing)+offset-(size*(spacing/2))+((size-tFill.n)*(spacing/2))

That is what I was referring to as a formula.

That’d be an expression.

Then what is a formula -___-

Well, two seconds on Google turned this up:

Your “formula” is a bunch of numbers that are unrelated, hence they are an expression, not a formula.

This is getting ridiculous.

Okay, so expressions then -.-

Also, from the java language standpoint, there is no such thing as a “formula”, however this is the definition of an expression: http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html

Whoa, seems someone got caught in some kind of bear trap… :point:

Java, Java, Java… structs are way overdo. Why do you allow people to write code like the OP when you can have us write it in 5 lines… maybe less?


struct Troint{
       public int n;
       public int p;
       public int v;
}

Come on Java, stop holding out on us. :clue:

Ah! Ah! All of you: stop! You’re making my eyes bleed.

Woah Woah what is that 0.o

Even code I write myself I use private and non specific access fields, why? I come back to the code weeks later and I can’t access that field, it was probably for a reason. Some things just should not be changed, even if you know you will forget.

Also I will just come right out and tell you to get the giant stick out your ass, your code is no different from what mine was the day I started coding.

Disorganised…

I fully agree. Some fields and methods are designed to be private for a specific class.

I listed several things wrong with your code above. I’d start by fixing those.

More generally, your whole attitude tells more about you as a programmer than your code does. I get that this was a light-hearted boasting of some code you’re proud of, and that’s cool, but good programmers know that there is always more to learn.

You could have started this thread with a “hey guys, I think this code is particularly well-done, can anybody give me pointers on how to improve it further?”, but instead you immediately started by calling your code “godly”. Some of the best Java game developers in the world frequent these forums. Do you really think your code is better than theirs? If not, what’s the point of the approach you took?

If I was looking to hire somebody for a coding position, and this thread was your resume, you wouldn’t get the job.

The code you posted and the way that you posted it say a lot about you: you’re probably still in high school. You probably have never worked on a real team (outside of perhaps homework assignments). You probably haven’t finished any non-trivial projects. You probably get decent grades, but you haven’t taken any advanced classes yet. You might have one big project that you daydream about finishing, but really you think and talk about it more than you code it. You seem a bit full of yourself and you don’t seem to respond to criticism well, which is something that you’ll have to get over if you want to be a real programmer.

(Not that there’s anything wrong with any of the above, but if you make a thread calling your code “godly”, you’re inviting criticism.)

How far off am I? :stuck_out_tongue:

Best way to get input on the internet is to claim you’re better then others, if he was asking advise, he would not even have gotten half the comments he has now :slight_smile:
But i totally agree on you.

Haha! Sounds like Cunningham’s Law: “The best way to get the right answer on the Internet is not to ask a question, it’s to post the wrong answer.”

I am past highschool. I don’t think I don’t respond to criticism well, but it’s funny to see that others think I seem like I’m still in highschool though :stuck_out_tongue:

Just wanted a response.