Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 246 247 [248] 249 250 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 833030 times)

Killjoy

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3705 on: January 22, 2013, 07:50:15 am »

You get a lot of slowdown from the Vectors being new'd and collected, as the Project Zomboid developers learned the hard way...

Haha, that was a fun read, he actually assumes there is such a thing as Java fans. I'll admit, other than on the internet, nobody I know actually likes Java. I don't either.

The language itself is boring. It has almost no features that makes it interesting to work with. C# is way more interesting to work it in almost every aspect. But Javas simplicity also makes it particularly easy to learn. You can learn almost everything about Java syntax and basic patterns in about a week. If you want too.
« Last Edit: January 22, 2013, 07:52:50 am by Killjoy »
Logged
Merchants Quest me programming a trading game with roguelike elements.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3706 on: January 22, 2013, 08:00:52 am »

I... I have a friend who likes Java.

 :-[
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Killjoy

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3707 on: January 22, 2013, 08:14:30 am »

I... I have a friend who likes Java.

Be nice to him, he might feel a bit lonely in this world. :)

I should say something nice about java too. With working with Merchant's Quest, I would say I came to appreciate its simplicity. My code is about 15k~ lines now, and the code is not confusing to work with, which is cool.
Logged
Merchants Quest me programming a trading game with roguelike elements.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3708 on: January 22, 2013, 10:08:50 am »

I... I have a friend who likes Java.

Be nice to him, he might feel a bit lonely in this world. :)
I'm not. He's a better programmer than me, but I still bash his language of choice every chance I get.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3709 on: January 23, 2013, 10:04:49 am »

The only problem with that blog post is that it calls C# the best language ever or something similar. It's not. It's a "good enough" language that's taken the place of "good enough" from Java in some areas.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #3710 on: January 23, 2013, 10:15:54 am »

The only problem with that blog post is that it calls C# the best language ever or something similar. It's not. It's a "good enough" language that's taken the place of "good enough" from Java in some areas.

He only does that one time that i remember, and i got the impression he's making an exaggeration for humour there...
« Last Edit: January 23, 2013, 10:19:47 am by MorleyDev »
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3711 on: January 23, 2013, 10:19:54 am »

I would just like to say - C++ has some fucked up syntax decisions. Sometimes I could swear it's just trying to intentionally confuse people. And C++ programmers don't help, with their insistence on non-descriptive 1-3 character variable names.

That is all.

* GlyphGryph is back to learning C++ properly so he can properly contribute to Cataclysm. It is going well... mostly.
« Last Edit: January 23, 2013, 10:21:29 am by GlyphGryph »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3712 on: January 23, 2013, 10:25:52 am »

What? D: Three letter variable names?

Code: [Select]
public:
    PlantHandler();
    void doLightCalc();
    vector<PlantBase> plantList;
   
  protected:
    WeatherModule Weather;
    int day;
    double latitude;
    double diffuseLight;
    double directLight;
    unsigned int fidelity; //How many slices to cut the canopy into.
    double MaxHeight(const vector<PlantBase>& input); //Return the tallest plant's height.
    double doChunkCalc(const double &chunkSize, const double whichLayer);
    double fractionAbsorbed(const double &LeafAreaIndex, const double &extinctionCoefficient); //Return fraction absorbed.
    double fractionReflected(); //Always 0.08.
    double getTotalLeafArea(vector<PlantBase>& input, const double min, const double max);

...o_O

I thought C++ people encourage you to use long, descriptive names, since short variable names are a thing of C (or the past in general). Also, I guess it's because I learned C++ first, but its syntax is natural to me xD Can you expand upon that topic? I'm curious, since I'm probably blind to C++'s problems.


In other news, my plant model is going along okayish. Time to plug in the core of this version of the model, the light-per-canopy-area-and-height-with-a-bunch-of-variables!
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3713 on: January 23, 2013, 10:27:57 am »

You are a good person doing a good thing with those variable names.

Most C++ programmers are neither of those, apparently.

You should be proud.

(But yeah, it definitely seems to be that the older a programmer is, the more likely they are to value a foolish "conciseness" over something like "clarity" - there are still plenty of youngsters who do the same, though)

Like most terrible syntax issues in language, I'm sure they aren't so bad when you get use to them, but at the very least the syntax for declaring pointers is terrible. So terrible in fact that most people do it wrong because it's easier to understand what's going on if you pretend something completely different is happening. (And since C++ ignores spaces most of the time, it still works)
« Last Edit: January 23, 2013, 10:30:56 am by GlyphGryph »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3714 on: January 23, 2013, 11:06:35 am »

Ooh yeah, they reuse that * everywhere! xD (Not sure if you're talking about this, but still...)
a*=b; is times equals, while int *pointer is a pointer. But *pointer dereferences a pointer, whie functions can have a type of int* function() which return &address. Then there's char* instead of a more intiutive form, like char[]... unless I'm mistaking that for something that does exist. I personally just use <string> out of laziness.

**thisVar->*otherPointer.yolo**anotherPointer***PointerToAPointer;
... is probably an absurd but valid example of confusing pointers.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3715 on: January 23, 2013, 11:12:50 am »

Yes, I think you've got at least a basic understanding of my issue here.

I was specifically referring to how many people write things like "int* pointer" when it's actually declaring the pointer implicitly through giving a type to the dereference in the form of "int *pointer". But the whole & and * syntaxes are just... I dunno, they feel like they could be at least a wee bit less obtuse.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3716 on: January 23, 2013, 11:17:01 am »

Hmm, that went over my head. :(

I thought <type>* <name> and <type> *<name> and <type>*<name> and <type> * <name> were functionally identical. Whitespace is ignored...
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3717 on: January 23, 2013, 11:30:33 am »

Yes, functionally identical because they are all
"int*a".

However, "int* a, b" does not do what the syntax would seem to imply, because the "*" isn't actually tied to the int, it's a dereference and tied to the variable, so it results in "int(*a),b".
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3718 on: January 23, 2013, 11:39:33 am »

Oh, that's what you meant.

I never had that problem, probably because I rarely init more than one variable on a single line.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3719 on: January 23, 2013, 11:41:55 am »

I'm not saying it's like a huge issue, it's just... it doesn't seem like the best possible convention, if you catch my drift.

It's mostly edge cases where it doesn't work as expected, but edge cases are the WORST cases!
Logged
Pages: 1 ... 246 247 [248] 249 250 ... 796