Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


litta_gator

Member Since 16 Apr 2013
Offline Last Active Apr 25 2013 02:59 PM

Posts I've Made

In Topic: Code Formatting - Method Organization

25 April 2013 - 12:02 PM

Typicly I don't mark regions of functionality with comments or the C# #region keyword. (because I think unnecessary comments are evil...)

 

After the responses about using comments on my other post, I went back and looked at all of the comments that I had placed within my code. For the majority of them, all it took was re-reading them to realize that they were completely unnecessary laugh.png


In Topic: Code Review - Dice Game (No graphics)

18 April 2013 - 01:25 PM

I know that using global variables is usually frowned upon, but is it okay to use them if I believe that I can do so efficiently?


In Topic: Code Review - Dice Game (No graphics)

18 April 2013 - 11:57 AM

Agreed, sometimes I make a method just for the condition of an if statement, especially when it is more complex or used multiple times.

 

I'm starting to realize this. I'm big about "clearing" the screen whenever changing player turns. I realized that it was a lot simpler to write a small method named clearScreen(), rather than type out:

 

for(int i=0;i<10;i++)
{
  System.out.println();
}

 

every single time that I wanted to clear the screen.


In Topic: Code Review - Dice Game (No graphics)

17 April 2013 - 07:27 PM

I can recommend the articles, videos and book of Robert C. Martin about "Clean Code". It is a relative old book, but still very usefull to read.

 

Thank you so much for this. I know that this code isn't very elaborate, nor is the game. But, I really appreciate the objectiveness you have shown me. I know that sometimes, newbies (like me) are easy to tear apart, since their code is messy and wrong. You guys have really helped me to feel welcome to GameDevs. Thank you for all of your advice.


In Topic: Code Review - Dice Game (No graphics)

17 April 2013 - 07:19 AM

Thanks, both of you, for the advice on using classes. I'm currently reading through a book titled "Java Programming: From the Ground Up", and have just gotten to the basics of OOP. In fact, I think the chapter I'm about to start is about making classes and implementing them correctly.

 

 

Btw. for method lengths a good rule of thumb is methods between 3 and 7 lines, especially when the logic is complex, you want less lines.

I'm always afraid that I'm going to have too many methods in my program, so would I clear this up by making custom classes, and then just creating an object that can reference them?

 

 

Code Complete seems to be a seminal book that might interest you, although I haven't read it myself so I can't vouch for it.

Thanks for this! I'll look it up on Amazon and give it a whirl.


PARTNERS