Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
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  
  Another Stupid, Stupid Mistake...  (Read 2579 times)
0 Members and 1 Guest are viewing this topic.
Offline xsvenson
« Reply #30 - Posted 2013-11-29 09:24:10 »

Comments can be useful. About half a year ago I changed projects, I was the maintainer of the codebase and the one that was responsible for the code's health. After the change, others took over.
A few months later a colleague came to me and was all like "Nice going with the comments ! You made everything so clear!". My response was between the lines of "What's with the sarcasm, if You have a problem, ask"

Turns out, he was being sincere. My comments helped and brought some clarity, for me those comments were well worth it.

“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Offline gimbal

JGO Knight


Medals: 25



« Reply #31 - Posted 2013-11-29 10:04:37 »

Flip that around: USEFUL comments are a good thing, not comments in general. Self-documenting code should still be the priority though.
Offline theagentd

« JGO Bitwise Duke »


Medals: 361
Projects: 2
Exp: 8 years



« Reply #32 - Posted 2013-11-29 20:39:22 »

Flip that around: USEFUL comments are a good thing, not comments in general. Self-documenting code should still be the priority though.
I recently read somewhere that the hardest part of being a programmer is naming things. I called bullshit until I realized I spent 15 minutes trying to come up with a better name for "downsampledDominantMotionVectorBuffer". I ended up with "downsampledDMVBuffer" and a comment explaining what "DMV" stood for. +1 point to anyone who can figure out what I'm working on.

Myomyomyo.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline StumpyStrust
« Reply #33 - Posted 2013-11-29 22:47:29 »

Either motion blur or something to do with OpenCL and Motion Estimation Extensions. Really I just did a little googling. 

Offline opiop65

JGO Kernel


Medals: 159
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #34 - Posted 2013-11-29 23:21:15 »

Naming things is the worst, I used to end up with 25 letter variable names, and they were a pain in the ass until I realized my IDE had a variable name auto completion feature.

Offline HeroesGraveDev

JGO Kernel


Medals: 292
Projects: 11
Exp: 3 years


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


« Reply #35 - Posted 2013-11-29 23:30:11 »

When my variables names get longer than 10 characters I have a look at them and try to find an abbreviation.

Offline wessles

JGO Wizard


Medals: 74
Projects: 4
Exp: 4 years


Radirius Software


« Reply #36 - Posted 2013-11-29 23:38:08 »

Oh man... I once saw some person's code on github while searching about audio files. Something like this was here:
1  
AudioFileFormatCheckerByJavaDefaultSoundLoading affcbjdsl;

^^ (~47 Characters) ^^
And no, it did not work.

Offline theagentd

« JGO Bitwise Duke »


Medals: 361
Projects: 2
Exp: 8 years



« Reply #37 - Posted 2013-11-30 00:11:56 »

Oh man... I once saw some person's code on github while searching about audio files. Something like this was here:
1  
AudioFileFormatCheckerByJavaDefaultSoundLoading affcbjdsl;

^^ (~47 Characters) ^^
And no, it did not work.
Horrible class name, but even more horrible variable name...

Myomyomyo.
Offline HeroesGraveDev

JGO Kernel


Medals: 292
Projects: 11
Exp: 3 years


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


« Reply #38 - Posted 2013-11-30 00:14:23 »

Oh man... I once saw some person's code on github while searching about audio files. Something like this was here:
1  
AudioFileFormatCheckerByJavaDefaultSoundLoading affcbjdsl;

^^ (~47 Characters) ^^
And no, it did not work.
Horrible class name, but even more horrible variable name...

Are you saying he shuold have done the full
1  
AudioFileFormatCheckerByJavaDefaultSoundLoading audioFileFormatCheckerByJavaDefaultSoundLoading;
instead of the abbreviated version?

Offline theagentd

« JGO Bitwise Duke »


Medals: 361
Projects: 2
Exp: 8 years



« Reply #39 - Posted 2013-11-30 00:17:21 »

"ByJavaDefaultSoundLoading" is completely redundant. What the hell is an audio file format checker? Why isn't this integrated into the sound class or the sound loader? Besides, a checker shouldn't even require any persistent state, so just make it a static function. That name is so packed with wrongness it's almost underflowing.

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

JGO Kernel


Medals: 159
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #40 - Posted 2013-11-30 00:23:48 »

I don't know how some people can look at variable names like that and not just laugh at themselves and then instantly delete it. Nothing needs to be that descriptive, and it probably is the exact opposite of useful.

Offline xsvenson
« Reply #41 - Posted 2013-12-02 09:30:54 »

...
I recently read somewhere that the hardest part of being a programmer is naming things. I called bullshit until I realized I spent 15 minutes trying to come up with a better name for "downsampledDominantMotionVectorBuffer". I ended up with "downsampledDMVBuffer" and a comment explaining what "DMV" stood for. +1 point to anyone who can figure out what I'm working on.

"There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors."

“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Offline theagentd

« JGO Bitwise Duke »


Medals: 361
Projects: 2
Exp: 8 years



« Reply #42 - Posted 2013-12-02 10:12:42 »

"There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors."
And I was like "Haha, what a funny coincidence; he said 'two hard things' but he was off by one"...

Myomyomyo.
Offline matheus23

JGO Kernel


Medals: 113
Projects: 3


You think about my Avatar right now!


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

... eventually becomes more about ... staying focused than actually coding. I envy those people!
Not sure if I qualify as that experienced to be honest, but this is actually a really big problem. The better you get at programming, the more trivial problems get. The more trivial they get, the more boring they get until pretty much all coding is trivial. That can be a real problem if you enjoy the actual coding process more than getting a "result" (a game, an engine, a demo, a tool, a benchmark result, whatever).

That's definitely the case for me. I've been demotivated for a long time until a couple of days ago. I started writing of some kind of first classes for games (in scala), but it became boring or similar pretty early. It felt like writing down stuff you've already did too often. At first I thought it was because I was too used to developing games, but all other attempts failed as well...

Now a couple of days ago I revisited haskell (you might know I'm interested in that Tongue ), and haskell was a real challenge to me. I took a look at Frag (a from-scratch haskell implementation of Quake III, written using something called Functional reactive programming), which gave me new motivation.

Finally I've got a little, white rectangle drawn, which follows the mouse and becomes big, while holding 'shift' Cheesy

// -- Non-Java / Haskell section -- //
I had made some funny stupid mistake while in that process, too. It's not that something didn't work, it's just that I did something sooooooo much more complicated, it's cracy Cheesy

So what I was trying to do is writing a Signal Function in Yampa, that took as input whether the user pressed the 'Close' button on the window and should output a boolean determining, whether the 'reactimate' process should stop (i.e. the process should be stopped).

What I did was this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
{-# LANGUAGE Arrows -#}
data Input = Input { window :: WindowInput }
data WindowInput = WindowInput { closed :: Bool }

mainSF :: SF Input Bool
mainSF = switch whenCloseSF (const $ constant True)

whenCloseSF :: SF Input ((), Event ())
whenCloseSF = proc input -> do
  pressedClose <- edge -< ((closed . window) input)
  returnA -< ((), pressedClose `tag` ())


The simple version was this one:
1  
2  
mainSF :: SF Input Bool
mainSF = arr (closed . window)


Well... I learned a lot while doing the other version Cheesy

Btw, both being demotivated and having switched to scala and then to haskell is the reason for me not to contribute too much to this forum anymore :/ Still love the people here, though! Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
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.

trollwarrior1 (29 views)
2014-11-22 12:13:56

xFryIx (71 views)
2014-11-13 12:34:49

digdugdiggy (50 views)
2014-11-12 21:11:50

digdugdiggy (44 views)
2014-11-12 21:10:15

digdugdiggy (38 views)
2014-11-12 21:09:33

kovacsa (62 views)
2014-11-07 19:57:14

TehJavaDev (67 views)
2014-11-03 22:04:50

BurntPizza (64 views)
2014-11-03 18:54:52

moogie (80 views)
2014-11-03 06:22:04

CopyableCougar4 (80 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!