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

Started by
8 comments, last by leiavoia 19 years, 6 months ago
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.
FTA, my 2D futuristic action MMORPG
Advertisement
heh, that is usually pretty bad... hard to remember what style each function uses, and it just looks strange.
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.
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.
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
010001000110000101100101
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.
I prefer to start with lower case first leter and then the first leter of the word is uppercase. For example:

theLongLongFunction();
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.
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.
FTA, my 2D futuristic action MMORPG
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 :-)

This topic is closed to new replies.

Advertisement