Jump to content
  • Advertisement
Sign in to follow this  
graveyard filla

how bad is it to change a coding habit in the middle of a project?

This topic is 5044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, the whole time i've been working on my game i use the function notation Some_Function(), Function(), Some_Long_Funcname(), etc... now im starting to like SomeFunction(), SomeLongFuncname() better... its just easier to type without the underscore and nicer looking in some cases.. however, i dont know if its a good idea to start switching function styles in the middle of my project. it's over 10k lines now and i dont want to have to go through and change it everywhere... should i just ride it out using these? i could be working on this project for awhile (at least another 6 months probably longer). thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
heh, that is usually pretty bad... hard to remember what style each function uses, and it just looks strange.

Share this post


Link to post
Share on other sites
Quote:
Original post by graveyard filla
hi,

the whole time i've been working on my game i use the function notation Some_Function(), Function(), Some_Long_Funcname(), etc...

now im starting to like SomeFunction(), SomeLongFuncname() better... its just easier to type without the underscore and nicer looking in some cases.. however, i dont know if its a good idea to start switching function styles in the middle of my project. it's over 10k lines now and i dont want to have to go through and change it everywhere... should i just ride it out using these? i could be working on this project for awhile (at least another 6 months probably longer).

thanks for any help.


Are you using Visual Studio?

Because if you do decide to change style you could have the full project changed over in no time. You can use replace all and check the whole solution. It would be a boring job to switch over, but unless you have TONS of code written already than it shouldn't take more than an hour or so.

Share this post


Link to post
Share on other sites
Hi!
Well, the biggest factor I think would be how long it would take to rename all your functions. You have a few options:
- rename all functions in your IDE: this can be quite time consuming like you said.
- write a parser that will do it automagically: it would probably be faster than trying rename everything by hand, depending on the complexity of your code.
- #define Some_Long_Func SomeLongFunc: I wouldn't do this, but that's just my personal preference.

I would say just stick with what you have, unless you feel that you *need* the different naming style.

Share this post


Link to post
Share on other sites
Quote:
Original post by Saruman
Are you using Visual Studio?

Because if you do decide to change style you could have the full project changed over in no time. You can use replace all and check the whole solution. It would be a boring job to switch over, but unless you have TONS of code written already than it shouldn't take more than an hour or so.


I completely agree, you could easily scan through sections of your code and make sure you're only using underlines for the functions, then select that section and use the Replace All function... and continue with all sections. I couldnt see it taking more than an hour or maybe two.

Alternatively if you dont have Visual Studio, you could use Macromedia Dreamweaver's replace function, or various other programs that have it.

Replace: _
With: //dont replace it with anything, aka remove it

Share this post


Link to post
Share on other sites
Notepad would work for that. I personally prefer this notation: here_is_a_function(). That's the style Gtk+ uses and I think it's very clear.

Share this post


Link to post
Share on other sites
I prefer to start with lower case first leter and then the first leter of the word is uppercase. For example:

theLongLongFunction();

Share this post


Link to post
Share on other sites
It might be bad if you keep changing the notation all the time.. better stick to a notation which feels right and then follow it always.
I have Member_Function() in classes, but normal_function() outside class.

Share this post


Link to post
Share on other sites
it's just that some functions look ugly when using the notation. such as Some_Long_Function_Name(), is kind of ugly, where as SomeLongFunctionName() looks a little nicer and is easier to type. i really dont feel like going through and changing it all though (i do use VS 7.1 and i love the replace feature..). finding and replacing '_' with blank was a clever idea though, ill keep it in mind. hell, in theory i could just open the project and find and replace all '_' with blanks. i mean, where else is an underscore used?

thanks for all the replies.

Share this post


Link to post
Share on other sites
You could write a Perl script to do that really quick ;-)

But outside of that, i don't think it would be *that* hard to just do a brute-force renaming campaign. It wouldn't take more than an hour or two, even with a lot of files. You'll feel better afterwards!

Alternatively, you could just quit your project and start a whole new one from scratch :-)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!