Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

View RSS Feed

JD1's Personal Development Blog

I've Learned About A Few General Java/Programming Conventions

Rate this Entry
First of all, thanks to the following members for helping me out thus far. I very much appreciate your time and effort and I've decided to take everything on board.




First of all, KevinWorkman told me of the importance of implementing braces on all statements (If Statements, Switch Statements, etc) regardless of whether there's only one line's code after the condition. If you don't implement braces around these statements and you decide later that you want to add another line of code into a statement, there's a chance you're going to forget to insert your braces. Basically, we do this just to prevent bugs from appearing at compile time.

Kevin also addressed a question I had about Switch Statements. Instead of using an If/If Else Statement, we use a Switch Statement when we know exactly what one of the operands are ahead of compiling.

JavaPF then mentioned he would allow me blogging permissions so I could make this an official blog. Hopefully, I'll be moving this blog to an official blog in the near future.

Norm and Mr.777 then backed up Kevin to cement the importance of using braces always.

Norm then made two very useful observations about my programming style. First, he made aware to me the fact that classes should start with a capital letter. Instead of using class1, I should have been using Class1. I'll make sure I use proper capitalisation in the future. Norm, I presume that if the name of the class has two words, so to speak, that the first word isn't capitalised and the second is? By this I mean, startRendering. If we were to use that as a class name (for whatever reason), it would be as is instead of StartRendering? Maybe I'm getting this confused with the naming conventions for variables. I'd appreciate if you could clear that up.

Norm then pointed out that I clustered my code together too much. An example being, if(this==that). I should be spacing it out some more and implementing more white space: if(this == that). I had been under the impression that it wasn't really a big deal whether you made use of spacing or not, but I guess it only makes sense to space it out. If not for yourself, for others.

That's all for now. I'll be covering some more in-depth information on the use of multiple methods in my next post.

Thanks everyone,
JD1
Categories
Uncategorized

Comments