SFML community forums

General => General discussions => Topic started by: supperpiccle on April 03, 2013, 12:58:17 am

Title: Why change the spelling of functions
Post by: supperpiccle on April 03, 2013, 12:58:17 am
I was developing a game using sfml 1.6 and anytime i would ask a question here i would get doged to go to 2.0.  Well i would gladly do it if most of the game had not been wrote.  What was the reason for going to camel case on all the functions?
Title: Re: Why change the spelling of functions
Post by: binary1248 on April 03, 2013, 01:10:06 am
http://lmgtfy.com/?q=SFML+naming+convention

Maybe Google should spend their billions on the next improvement to their search engine usability and create a real, non-hoax brain-to-computer interface that eases the inhumane burden of typing into a search box. And at the same time Laurent should make forum search somewhat usable ;).
Title: Re: Why change the spelling of functions
Post by: supperpiccle on April 03, 2013, 01:46:20 am
You know what? this is the absolute worst community i have ever seen everyone seems to treat everyone like an idiot and i can tell you it is not appreiciated.  If we did not need the help i wouldnt ask and thank you very much i did google with why did sfml 2.0 go to camel case and got no results.  Don't worry it's not just you it's every stinken "hero member" or "full member" or whatever.  You all just need to get off your high horse and just humble yourselves.  If your gonna help somebody don't make them feel like an idiot.
Title: Re: Why change the spelling of functions
Post by: Nexus on April 03, 2013, 09:55:59 am
You know what? this is the absolute worst community i have ever seen
Interesting to draw conclusions about the whole community from a single answer. If you knew the single members a little bit better, you would not take everything so seriously.

The naming convention was mainly changed because the new one is more widespread and popular. Laurent didn't want to change it again later, so SFML 2 seemed like the best opportunity for it.
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 10:10:28 am
I got another one: http://www.merriam-webster.com/dictionary/sarcasm ;)

supperpiccle, indeed the community around SFML is very nice and newbie-friendly. However there's really a thread that's discussing the whole naming convention stuff (the lmgtfy link shows it). Maybe binary1248 should have linked to that instead, but I'd recommend to not take things personal in forums. ;)

Since we're all in peace again, let's discuss switching from javaStyleNamingConvention to hacker_cpp_convention. I'm sure Laurent is very open-minded in that regard! ;)
Title: Re: Why change the spelling of functions
Post by: Nexus on April 03, 2013, 11:41:53 am
Since we're all in peace again, let's discuss switching from javaStyleNamingConvention to hacker_cpp_convention. I'm sure Laurent is very open-minded in that regard! ;)
Is there even a library apart from Boost that uses the standard_style convention? :P
Title: Re: Why change the spelling of functions
Post by: eXpl0it3r on April 03, 2013, 12:02:32 pm
Is there even a library apart from Boost that uses the standard_style convention? :P
Yes! FWMS, FWCS, FWU and FWSG - yeah all FlexWorld libraries. ;D
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 01:28:17 pm
Quote
Yes! FWMS, FWCS, FWU and FWSG - yeah all FlexWorld libraries.
Don't forget the upcoming FWB (FW Build) and FWL (FW Language). :P
Title: Re: Why change the spelling of functions
Post by: G. on April 03, 2013, 02:31:07 pm
and thank you very much i did google with why did sfml 2.0 go to camel case and got no results.
When I google why did sfml 2.0 go to camel case, there are 131k results, and the "New naming convention" thread is the sixth (or third) result of the first page, I wouldn't call that "no results".  ???
Title: Re: Why change the spelling of functions
Post by: FRex on April 03, 2013, 02:40:40 pm
Quote
Since we're all in peace again, let's discuss switching from javaStyleNamingConvention to hacker_cpp_convention. I'm sure Laurent is very open-minded in that regard! ;)
To make it interesting I think You, Nexus and Laurent should take turns using all three in a way so that every lib has different convention than the other two. To make it even better replace hacker_cpp with something else to not be consistent with STL either. :D
Quote
Yes! FWMS, FWCS, FWU and FWSG - yeah all FlexWorld libraries.
Don't forget the upcoming FWB (FW Build) and FWL (FW Language). :P
You use hacker_cpp_convention?? Seriously? ???
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 02:45:34 pm
Quote
so that every lib has different convention than the other two
Too late, Nexus already got weak and changed to helloJava. SFGUI is still at OldSchool, so it's already different. ;)

Quote
You use hacker_cpp_convention?? Seriously?
Yep.
Title: Re: Why change the spelling of functions
Post by: FRex on April 03, 2013, 03:01:37 pm
Stop calling it helloJava(even if it sounds so funny ;D), I hate Java but I like the camelCase.
Quote
Quote
You use hacker_cpp_convention?? Seriously?
Yep.
what_the_hell("?!?!?");
Quote
Is there even a library apart from Boost that uses the standard_style convention? :P
I was telling that someone just the other day. And now Tank comes out with his hello_stefan_convetion.. :(

Maybe we should open a thread in General Discussion about our coding standards and naming conventions and share them and oh, it's so cute and sweet..  ;D ;D
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 03:10:19 pm
Quote
what_the_hell("?!?!?");[...]And now Tank comes out with his hello_stefan_convetion
I assume you don't like it? I even don't get why people use different styles for C++. In other languages people tend to stick to the naming conventions the standard lib uses, at least in Python, JavaScript, Ruby and similar languages.

back_to_the_roots please. :) (and btw, I'm typing on a QWERTZ keyboard with German layout, that means I have to hold shift and then press - to get an underscore!)
Title: Re: Why change the spelling of functions
Post by: Nexus on April 03, 2013, 03:18:22 pm
Too late, Nexus already got weak and changed to helloJava
Hey, while you were saying "good that you did it", I fought the camelCase convention (http://en.sfml-dev.org/forums/index.php?topic=6709.msg44956#msg44956)! :D

And imagine Thor as a direct SFML extension to call everything differently -- it would be a giant mess, especially at classes like thor::BigSprite which inherits sf::Drawable and sf::Transformable ;)


I even don't get why people use different styles for C++.
Because the default_one seems to be awful enough that almost nobody likes it. Probably because people consider all the underscores less readable, especially in combination with operators.
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 04:03:46 pm
Quote
Hey, while you were saying "good that you did it", I fought the camelCase convention!
That's one point for you -- however the "good that you did it" was targeted at the "I change the naming convention", not the camelCase. ;)

Quote
Because the default_one seems to be awful enough that almost nobody likes it. Probably because people consider all the underscores less readable, especially in combination with operators.
Strange, because underscores are easier on the eyes than helloJavaWorld (compare with hello_java_world, I can better separate the words). But well, in the end it's just personal taste.

I'm fine with the conventions -- at least they're consistent, that's important.
Title: Re: Why change the spelling of functions
Post by: Laurent on April 03, 2013, 04:22:52 pm
Quote
Strange, because underscores are easier on the eyes than helloJavaWorld (compare with hello_java_world, I can better separate the words).
By separating the words inside identifiers more easily, you make separating the identifiers themselves harder. In other words, it's more important to see the space between identifiers rather than the space inside them. By using underscores, which look like spaces, the limit between words-inside-identifiers and identifiers themselves gets thiner, which makes the code harder to decode.

Which one is the easiest to read?

my object.the member = some strange value;

myobject.themember = somestrangevalue;

For a book, the first one. For a source code, definitely the second one. Because we don't care if the object name or its member is made of several words or just one -- for the programmer it's still a single identifier, and it must be seen as such ;)

I think it's the most common complain about this naming convention.
Title: Re: Why change the spelling of functions
Post by: zsbzsb on April 03, 2013, 06:57:12 pm
Personally I don't care what the naming convention is, but in reality there will always be different conventions. Each have their own "pros" and "cons" and all the while different people will prefer one convention over the other.

But in the end there is no way to satisfy everyone. So in your own code use the convention you want and if you use a library that uses a convention you don't like then either deal with it, write your own wrapper around it, or choose an alternative library.
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 07:38:02 pm
Quote
Which one is the easiest to read?
Honestly? The first one, both for book- and source reading. And if something's good readable in a book, then it should be great in source too. Or do you want to tell me that you don't want to read source code like a book? ;)

I agree to zsbzsb. I also don't really care what naming conventions libraries I use are using. As long as it's not hElLoWoRlD(), but I haven't seen that so far.
Title: Re: Why change the spelling of functions
Post by: Haze on April 03, 2013, 08:05:24 pm
Quote
what_the_hell("?!?!?");[...]And now Tank comes out with his hello_stefan_convetion
I assume you don't like it? I even don't get why people use different styles for C++. In other languages people tend to stick to the naming conventions the standard lib uses, at least in Python, JavaScript, Ruby and similar languages.
Don't worry, I use the superior_cpp_naming_convention when I code in Java or JS in retaliation.

I'm also very surprised people can actually find it less readable, as I precisely prefer this naming convention for its readability.
However it makes identifiers a bit longer (thus, longer lines).
Title: Re: Why change the spelling of functions
Post by: FRex on April 03, 2013, 08:41:47 pm
Quote
I assume you don't like it?
I just didn't ever see anyone use hello_stefan while not joking or messing around except boost(glorified std) and std(if they changed it, they'd break so much code it's not even funny).
Quote
I even don't get why people use different styles for C++.
Because c++ doesn't make programer brainless? ;D
Quote
As long as it's not hElLoWoRlD(), but I haven't seen that so far.
This would make great april fools joke from Laurent.
#include <SfMl/gRaPhiCs.hP+>
int main()
{
sF::ReNdErWiNdOw app(sF::ViDeOmOdE(600,480),"Hello Laurent");
while(app.IsOpEn())
{
sF::EvEnT eve;
while(app.pOlLeVeNt(eve)) if(eve.tYpE==sF::EvEnT::cLoSeD) app.cLoSe();
app.cLeAr();
app.dIsPlAy();
}

}
This is hElLoLaUrEnT convention.
Title: Re: Why change the spelling of functions
Post by: Cornstalks on April 03, 2013, 09:57:22 pm
Not that I'm super relevant, but I use camelCase primarily because it makes it easy to differentiate between types and objects. I don't really hate the underscore convention (and sometimes I use it myself, depending on the project), but I like the "rule" that if the first letter is a capital, it's a class/type, whereas if the first letter is not a capital, it's not a class/type. The standard naming convention used in C++ doesn't give you any kind of indication on that.
Title: Re: Why change the spelling of functions
Post by: Tank on April 03, 2013, 11:53:23 pm
I have to admit that I use ThisOne for types.. Shame on me, but I also like to immediately see what's a type and what's a variable/CONSTANT.
Title: Re: Why change the spelling of functions
Post by: MorleyDev on April 04, 2013, 08:47:07 pm
The words themselves are as readable in either, obviously, but many prefer camelCase because it makes it easier to differentiate between variables, classes and functions with camelCase (of both the Java and C# variates). So to them, camelCase means less writing and less thought for the same functionality.

Can't say I disagree. Of course you shouldn't take that argument too far, otherwise you end up with the pointless Hungarian notation...