Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Bad Habits  (Read 1755 times)
0 Members and 1 Guest are viewing this topic.
Offline bilznatch

Senior Member


Medals: 8
Projects: 2
Exp: 1 year


I'm bad, I'm bad, I'm really... really bad T_T


« Posted 2013-12-02 07:42:46 »

I'm guilty of coding in a single class 90% of the time (I have other classes in my classes, not separated). My code isn't organized like anyone around here would normally organize, my packages are simply "game" and my classes are just the name of said game. (It's fine though, I'm bad, and I don't share my code with others, so I'm not leading anyone else to OOP hell.)

What poor coding habits are you guys guilty of?
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #1 - Posted 2013-12-02 07:49:16 »

I don't comment. Period.
Offline UprightPath
« Reply #2 - Posted 2013-12-02 08:09:47 »

Somewhat excessive attempts at code organization, even for private code. I spend more time working on that than anything else.

Always encapsulating data. Even when it leads to a lot of boiler plate style code. I only just broke the habit in a project I'm working on right now. I'm actually using public fields.

Prematurely optimizing code.

Commenting after I code.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 239
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #3 - Posted 2013-12-02 09:00:48 »

Bad habits are only really bad habits if they hinder you or the program.

Laziness is fine and even positive as you get things done more efficiently, so I wouldn't say lack of commenting is bad unless you work in a team.

My #1 bad habit is scope creep.

Offline ctomni231

JGO Wizard


Medals: 98
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #4 - Posted 2013-12-02 09:03:00 »

Reading up on threads instead of actually programming. *runs*

Offline bilznatch

Senior Member


Medals: 8
Projects: 2
Exp: 1 year


I'm bad, I'm bad, I'm really... really bad T_T


« Reply #5 - Posted 2013-12-02 09:10:44 »

I don't comment. Period.

If I have comments then it's just code that I don't want running. All dem //system.out.println() comments...
Offline trollwarrior1
« Reply #6 - Posted 2013-12-02 09:17:32 »

^+1 Cheesy:D
Offline delt0r

JGO Knight


Medals: 26
Exp: 18 years


Computers can do that?


« Reply #7 - Posted 2013-12-02 10:06:25 »

Spending weeks planing the perfect code layout without writing a single line of code....

I have no special talents. I am only passionately curious.--Albert Einstein
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #8 - Posted 2013-12-02 13:07:13 »

My worst habit is probably writing "test" code in a lot of my classes, cluttering them up and then never removing or refactoring the test code because it worked so well! My classes get very messy Sad

Offline ClickerMonkey

JGO Coder


Medals: 20


Game Engineer


« Reply #9 - Posted 2013-12-02 14:22:43 »

After you write some code that does something special/important, always think if it will be instantly understandable if you look at it in 6 months... if it's complicated then I say comment it.

I use good variable names so you don't need to comment, but often I find some variables aren't name-able and when your variable names are too long It's hard to read (I like some equations on a single line okay? The readability of the equation is sometimes more important than the variable names - since the variable names don't always represent real-world things. I hope that makes sense.)

When I use short variable names in complex algorithms and equations, I always comment my code.

Of course, this goes out the window if you REALLY think you'll code the entire project in a few months.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #10 - Posted 2013-12-02 14:54:56 »

Every single line of code I type, I press crtl-a and ctrl-shift-f along with crtl-s to format and save it. They're the only hot-keys I use and I rarely copy and paste code. Also, when I don't like the design of something, I sometimes spend hours re-factoring it if there's a lot of code. With practice though I seem to be getting faster at refactoring, which I guess is a handy skill to learn.

Why are all OpenGL tutorials written in Brainf**k?
Offline Roquen
« Reply #11 - Posted 2013-12-02 15:20:40 »

I like to be able to diagonally read code so short variable names rule.

My sin:  reading too much research on things that I don't need on that day.
Offline Troncoso

JGO Coder


Medals: 20



« Reply #12 - Posted 2013-12-02 15:24:43 »

My code always looks great. Formatting, naming conventions, commenting, etc. all comes very natural and I do it as I code. Though, I have a habit of spending too much time on the framework of new projects. I spend so much time trying to make development time quicker, that it kind of loses its point.
Offline bilznatch

Senior Member


Medals: 8
Projects: 2
Exp: 1 year


I'm bad, I'm bad, I'm really... really bad T_T


« Reply #13 - Posted 2013-12-02 18:40:18 »

I like to be able to diagonally read code so short variable names rule.

My sin:  reading too much research on things that I don't need on that day.

I do this one as well. I've read all sorts of the LWJGL topics around here, and other places, and I refuse to touch it, or any direct openGL binding. It scares me too much.
Offline Phibedy

Senior Member


Medals: 8



« Reply #14 - Posted 2013-12-02 19:05:38 »

I encapsulate nearly everything and afterwards I implement that encapsulated "object" in a static way  Roll Eyes
If I only need one object   Clueless
1  
2  
3  
4  
public Class Dummy{ 
public static Dummy dummy;
[...]
}

While thinking about it, it might isn't that bad,
because it's easy to modify it. But maybe I just need it because even if I try to plan everything it will become different  Grin
Commenting is just for people who are afraid of thinking about their code again and again and again   Cool
Offline Simn
« Reply #15 - Posted 2013-12-02 19:43:49 »

I comment too much...   Tongue

- Simn
Offline actual

JGO Coder


Medals: 23



« Reply #16 - Posted 2013-12-02 19:59:45 »

I don't document my code at a high enough level. I document the nuts and bolts of classes and methods well enough, but I find myself coming back to code later thinking....why did I do it this way? Why is this an interface? What was I planning on using this class for?

I find myself much more productive when I document my intentions. Something like: "My Action class is part of a GOAP framework. The idea is that all other Actions will inherit from this class and then only need to implement the update, onSuccess, and onFailure methods. These actions should really only be used when a GameEntity needs to do something that takes more than one time step."

This kind of document doesn't really fit into javadoc and needs its own file.
Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #17 - Posted 2013-12-02 21:58:07 »

I have horrible posture... Feels good now, but later it will be a (literal) pain in the back.

But in all seriousness, it is good to have better posture. It will help your back over time, and it's healthier! However, do not sit at 90* degrees!

Also, I have NEVER looked deeper into other programming languages!

Offline niroshido

Junior Member


Medals: 4
Exp: 4 years



« Reply #18 - Posted 2013-12-02 22:22:01 »

My bad habits are, starting a project writing a few basic classes usually as far as getters and setters, then get bogged down with trying to figure out how to tackle the game loop and then that it.

Its a terrible habit.

Oh actually i have another habit actually, i decide today will be the day i program, black out what the? how have i managed to login to a game and start playing well never mind i might as well continue playing until i am bored and thats really the story of my life, my life slowely evaporating due to a gaming addiction.
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #19 - Posted 2013-12-03 02:24:17 »

I personally never game anymore, except for the occasional match of Battlefield bad company 2, BF3 and soon BF4! Something about the BF series really just does it for me like no other game can! But still, I game maybe 2 hours a week at max, its just not fun anymore when I know I have code to work on!

Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #20 - Posted 2013-12-03 02:58:23 »

I game, but I am cursed with thinking about all the game rules, why they were made, possible different issues they had while making it, how long it took, who came up with the idea, what their budget was... etc. etc. etc.

But boy do I love MAKING games  Grin!

Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #21 - Posted 2013-12-03 03:01:02 »

I always love trying to figure out how the devs did this or that, and then I realize I'm being shot at and well... now I'm dead! But its still fun to think about the development process Smiley

I agree, making games is by far the coolest thing I've done in my life! ... Is that sad? Smiley

Offline Slyth2727
« Reply #22 - Posted 2013-12-03 03:07:49 »

I have a terrible habit of being lazy and just making variables public instead of private w/ getters and setters..

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #23 - Posted 2013-12-03 03:09:26 »

I have a terrible habit of being lazy and just making variables public instead of private w/ getters and setters..
If you're using Eclipse, right click on your workspace, go down to source and hit generate getters and setters, and then select your variables you want to make them for! You can also let Eclipse automatically generate constructors for you, and I'm sure a plethora of other things for you!

Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #24 - Posted 2013-12-03 03:16:15 »

I have my own code cleanup format that, quote:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
Remove 'this' qualifier for non static field accesses
Remove 'this' qualifier for non static method accesses
Remove unnecessary blocks
Convert 'for' loops to enhanced 'for' loops
Remove unnecessary parentheses
Remove unused imports
Add missing '@Override' annotations
Add missing '@Override' annotations to implementations of interface methods
Remove unnecessary casts
Remove unnecessary '$NON-NLS$' tags
Add unimplemented methods
Organize imports
Format source code
Remove trailing white spaces on all lines
Correct indentation


That way, all that 'organization' crap comes last, and it is SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO easy!

I love eclipse  Smiley

Offline kingroka123

JGO Knight


Medals: 27
Projects: 5
Exp: 1 year


Gamer's Helmet


« Reply #25 - Posted 2013-12-03 03:29:22 »

I don't comment as much as I should and I sometimes I forget to hit Ctrl+Shift+F persecutioncomplex

Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #26 - Posted 2013-12-03 04:12:42 »

I always save and then format every time I finish a function or a new line! It just is a good habit I got into I guess Wink

Offline kpars

JGO Wizard


Medals: 75
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #27 - Posted 2013-12-03 16:54:02 »

I CTRL+SHIFT+S and CTRL+SHIFT+F just like opiop, constantly. No matter what I'm doing. It's subconscious.

I also have a bad habit of using ridiculously short variable names.

So instead of having something like
isJumping
or
jumping
, I end up using something like
j

It seems fine at first, but it comes to bite you in the ass later in development.


- Jev.

Check out #JGO on EsperNet IRC! | Check out the MERCury 2D Java Game Library! | Also, Check out My Site
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #28 - Posted 2013-12-04 00:09:06 »

I actually struggle sometimes to not name my variables something very long! But then I remember I'll have to type it out every time I want to use it, and because I'm lazy and my keyboard keys are kind of small, I use medium size variable names Smiley

Of course, space + c (or something like that, I csnt remember!) brings up a list of variables/functions whilst typing!

Offline wessles

JGO Wizard


Medals: 66
Projects: 4
Exp: 3 years


Radirius Software Developer


« Reply #29 - Posted 2013-12-04 01:14:07 »

I love ctrl-space.
If I did not my productivity would slowly dwindle myproductivitywhich would be less than convenient for me...

EDIT: Subscripting is hard!

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (23 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!